RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1007754 - libvirt should forbid to attach a device with boot order for the first time if the os/boot element exists
Summary: libvirt should forbid to attach a device with boot order for the first time i...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.5
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Jiri Denemark
QA Contact: Virtualization Bugs
URL:
Whiteboard:
: 1030796 (view as bug list)
Depends On:
Blocks: 1007759
TreeView+ depends on / blocked
 
Reported: 2013-09-13 09:19 UTC by hongming
Modified: 2014-04-04 20:56 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1007759 (view as bug list)
Environment:
Last Closed: 2014-04-04 20:56:56 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description hongming 2013-09-13 09:19:55 UTC
Description of problem:
When attach a device with boot order to guest for the first time , libvirt doesn't check if the os/boot exists. the device can be successfully attached to shotoff guest , and the guest is vanished after restarting libvirtd.

The following error only occurs when attaching a device with boot order for the second time. 
error: unsupported configuration: per-device boot elements cannot be used together with os/boot elements 

Version-Release number of selected component (if applicable):
libvirt-0.10.2-24.el6.x86_64.rpm

How reproducible:
100%

Steps to Reproduce:

# virsh list --all 
 Id    Name                           State
----------------------------------------------------
 -     r64                            shut off

# virsh dumpxml r64
<domain type='kvm'>
  <name>r64</name>
  <uuid>1d93ef34-6823-7abf-628e-322f140b0551</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='rhel6.3.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/kvm-rhel6.4-x86_64-raw.img'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:58:06:a2'/>
      <source network='default'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/test.agent'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <graphics type='spice' autoport='yes'/>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='qxl' ram='65536' vram='65536' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </memballoon>
  </devices>
</domain>

# cat nic.xml 
<interface type='network'>
  <source network='default'/>
  <boot order='1'/>
</interface>

# virsh attach-device r64 nic.xml --config
Device attached successfully

# cat nic1.xml
<interface type='network'>
   <source network='default'/>
   <boot order='2'/>
</interface>

# virsh attach-device r64 nic1.xml --config
error: Failed to attach device from nic1.xml
error: unsupported configuration: per-device boot elements cannot be used together with os/boot elements

# virsh dumpxml r64
<domain type='kvm'>
  <name>r64</name>
  <uuid>1d93ef34-6823-7abf-628e-322f140b0551</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='rhel6.3.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/kvm-rhel6.4-x86_64-raw.img'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:58:06:a2'/>
      <source network='default'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='network'>
      <mac address='52:54:00:0d:0a:a4'/>
      <source network='default'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </interface>
  ......
  </devices>
</domain>


# virsh start r64
error: Failed to start domain r64
error: unsupported configuration: per-device boot elements cannot be used together with os/boot elements

# service libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]

# virsh list --all
 Id    Name                           State
----------------------------------------------------



Actual results:
libvirt doesn't check if the os/boot element exists when attaching a device with boot order for the first time 

Expected results:
libvirt should forbid to attach a device with boot order for the first time if the os/boot element exists

Additional info:

Comment 2 Hu Jianwei 2013-09-13 09:58:06 UTC
This bug also can reproduce on other device, I think libvirt should parse continuity/consistency of <boot order> before adding bootable device with attach-device.

1.
[root@test666 ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     r6                             shut off

[root@test666 ~]# virsh dumpxml r6 | grep boot
  <on_reboot>restart</on_reboot>
      <boot order='1'/>
[root@test666 ~]# cat disk1.xml 
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source file='/var/lib/libvirt/images/test.img'/>
<target dev='hdb' bus='ide'/>
<boot order='5'/>
</disk>
[root@test666 ~]# virsh attach-device r6 disk1.xml --config     <=====libvirt did not check continuity of boot order for first time.
Device attached successfully

[root@test666 ~]# virsh dumpxml r6 | grep boot
  <on_reboot>restart</on_reboot>
      <boot order='1'/>
      <boot order='5'/>
[root@test666 ~]# virsh start r6
error: Failed to start domain r6
error: internal error boot orders have to be contiguous and starting from 1  

[root@test666 ~]# virsh attach-device r6 disk1.xml --config
error: Failed to attach device from disk1.xml
error: internal error boot orders have to be contiguous and starting from 1  <=======libvirt report the error for the first time.

2.
[root@test666 ~]# virsh dumpxml r6 | grep boot
  <on_reboot>restart</on_reboot>
      <boot order='1'/>

[root@test666 ~]# cat disk1.xml 
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source file='/var/lib/libvirt/images/test.img'/>
<target dev='hdb' bus='ide'/>
<boot order='1'/>
</disk>

[root@test666 ~]# virsh attach-device r6 disk1.xml --config  <=====libvirt did not check consistency of boot order for first time.
Device attached successfully

[root@test666 ~]# virsh dumpxml r6 | grep boot
  <on_reboot>restart</on_reboot>
      <boot order='1'/>
      <boot order='1'/>

[root@test666 ~]# virsh attach-device r6 disk1.xml --config
error: Failed to attach device from disk1.xml
error: internal error boot order 1 used for more than one device  <=======libvirt report the error for the first time.

Comment 4 Jiri Denemark 2014-03-20 22:14:06 UTC
This is now fixed upstream by v1.2.2-292-g6dc75f5..v1.2.2-295-g585076c:

commit 6dc75f565418a169d6b86e059bcce3d0082c8e3e
Author: Jiri Denemark <jdenemar>
Date:   Thu Mar 20 13:04:06 2014 +0100

    Fix usage of virDomainDefCompatibleDevice
    
    A device needs to be checked for compatibility with the domain
    definition it corresponds to. Specifically, for VIR_DOMAIN_AFFECT_CONFIG
    case we should check against persistent def rather than active def.
    
    Signed-off-by: Jiri Denemark <jdenemar>

commit 1c13166134bd2dd1fc5711e421ac5f983bece6a6
Author: Jiri Denemark <jdenemar>
Date:   Thu Mar 20 13:39:20 2014 +0100

    Pass action to virDomainDefCompatibleDevice
    
    When checking compatibility of a device with a domain definition, we
    should know what we're going to do with the device. Because we may need
    to check for different things when we're attaching a new device versus
    detaching an existing device.
    
    Signed-off-by: Jiri Denemark <jdenemar>

commit 563a12b3463e9a665fae02589437ecd6dba89f6b
Author: Jiri Denemark <jdenemar>
Date:   Thu Mar 20 22:34:00 2014 +0100

    conf: Introduce virDomainDeviceGetInfo API
    
    The offset of virDomainDeviceInfo structure within a device definition
    varies with device type and some types do not contain the info structure
    at all. This new API makes it easier to access the info structure from a
    generic virDomainDeviceDef structure.
    
    Signed-off-by: Jiri Denemark <jdenemar>

commit 585076c7e602bb52d34fad83963035fc03652248
Author: Jiri Denemark <jdenemar>
Date:   Thu Mar 20 15:34:32 2014 +0100

    Check boot order on device attach
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1007754
    
    When attaching a new device, we need to check if its boot order
    configuration is compatible with current domain definition.
    
    Signed-off-by: Jiri Denemark <jdenemar>

Comment 5 Jiri Denemark 2014-04-02 09:15:26 UTC
*** Bug 1030796 has been marked as a duplicate of this bug. ***

Comment 7 RHEL Program Management 2014-04-04 20:56:56 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.


Note You need to log in before you can comment on or make changes to this bug.