Bug 1007228

Summary: update-device report success when failing to set <boot order> to cdrom/floppy device.
Product: Red Hat Enterprise Linux 7 Reporter: Hu Jianwei <jiahu>
Component: libvirtAssignee: Martin Kletzander <mkletzan>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: dyuan, hhan, jdenemar, mzhan, rbalakri, shyu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.17-5.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 05:43:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hu Jianwei 2013-09-12 07:29:20 UTC
Description of problem:
libvirt do not report an error when failing to set <boot order> to cdrom device.

Version-Release number of selected component (if applicable):
libvirt-0.10.2-23.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.398.el6.x86_64
kernel-2.6.32-415.el6.x86_64

This issue can be reproduced on rhel6.4.z.
libvirt-0.10.2-18.el6_4.11.x86_64
qemu-kvm-0.12.1.2-2.355.el6.x86_64
kernel-2.6.32-358.el6.x86_64

How reproducible:
100%

Steps:
1. Define a guest with cdrom device.
[root@test666 ~]# virsh dumpxml r6 | grep "cd" -A7
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/ubuntu-12.04-server-amd64.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>
2. Make a new cdrom xml as below, just add one line <boot order>
[root@test666 ~]# cat cdrom.xml
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/ubuntu-12.04-server-amd64.iso'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<boot order='2'/>
<address type='drive' controller='0' bus='2' target='0' unit='0'/>
</disk>

3.Update cdrom device with update-device command, and check the result of update.
[root@test666 ~]# virsh update-device r6 cdrom.xml
Device updated successfully

[root@test666 ~]# virsh dumpxml r6 | grep "cd" -A7
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/ubuntu-12.04-server-amd64.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>
[root@test666 ~]#

Actual results:
As step 3, No boot order was added to domain xml, and that libvirt printed device updated successfully.

Expected results:
libvirt should print the error like the interface device or others if fail.

[root@test666 ~]#
[root@test666 ~]# virsh dumpxml r6 | grep "interface" -A7
    <interface type='network'>
      <mac address='52:54:00:da:0f:ac'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <link state='down'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
...
[root@test666 ~]# virsh update-device r6 network.xml
error: Failed to update device from network.xml
error: this function is not supported by the connection driver: cannot modify network device boot index setting

For floppy device:

[root@test666 ~]# cat floppy.xml 
<disk type='file' device='floppy'>
<driver name='qemu' type='raw' cache='none'/>
<source file='/var/lib/libvirt/images/fd2.img'/>
<target dev='fda' bus='fdc'/>
<boot order='3'/>
<address type='drive' controller='0' bus='4' target='0' unit='0'/>
</disk>
[root@test666 ~]# virsh update-device r6 floppy.xml 
Device updated successfully

[root@test666 ~]# virsh dumpxml r6 | grep floppy -A6
    <disk type='file' device='floppy'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/fd2.img'/>
      <target dev='fda' bus='fdc'/>
      <alias name='fdc0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
[root@test666 ~]#

Comment 3 Jiri Denemark 2014-04-04 21:38:08 UTC
This bug was not selected to be addressed in Red Hat Enterprise Linux 6. We will look at it again within the Red Hat Enterprise Linux 7 product.

Comment 6 Martin Kletzander 2015-07-09 16:45:26 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2015-July/msg00426.html

Comment 8 Martin Kletzander 2015-07-20 14:59:23 UTC
Fixed upstream by v1.2.17-127-g717c99f36023:

commit 717c99f3602354136ca97edca6afc8dce69aae85
Author: Martin Kletzander <mkletzan>
Date:   Thu Jul 9 18:28:38 2015 +0200

    qemu: Reject updating unsupported disk information

Comment 12 Han Han 2015-08-20 09:22:35 UTC
I can reproduce it with libvirt-1.2.17-3.el7.x86_64
Verify it on libvirt-1.2.17-5.el7.x86_64


Steps:
1. Prepare a domain with cdrom, floppy, network, and these device without <boot order>,<serial>,<wwn>,<vendor>,<product>

2. Prepare cdrom xml and with <boot order='2'/> 
or <serial>WD-WMAP9A966149</serial> 
or <wwn>0x5000c50015ea71aa</wwn>   
or <vendor>WestData</vendor>
or <product>Disk</product> in it, then UpdateDevice.
# virsh update-device tst iso.xml 
error: Failed to update device from iso.xml
error: Operation not supported: cannot modify field 'boot order' of the disk
# virsh update-device tst iso.xml 
error: Failed to update device from iso.xml
error: Operation not supported: cannot modify field 'wwn' of the disk
# virsh update-device tst iso.xml                                                                                                                          
error: Failed to update device from iso.xml
error: Operation not supported: cannot modify field 'vendor' of the disk
# virsh update-device tst iso.xml                                                                                                                          
error: Failed to update device from iso.xml
error: Operation not supported: cannot modify field 'product' of the disk

3. Prepare floppy xml and do as step2 do to floppy disk
# virsh update-device tst fd.xml 
error: Failed to update device from fd.xml
error: Operation not supported: cannot modify field 'boot order' of the disk
# virsh update-device tst fd.xml 
error: Failed to update device from fd.xml
error: Operation not supported: cannot modify field 'wwn' of the disk
# virsh update-device tst fd.xml 
error: Failed to update device from fd.xml
error: Operation not supported: cannot modify field 'vendor' of the disk
# virsh update-device tst fd.xml 
error: Failed to update device from fd.xml
error: Operation not supported: cannot modify field 'product' of the disk

4. Prepare network interface xml with <boot order='2'/>, the UpdateDevice.
# virsh update-device tst network.xml 
error: Failed to update device from network.xml
error: Operation not supported: cannot modify network device boot index setting

Comment 14 errata-xmlrpc 2015-11-19 05:43:55 UTC
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://rhn.redhat.com/errata/RHBA-2015-2202.html