| Summary: | libvirt should forbid to attach a device with boot order for the first time if the os/boot element exists | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | hongming <honzhang> | |
| Component: | libvirt | Assignee: | Jiri Denemark <jdenemar> | |
| Status: | CLOSED WONTFIX | QA Contact: | Virtualization Bugs <virt-bugs> | |
| Severity: | medium | Docs Contact: | ||
| Priority: | unspecified | |||
| Version: | 6.5 | CC: | acathrow, dyuan, jiahu, mzhan, zsong | |
| Target Milestone: | rc | Keywords: | Upstream | |
| Target Release: | --- | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | Doc Type: | Bug Fix | ||
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 1007759 (view as bug list) | Environment: | ||
| Last Closed: | 2014-04-04 20:56:56 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: | ||
| Bug Depends On: | ||||
| Bug Blocks: | 1007759 | |||
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.
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>
*** Bug 1030796 has been marked as a duplicate of this bug. *** Development Management has reviewed and declined this request. You may appeal this decision by reopening this request. |
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: