qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: anthony@codemonkey.ws
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/7] virtio-blk: Create exit function to unregister savevm
Date: Mon, 26 Jul 2010 16:01:13 +0200	[thread overview]
Message-ID: <1280152877-29037-4-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1280152877-29037-1-git-send-email-kwolf@redhat.com>

From: Alex Williamson <alex.williamson@redhat.com>

Otherwise we can't migrate after we've removed a virtio block device.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/virtio-blk.c |    8 ++++++++
 hw/virtio-pci.c |    1 +
 hw/virtio.h     |    1 +
 3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index f50069d..490cd41 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -28,6 +28,7 @@ typedef struct VirtIOBlock
     BlockConf *conf;
     unsigned short sector_mask;
     char sn[BLOCK_SERIAL_STRLEN];
+    DeviceState *qdev;
 } VirtIOBlock;
 
 static VirtIOBlock *to_virtio_blk(VirtIODevice *vdev)
@@ -522,9 +523,16 @@ VirtIODevice *virtio_blk_init(DeviceState *dev, BlockConf *conf)
     s->vq = virtio_add_queue(&s->vdev, 128, virtio_blk_handle_output);
 
     qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s);
+    s->qdev = dev;
     register_savevm(dev, "virtio-blk", virtio_blk_id++, 2,
                     virtio_blk_save, virtio_blk_load, s);
     bdrv_set_removable(s->bs, 0);
 
     return &s->vdev;
 }
+
+void virtio_blk_exit(VirtIODevice *vdev)
+{
+    VirtIOBlock *s = to_virtio_blk(vdev);
+    unregister_savevm(s->qdev, "virtio-blk", s);
+}
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 31a711e..17c3d15 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -569,6 +569,7 @@ static int virtio_blk_exit_pci(PCIDevice *pci_dev)
 {
     VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
 
+    virtio_blk_exit(proxy->vdev);
     blockdev_mark_auto_del(proxy->block.bs);
     return virtio_exit_pci(pci_dev);
 }
diff --git a/hw/virtio.h b/hw/virtio.h
index e4306cd..30e472a 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -194,6 +194,7 @@ VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf *conf);
 
 
 void virtio_net_exit(VirtIODevice *vdev);
+void virtio_blk_exit(VirtIODevice *vdev);
 
 #define DEFINE_VIRTIO_COMMON_FEATURES(_state, _field) \
 	DEFINE_PROP_BIT("indirect_desc", _state, _field, \
-- 
1.7.1.1

  parent reply	other threads:[~2010-07-26 14:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-26 14:01 [Qemu-devel] [PULL 0/7] Block patches Kevin Wolf
2010-07-26 14:01 ` [Qemu-devel] [PATCH 1/7] ide/atapi: add support for GET EVENT STATUS NOTIFICATION Kevin Wolf
2010-07-26 14:01 ` [Qemu-devel] [PATCH 2/7] block migration: propagate return value when bdrv_write() returns < 0 Kevin Wolf
2010-07-26 14:01 ` Kevin Wolf [this message]
2010-07-26 14:01 ` [Qemu-devel] [PATCH 4/7] move 'unsafe' to end of caching modes in help Kevin Wolf
2010-07-26 17:28   ` [Qemu-devel] " Anthony Liguori
2010-07-27 16:10     ` Kevin Wolf
2010-07-27 16:17       ` Anthony Liguori
2010-07-26 14:01 ` [Qemu-devel] [PATCH 5/7] block: default to 0 minimal / optiomal I/O size Kevin Wolf
2010-07-26 14:01 ` [Qemu-devel] [PATCH 6/7] block: Use error codes from lower levels for error message Kevin Wolf
2010-07-26 14:01 ` [Qemu-devel] [PATCH 7/7] Fix -snapshot deleting images on disk change Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1280152877-29037-4-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).