From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:35814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qorgn-0007Vt-TN for qemu-devel@nongnu.org; Thu, 04 Aug 2011 02:45:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qorgm-0003va-Jc for qemu-devel@nongnu.org; Thu, 04 Aug 2011 02:45:53 -0400 Received: from mail-ww0-f53.google.com ([74.125.82.53]:61716) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qorgm-0003vO-CH for qemu-devel@nongnu.org; Thu, 04 Aug 2011 02:45:52 -0400 Received: by wwf26 with SMTP id 26so1424207wwf.10 for ; Wed, 03 Aug 2011 23:45:51 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4E3A401C.2010902@redhat.com> Date: Thu, 04 Aug 2011 08:45:48 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1312376904-16115-1-git-send-email-armbru@redhat.com> <1312376904-16115-28-git-send-email-armbru@redhat.com> <4E3A3ACD.5070709@suse.de> In-Reply-To: <4E3A3ACD.5070709@suse.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 27/45] scsi-disk: Preserve tray state on migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hannes Reinecke Cc: kwolf@redhat.com, stefano.stabellini@eu.citrix.com, Markus Armbruster , quintela@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, amit.shah@redhat.com, hch@lst.de On 08/04/2011 08:23 AM, Hannes Reinecke wrote: > On 08/03/2011 03:08 PM, Markus Armbruster wrote: >> Breaks migration of qdevs "scsi-cd" and legacy "scsi-disk" to older >> versions. We normally use subsections to avoid that. Not possible >> here, because we don't have a section to begin with. Too bad. >> >> Signed-off-by: Markus Armbruster >> --- >> hw/scsi-disk.c | 35 +++++++++++++++++++++++++++++++++++ >> 1 files changed, 35 insertions(+), 0 deletions(-) >> >> diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c >> index f223de6..04e0a77 100644 >> --- a/hw/scsi-disk.c >> +++ b/hw/scsi-disk.c >> @@ -1301,6 +1301,39 @@ static int scsi_disk_initfn(SCSIDevice *dev) >> return scsi_initfn(dev, scsi_type); >> } >> >> +static int scsi_cd_post_load(void *opaque, int version_id) >> +{ >> + SCSIDiskState *s = opaque; >> + >> + bdrv_eject(s->bs, s->tray_open); >> + bdrv_lock_medium(s->bs, s->tray_locked); >> + return 0; >> +} >> + >> +static const VMStateDescription vmstate_scsi_cd = { >> + .name = "scsi-cd", >> + .version_id = 0, >> + .minimum_version_id = 0, >> + .post_load = scsi_cd_post_load, >> + .fields = (VMStateField[]) { >> + VMSTATE_BOOL(tray_open, SCSIDiskState), >> + VMSTATE_BOOL(tray_locked, SCSIDiskState), >> + VMSTATE_END_OF_LIST() >> + } >> +}; >> + >> +static const VMStateDescription vmstate_scsi_disk = { >> + .name = "scsi-disk", >> + .version_id = 0, >> + .minimum_version_id = 0, >> + .post_load = scsi_cd_post_load, >> + .fields = (VMStateField[]) { >> + VMSTATE_BOOL(tray_open, SCSIDiskState), >> + VMSTATE_BOOL(tray_locked, SCSIDiskState), >> + VMSTATE_END_OF_LIST() >> + } >> +}; >> + > And again; if we had just one 'flags' value we would have to save only > one variable. And wouldn't need to touch this one for future states. Agreed, but we have time until 0.16 to fix this. I plan to migrate more stuff (unit attention state, for one), I'll take care of this too. Paolo