mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 01:34:11 +03:00
qemu: command: Don't format image properties for empty -drive
If a -drive has no image, using image properties makes qemu whine that they should not be used. This patch stops formating cache/readonly/... for empty drives for the pre-blockdev syntax. Unfortunately those parameters can't be added later when inserting media, but on the other hand qemu will start with an empty drive. Since we already were able to start a VM with such config previously due to qemu ignoring them I've opted just to skip formatting them. Additionally with -blockdev support it will work as expected as the image properties will be formatted when adding the image itself which is not possible without it. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1651457 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
a641e044c1
commit
f80eae8c2a
@ -1745,10 +1745,10 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!virStorageSourceIsEmpty(disk->src)) {
|
||||||
if (disk->src->readonly)
|
if (disk->src->readonly)
|
||||||
virBufferAddLit(&opt, ",readonly=on");
|
virBufferAddLit(&opt, ",readonly=on");
|
||||||
|
|
||||||
|
|
||||||
if (disk->cachemode) {
|
if (disk->cachemode) {
|
||||||
virBufferAsprintf(&opt, ",cache=%s",
|
virBufferAsprintf(&opt, ",cache=%s",
|
||||||
qemuDiskCacheV2TypeToString(disk->cachemode));
|
qemuDiskCacheV2TypeToString(disk->cachemode));
|
||||||
@ -1775,6 +1775,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
|||||||
}
|
}
|
||||||
|
|
||||||
qemuBuildDiskThrottling(disk, &opt);
|
qemuBuildDiskThrottling(disk, &opt);
|
||||||
|
}
|
||||||
|
|
||||||
if (virBufferCheckError(&opt) < 0)
|
if (virBufferCheckError(&opt) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -27,7 +27,7 @@ bootindex=1 \
|
|||||||
-drive file=/root/boot.iso,format=raw,if=none,id=drive-ide0-0-1,media=cdrom,\
|
-drive file=/root/boot.iso,format=raw,if=none,id=drive-ide0-0-1,media=cdrom,\
|
||||||
readonly=on \
|
readonly=on \
|
||||||
-device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
|
-device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
|
||||||
-drive if=none,id=drive-ide0-1-0,media=cdrom,readonly=on,cache=none \
|
-drive if=none,id=drive-ide0-1-0,media=cdrom \
|
||||||
-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \
|
-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \
|
||||||
-drive if=none,id=drive-ide0-1-1,media=cdrom,readonly=on \
|
-drive if=none,id=drive-ide0-1-1,media=cdrom \
|
||||||
-device ide-drive,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1
|
-device ide-drive,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1
|
||||||
|
@ -28,10 +28,10 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
|||||||
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
|
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
|
||||||
-drive file=/root/boot.iso,format=raw,if=none,id=drive-ide0-0-1,readonly=on \
|
-drive file=/root/boot.iso,format=raw,if=none,id=drive-ide0-0-1,readonly=on \
|
||||||
-device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
|
-device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
|
||||||
-drive if=none,id=drive-ide0-1-0,readonly=on,cache=none \
|
-drive if=none,id=drive-ide0-1-0 \
|
||||||
-device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,\
|
-device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,\
|
||||||
write-cache=on \
|
write-cache=on \
|
||||||
-drive if=none,id=drive-ide0-1-1,readonly=on \
|
-drive if=none,id=drive-ide0-1-1 \
|
||||||
-device ide-cd,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1 \
|
-device ide-cd,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1 \
|
||||||
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
|
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
|
||||||
resourcecontrol=deny \
|
resourcecontrol=deny \
|
||||||
|
@ -28,10 +28,10 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
|||||||
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
|
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
|
||||||
-drive file=/root/boot.iso,format=raw,if=none,id=drive-ide0-0-1,readonly=on \
|
-drive file=/root/boot.iso,format=raw,if=none,id=drive-ide0-0-1,readonly=on \
|
||||||
-device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
|
-device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
|
||||||
-drive if=none,id=drive-ide0-1-0,readonly=on,cache=none \
|
-drive if=none,id=drive-ide0-1-0 \
|
||||||
-device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,\
|
-device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,\
|
||||||
write-cache=on \
|
write-cache=on \
|
||||||
-drive if=none,id=drive-ide0-1-1,readonly=on \
|
-drive if=none,id=drive-ide0-1-1 \
|
||||||
-device ide-cd,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1 \
|
-device ide-cd,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1 \
|
||||||
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
|
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
|
||||||
resourcecontrol=deny \
|
resourcecontrol=deny \
|
||||||
|
Loading…
Reference in New Issue
Block a user