[libvirt] fix change-media bug on disk block type and support volume type

Guannan Ren gren at redhat.com
Mon May 27 12:55:00 UTC 2013


Resolves:https://bugzilla.redhat.com/show_bug.cgi?id=923053
When cdrom is block type, the virsh change-media failed to insert
source info because virsh uses "<source block='/dev/sdb'/>" while
the correct name of the attribute for block disks is "dev".

Correct XML:
    <disk type='block' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/sdb'/>
      <target dev='vdb' bus='virtio'/>
      <readonly/>
    </disk>

And, this patch supports cdrom with volume type for change-media command
For example:

'/var/lib/libvirt/images/boot.iso' is a volume path of 'boot.iso' volume
on 'default' pool and the cdrom device has no source.

Virsh command:
 virsh change-media rhel6qcow2 vdb /var/lib/libvirt/images/boot.iso --insert

The updated disk XML:
    <disk type='volume' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source pool='default' volume='boot.iso'/>
      <target dev='vdb' bus='virtio'/>
      <readonly/>
    </disk>

Guannan Ren(3)
 [PATCH 1/3] qemu: throw original error when failing to lookup pool or volume
 [PATCH 2/3] qemu: support updating pool and volume info when disk is volume type
 [PATCH 3/3] virsh: fix change-media bug on disk block type and support volume type

 src/conf/domain_conf.c   |  2 +-
 src/conf/domain_conf.h   |  1 +
 src/libvirt_private.syms |  1 +
 src/qemu/qemu_conf.c     | 11 ++++++++++-
 src/qemu/qemu_driver.c   |  5 +++++
 tools/virsh-domain.c     | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++------
 6 files changed, 69 insertions(+), 8 deletions(-)




More information about the libvir-list mailing list