From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Lalancette Subject: Re: [PATCH]: Make migration handle errors a little better Date: Thu, 24 Jan 2008 14:41:58 -0500 Message-ID: <4798EA06.5090202@redhat.com> References: <4797997A.1050809@redhat.com> <47987021.6010203@qumranet.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070902030906050601050506" Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Uri Lublin Return-path: In-Reply-To: <47987021.6010203-atKUWr5tajBWk0Htik3J/w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org This is a multi-part message in MIME format. --------------070902030906050601050506 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Uri Lublin wrote: > Patch looks good. > Why did you define MIG_STAT_DIRTY_TRACK_FAIL and not > MIG_STAT_KVM_SET_DIRTY_TRACKING_FAILED ? Oops, I slightly misunderstood this bit in my last e-mail. You were saying that there is already a "MIG_STAT_KVM_SET_DIRTY_TRACKING_FAILED" error flag. In the new patch (attached), I've used this instead. > Also we need to make sure, in case of a failure, that 'status' is > updated and *s->has_error is freed. How about calling migrate_finish ? And I now call migrate_finish() instead of migrate_close() in the error path, as you suggest. Thanks again! Signed-off-by: Chris Lalancette --------------070902030906050601050506 Content-Type: text/x-patch; name="kvm-60-migration-error-checking2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="kvm-60-migration-error-checking2.patch" diff --git a/qemu/migration.c b/qemu/migration.c index 17ad77c..df0acf9 100644 --- a/qemu/migration.c +++ b/qemu/migration.c @@ -425,18 +425,26 @@ static int start_migration(MigrationState *s) #endif r = MIG_STAT_WRITE_FAILED; - if (write_whole_buffer(s->fd, &running, sizeof(running))) + if (write_whole_buffer(s->fd, &running, sizeof(running))) { + perror("vm_running write failed"); goto out; - if (write_whole_buffer(s->fd, &value, sizeof(value))) + } + if (write_whole_buffer(s->fd, &value, sizeof(value))) { + perror("phys_ram_size write failed"); goto out; + } #ifdef USE_KVM if (kvm_allowed) { value = cpu_to_be32(n); - if (write_whole_buffer(s->fd, &value, sizeof(value))) + if (write_whole_buffer(s->fd, &value, sizeof(value))) { + perror("phys_ram_size_bitmap size write failed"); goto out; - if (write_whole_buffer(s->fd, phys_ram_page_exist_bitmap, n)) + } + if (write_whole_buffer(s->fd, phys_ram_page_exist_bitmap, n)) { + perror("phys_ram_page_exist_bitmap write failed"); goto out; + } } #endif fcntl(s->fd, F_SETFL, O_NONBLOCK); @@ -456,7 +464,8 @@ static int start_migration(MigrationState *s) if (cpu_physical_memory_set_dirty_tracking(1)) { *s->has_error = MIG_STAT_KVM_SET_DIRTY_TRACKING_FAILED; - return -1; + r = MIG_STAT_KVM_SET_DIRTY_TRACKING_FAILED; + goto out; } s->addr = 0; @@ -470,6 +479,8 @@ static int start_migration(MigrationState *s) qemu_mod_timer(s->timer, qemu_get_clock(rt_clock)); qemu_set_fd_handler2(s->fd, NULL, NULL, migrate_write, s); + r = 0; + out: #ifdef USE_KVM if (phys_ram_page_exist_bitmap) @@ -498,8 +509,9 @@ static MigrationState *migration_init_fd(int detach, int fd) current_migration = s; - if (start_migration(s) == -1) { + if (start_migration(s)) { term_printf("Could not start migration\n"); + migrate_finish(s); return NULL; } --------------070902030906050601050506 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ --------------070902030906050601050506 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kvm-devel mailing list kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/kvm-devel --------------070902030906050601050506--