Hide Forgot
Description of problem: update-device fail to update startupPolicy for hard disks with --persistent but successful with --live Version-Release number of selected component (if applicable): libvirt-2.0.0-5.el7.x86_64 qemu-kvm-rhev-2.6.0-20.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. start a guest as following, a disk with startupPolocy. # virsh dumpxml r73 | grep disk -A 9 ...... <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/mnt/at-dt/disk/a.qcow2' startupPolicy='mandatory'/> <target dev='vde' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> </disk> ...... 2. Prepare a disk xml as following, keep the disk source file bug change the value of startupPolicy. # cat disk.xml <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/mnt/at-dt/disk/a.qcow2' startupPolicy='optional'> </source> <backingStore/> <target dev='vde' bus='virtio'/> </disk> 3. update-device to live update startupPolicy successfully. # virsh update-device r73 disk.xml --live Device updated successfully 4. check domain xml # virsh dumpxml r73 | grep disk -A 9 ...... <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/mnt/at-dt/disk/a.qcow2' startupPolicy='optional'> <seclabel model='selinux' labelskip='yes'/> </source> <backingStore/> <target dev='vde' bus='virtio'/> <alias name='virtio-disk4'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> </disk> ...... 5. fail to use update-device update startupPolicy with --config or --persistent # virsh update-device r73 disk.xml --config error: Failed to update device from disk.xml error: invalid argument: this disk doesn't support update # virsh update-device r73 disk.xml --persistent error: Failed to update device from disk.xml error: invalid argument: this disk doesn't support update Actual results: As step 3, update-device update startupPolicy with --live, but fail with --config or --persistent as step 5. Expected results: The result should be consistent for updating startupPolicy in hard disks. Additional info:
For historical reasons, startupPolicy (and while update-device) aimed at live update so config update never got that much attention. Therefore just cdroms and floppies can be updated. I agree that it is a stupid limitation. Will work on the patches.
Patch proposed upstream: https://www.redhat.com/archives/libvir-list/2016-September/msg00033.html
I've just pushed patch upstream: commit 3193a594475f1565e03ddec22fd72af08e95adb2 Author: Michal Privoznik <mprivozn> AuthorDate: Wed Aug 31 11:09:58 2016 +0200 Commit: Michal Privoznik <mprivozn> CommitDate: Tue Sep 27 17:27:53 2016 +0200 qemuDomainUpdateDeviceConfig: Allow full disk update https://bugzilla.redhat.com/show_bug.cgi?id=1368417 So far, when it comes to 'virsh update-device --config' of disks we are limiting ourselves for just the disk source update and just for CDROMs and floppies. This makes no sense. Especially if you look around and see that we already allow full update to graphics and net devices. So let's just take whatever XML user wants to have there and replace our internal definition with it. Signed-off-by: Michal Privoznik <mprivozn> v2.2.0-241-g3193a59
This should have been in POST per comment 5.
verify the bug version: libvirt-3.2.0-6.el7 qemu-kvm-rhev-2.9.0-6.el7.x86_64 scenario1: [root@lmen1 ~]# virsh dumpxml uefi <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/uefi.qcow2' startupPolicy='optional'/> <backingStore/> <target dev='sda' bus='sata'/> <alias name='sata0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> [root@lmen1 ~]# cat disk.xml <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/uefi.qcow2' startupPolicy='mandatory'/> <target dev='sda' bus='sata'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> [root@lmen1 ~]# virsh update-device uefi disk.xml --live Device updated successfully [root@lmen1 ~]# virsh dumpxml uefi | grep disk -A 12 ... <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/uefi.qcow2' startupPolicy='mandatory'/> <backingStore/> <target dev='sda' bus='sata'/> <alias name='sata0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> #virsh edit uefi -->startupPolicy='optional' scenario2: [root@lmen1 ~]# virsh dumpxml uefi | grep disk -A 12 ... <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/uefi.qcow2' startupPolicy='optional'/> <backingStore/> <target dev='sda' bus='sata'/> <alias name='sata0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> [root@lmen1 ~]# cat disk.xml <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/uefi.qcow2' startupPolicy='mandatory'/> <target dev='sda' bus='sata'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> [root@lmen1 ~]# virsh update-device uefi disk.xml --config Device updated successfully [root@lmen1 ~]# virsh dumpxml uefi | grep disk -A 12 ... <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/uefi.qcow2' startupPolicy='optional'/> <backingStore/> <target dev='sda' bus='sata'/> <alias name='sata0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> [root@lmen1 ~]# virsh edit uefi <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/uefi.qcow2' startupPolicy='mandatory'/> <target dev='sda' bus='sata'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> scenario3: [root@lmen1 ~]# virsh dumpxml uefi | grep disk -A 12 ... <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/uefi.qcow2' startupPolicy='optional'/> <backingStore/> <target dev='sda' bus='sata'/> <alias name='sata0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> [root@lmen1 ~]# cat disk.xml <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/uefi.qcow2' startupPolicy='mandatory'/> <target dev='sda' bus='sata'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> [root@lmen1 ~]# virsh update-device uefi disk.xml --persistent Device updated successfully [root@lmen1 ~]# virsh dumpxml uefi | grep disk -A 12 ... <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/uefi.qcow2' startupPolicy='mandatory'/> <backingStore/> <target dev='sda' bus='sata'/> <alias name='sata0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> #virsh edit uefi <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/uefi.qcow2' startupPolicy='mandatory'/> <target dev='sda' bus='sata'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk>
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2017:1846