[libvirt] [Qemu-devel] attaching disk to paused guest

Stefan Hajnoczi stefanha at gmail.com
Thu Apr 4 15:49:43 UTC 2013


On Wed, Apr 3, 2013 at 1:05 PM, Liron Aravot <laravot at redhat.com> wrote:
> does qemu support attaching disk to a paused guest? Does it makes sense to allow this operation?

Yes, it works.  I tested it via libvirt:

$ virsh start vm
$ cat >/tmp/disk.xml
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='path/to/new_disk.img'/>
      <target dev='vdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08'
function='0x0'/>
    </disk>
^D
$ virsh suspend vm
$ virsh list
 Id    Name                           State
----------------------------------------------------
 1     vm                               paused
$ virsh attach-device vm /tmp/disk.xml
Device attached successfully
$ virsh resume vm

The issue with hotplug is that it may involve guest cooperation.  This
is not possible when the guest is paused, but attaching a new
virtio-blk adapter is okay because we'll just have pending PCI hotplug
notifications when the guest is resumed.

Hot unplug is the nasty case because the guest OS isn't running and
cannot terminate its guest driver for the device.  Because of this,
both network adapters and disks in QEMU try to clean up after
themselves and libvirt does not need to wait for the guest to
acknowledge hot unplug.

I think both hotplug and hot unplug should work fine while the guest is paused.

Stefan




More information about the libvir-list mailing list