From patchwork Tue Nov 9 19:35:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 311982 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oA9JaCUZ010814 for ; Tue, 9 Nov 2010 19:36:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754105Ab0KITf5 (ORCPT ); Tue, 9 Nov 2010 14:35:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56876 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754099Ab0KITfz (ORCPT ); Tue, 9 Nov 2010 14:35:55 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oA9JZoMo032062 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 9 Nov 2010 14:35:50 -0500 Received: from [10.3.113.74] (ovpn-113-74.phx2.redhat.com [10.3.113.74]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oA9JZnaJ013617; Tue, 9 Nov 2010 14:35:49 -0500 Subject: Re: [PATCH 0/6] Save state error handling (kill off no_migrate) From: Alex Williamson To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, cam@cs.ualberta.ca, quintela@redhat.com, anthony@codemonkey.ws In-Reply-To: <1289324646.14321.39.camel@x201> References: <20101108205901.GB10777@redhat.com> <1289251417.28165.37.camel@x201> <20101109120020.GC22705@redhat.com> <1289314703.28165.53.camel@x201> <20101109150708.GA25725@redhat.com> <1289316894.14321.15.camel@x201> <20101109154217.GA26326@redhat.com> <1289317620.14321.19.camel@x201> <20101109161525.GA26897@redhat.com> <1289320245.14321.28.camel@x201> <20101109164917.GA27287@redhat.com> <1289324646.14321.39.camel@x201> Date: Tue, 09 Nov 2010 12:35:48 -0700 Message-ID: <1289331348.14321.58.camel@x201> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 09 Nov 2010 19:36:14 +0000 (UTC) diff --git a/savevm.c b/savevm.c index 521edc8..b0aaa46 100644 --- a/savevm.c +++ b/savevm.c @@ -1039,7 +1039,6 @@ typedef struct SaveStateEntry { const VMStateDescription *vmsd; void *opaque; CompatEntry *compat; - int no_migrate; } SaveStateEntry; @@ -1103,7 +1102,6 @@ int register_savevm_live(DeviceState *dev, se->load_state = load_state; se->opaque = opaque; se->vmsd = NULL; - se->no_migrate = 0; if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) { char *id = dev->parent_bus->info->get_dev_path(dev); @@ -1170,6 +1168,22 @@ void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque) } } +static int nomigrate_set_params(int blk_enable, int shared, void *opaque) +{ + return -EFAULT; +} + +static int nomigrate_save_live_state(Monitor *mon, QEMUFile *f, int stage, + void *opaque) +{ + return -EFAULT; +} + +static int nomigrate_save_state(QEMUFile *f, void *opaque) +{ + return -EFAULT; +} + /* mark a device as not to be migrated, that is the device should be unplugged before migration */ void register_device_unmigratable(DeviceState *dev, const char *idstr, @@ -1190,7 +1204,10 @@ void register_device_unmigratable(DeviceState *dev, const char *idstr, QTAILQ_FOREACH(se, &savevm_handlers, entry) { if (strcmp(se->idstr, id) == 0 && se->opaque == opaque) { - se->no_migrate = 1; + se->set_params = nomigrate_set_params; + se->save_live_state = nomigrate_save_live_state; + se->save_state = nomigrate_save_state; + assert(!se->vmsd); } } } @@ -1410,10 +1427,6 @@ static int vmstate_load(QEMUFile *f, SaveStateEntry *se, int version_id) static int vmstate_save(QEMUFile *f, SaveStateEntry *se) { - if (se->no_migrate) { - return -1; - } - if (!se->vmsd) { /* Old style */ return se->save_state(f, se->opaque); } @@ -1443,6 +1456,9 @@ int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable, } ret = se->set_params(blk_enable, shared, se->opaque); if (ret < 0) { + monitor_printf(mon, + "Save state begin blocked by device '%s', error:" + " %s\n", se->idstr, strerror(-ret)); return ret; } } @@ -1470,6 +1486,9 @@ int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable, ret = se->save_live_state(mon, f, QEMU_VM_SECTION_START, se->opaque); if (ret < 0) { + monitor_printf(mon, + "Save state begin blocked by device '%s', error:" + " %s\n", se->idstr, strerror(-ret)); return ret; } } @@ -1503,6 +1522,9 @@ int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f) synchronized over and over again. */ break; } else if (ret < 0) { + monitor_printf(mon, + "Save state iterate blocked by device '%s', error:" + " %s\n", se->idstr, strerror(-ret)); return ret; } } @@ -1535,6 +1557,9 @@ int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f) r = se->save_live_state(mon, f, QEMU_VM_SECTION_END, se->opaque); if (r < 0) { + monitor_printf(mon, + "Save state complete blocked by device '%s', error:" + " %s\n", se->idstr, strerror(-r)); return r; } } @@ -1559,7 +1584,9 @@ int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f) r = vmstate_save(f, se); if (r < 0) { - monitor_printf(mon, "cannot migrate with device '%s'\n", se->idstr); + monitor_printf(mon, + "Save state complete blocked by device '%s', error:" + " %s\n", se->idstr, strerror(-r)); return r; } }