Bug 2003644
| Summary: | Cannot change CD disk on block storage when previous one has startupPolicy | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux Advanced Virtualization | Reporter: | Vojtech Juranek <vjuranek> |
| Component: | libvirt | Assignee: | Peter Krempa <pkrempa> |
| Status: | CLOSED ERRATA | QA Contact: | Han Han <hhan> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 8.6 | CC: | ehadley, jdenemar, jsuchane, lmen, pkrempa, virt-maint, xuzhang |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | 8.5 | Flags: | pm-rhel:
mirror+
|
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-7.6.0-4.module+el8.5.0+12786+c4633d9a | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-11-16 07:55:27 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: | 7.8.0 |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1990268 | ||
Fixed upstream:
commit 7e23272e35ff06335d1674348e5d74d199cae06f
Author: Peter Krempa <pkrempa>
Date: Fri Sep 10 15:33:17 2021 +0200
qemuDomainChangeDiskLive: Modify 'startupPolicy' before changing source
We don't support all startup policies with all source types so to
correctly allow switching from a 'file' based cdrom with 'optional'
startup policy to a 'block' based one which doesn't support optional we
must update the startup policy field first. Obviously we need to have
fallback if the update fails.
Reported-by: Vojtech Juranek <vjuranek>
Signed-off-by: Peter Krempa <pkrempa>
Reviewed-by: Michal Privoznik <mprivozn>
Reproduced on libvirt-7.6.0-4.module+el8.5.0+12786+c4633d9a.x86_64 qemu-kvm-6.0.0-30.module+el8.5.0+12586+476da3e1.x86_64
1. Prepare a running VM with startupPolicy in empty cdrom:
VM xml:
...
<disk type="file" device="cdrom">
<driver name="qemu" type="raw"/>
<source startupPolicy="optional"/>
<target dev="sda" bus="scsi"/>
<readonly/>
<address type="drive" controller="0" bus="0" target="0" unit="0"/>
</disk>
...
2. Prepare the following XML:
block-cdrom.xml: [3/35]
<disk type="block" device="cdrom">
<driver name="qemu" type="raw"/>
<source dev="/dev/sdb"/>
<target dev="sda" bus="scsi"/>
<readonly/>
<address type="drive" controller="0" bus="0" target="0" unit="0"/>
</disk>
empty-cdrom.xml:
<disk type="file" device="cdrom">
<driver name="qemu" type="raw"/>
<source startupPolicy="optional"/>
<target dev="sda" bus="scsi"/>
<readonly/>
<address type="drive" controller="0" bus="0" target="0" unit="0"/>
</disk>
file-cdrom.xml:
<disk type="file" device="cdrom">
<driver name="qemu" type="raw"/>
<source file="/var/lib/libvirt/images/boot.iso"/>
<target dev="sda" bus="scsi"/>
<readonly/>
<address type="drive" controller="0" bus="0" target="0" unit="0"/>
</disk>
https-cdrom.xml:
<disk type="network" device="cdrom">
<driver name="qemu" type="raw"/>
<source protocol="https" name="/fedora/releases/34/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-34-1.2.iso">
<host name="mirrors.163.com" port="443"/>
</source>
<target dev="sda" bus="scsi"/>
<readonly/>
<address type="drive" controller="0" bus="0" target="0" unit="0"/>
</disk>
3. Update to block-cdrom.xml and https-cdrom.xml:
➜ virsh update-device rhel ./block-cdrom.xml
error: Failed to update device from ./block-cdrom.xml
error: XML error: 'startupPolicy' is only valid for 'file' type volume
➜ virsh update-device rhel ./https-cdrom.xml
error: Failed to update device from ./https-cdrom.xml
error: XML error: 'startupPolicy' is only valid for 'file' type volume
Update to libvirt-7.6.0-4.module+el8.5.0+12786+c4633d9a.x86_64. It works:
➜ virsh update-device rhel ./https-cdrom.xml
Device updated successfully
➜ virsh update-device rhel ./empty-cdrom.xml
Device updated successfully
➜ virsh update-device rhel ./block-cdrom.xml
Device updated successfully
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 (virt:av bug fix and enhancement update), 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/RHBA-2021:4684 |
Description of problem: When current CD has defined startupPolicy attribute and one tries to change CD to a disk which is on block storage, it fails with libvirt.libvirtError: XML error: 'startupPolicy' is only valid for 'file' type volume Example XML of empty CD: <disk type='file' device='cdrom'> <driver name='qemu' error_policy='report'/> <source startupPolicy='optional'/> <target dev='sdc' bus='sata'/> <readonly/> <alias name='ua-d7003457-63c3-4c98-80f0-08ab5042c65e'/> <address type='drive' controller='0' bus='0' target='0' unit='2'/> </disk> Example of XML of CD to be changed, which is on block based storage: <?xml version='1.0' encoding='utf-8'?> <disk device="cdrom" type="block"> <source dev="/rhev/data-center/mnt/blockSD/cdac2a0c-b110-456d-a988-7d588626c871/images/638247d7-b4b1-4d98-87fa-c90235fcf4b1/145e7cd2-f92d-4eec-a8fb-6835b4b652e1" /> <target bus="sata" dev="sdc" /> </disk> Actual result: libvirt.libvirtError: XML error: 'startupPolicy' is only valid for 'file' type volume Expected result: CD is changed