summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2010-08-19 10:18:39 -0300
committerAnthony Liguori <aliguori@us.ibm.com>2010-08-19 08:44:37 -0500
commite447b1a603091cbaa5eed36c0a3c9ed3f2224535 (patch)
tree82edc428662662cc0bac507848f75bb9a4599f95
parent027c9e21e21bbe63f74ffb86381bb11315a1544c (diff)
set proper migration status on ->write error (v5)
If ->write fails, declare migration status as MIG_STATE_ERROR. Also, in buffered_file.c, ->close the object in case of an error. Fixes "migrate -d "exec:dd of=file", where dd fails to open file. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--buffered_file.c4
-rw-r--r--migration.c8
2 files changed, 10 insertions, 2 deletions
diff --git a/buffered_file.c b/buffered_file.c
index a79264f45..1836e7e24 100644
--- a/buffered_file.c
+++ b/buffered_file.c
@@ -230,8 +230,10 @@ static void buffered_rate_tick(void *opaque)
{
QEMUFileBuffered *s = opaque;
- if (s->has_error)
+ if (s->has_error) {
+ buffered_close(s);
return;
+ }
qemu_mod_timer(s->timer, qemu_get_clock(rt_clock) + 100);
diff --git a/migration.c b/migration.c
index a160462df..468d51749 100644
--- a/migration.c
+++ b/migration.c
@@ -316,8 +316,14 @@ ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)
if (ret == -1)
ret = -(s->get_error(s));
- if (ret == -EAGAIN)
+ if (ret == -EAGAIN) {
qemu_set_fd_handler2(s->fd, NULL, NULL, migrate_fd_put_notify, s);
+ } else if (ret < 0) {
+ if (s->mon) {
+ monitor_resume(s->mon);
+ }
+ s->state = MIG_STATE_ERROR;
+ }
return ret;
}