Skip to contentSkip to conversation

attaching disk to paused guest

Qemu-devel Liron Aravot 2 participants 2 messages Apr 3, 2013 – Apr 4, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi,
does qemu support attaching disk to a paused guest? Does it makes sense to allow this operation?

#2 lore raw
Quoted 1 line · Liron Aravot

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