mirror of https://gitee.com/openkylin/libvirt.git
qemu: domain: Use 'raw' for 'volume' disks without format
Storage pools might want to specify format of the image when translating the volume thus we can't add any default format when parsing the XML. Add a explicit format when starting the VM and format is not present neither by user specifying it nor by the storage pool translation function. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
2f78ca803a
commit
3bc3cca7bb
|
@ -13714,6 +13714,11 @@ qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
|
|||
{
|
||||
qemuDomainPrepareDiskCachemode(disk);
|
||||
|
||||
/* add raw file format if the storage pool did not fill it in */
|
||||
if (disk->src->type == VIR_STORAGE_TYPE_VOLUME &&
|
||||
disk->src->format <= VIR_STORAGE_FILE_NONE)
|
||||
disk->src->format = VIR_STORAGE_FILE_RAW;
|
||||
|
||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
|
||||
if (qemuDomainPrepareDiskSourceBlockdev(disk, priv, cfg) < 0)
|
||||
return -1;
|
||||
|
|
|
@ -21,16 +21,16 @@ server,nowait \
|
|||
-no-shutdown \
|
||||
-no-acpi \
|
||||
-usb \
|
||||
-drive file=/some/block/device/unit:0:0:1,if=none,id=drive-ide0-0-1,\
|
||||
-drive file=/some/block/device/unit:0:0:1,format=raw,if=none,id=drive-ide0-0-1,\
|
||||
media=cdrom,readonly=on \
|
||||
-device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
|
||||
-drive file=iscsi://iscsi.example.com:3260/demo-target/2,if=none,\
|
||||
-drive file=iscsi://iscsi.example.com:3260/demo-target/2,format=raw,if=none,\
|
||||
id=drive-ide0-0-2,media=cdrom,readonly=on \
|
||||
-device ide-drive,bus=ide.0,unit=2,drive=drive-ide0-0-2,id=ide0-0-2 \
|
||||
-drive file=/tmp/idedisk.img,format=raw,if=none,id=drive-ide0-0-3 \
|
||||
-device ide-drive,bus=ide.0,unit=3,drive=drive-ide0-0-3,id=ide0-0-3,\
|
||||
bootindex=1 \
|
||||
-drive file=iscsi://iscsi.example.com:3260/demo-target/3,if=none,\
|
||||
-drive file=iscsi://iscsi.example.com:3260/demo-target/3,format=raw,if=none,\
|
||||
id=drive-ide0-0-4,media=cdrom,readonly=on \
|
||||
-device ide-drive,bus=ide.0,unit=4,drive=drive-ide0-0-4,id=ide0-0-4 \
|
||||
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
|
||||
|
|
|
@ -21,8 +21,8 @@ server,nowait \
|
|||
-no-shutdown \
|
||||
-no-acpi \
|
||||
-usb \
|
||||
-drive file=/some/block/device/cdrom,if=none,id=drive-ide0-0-1,media=cdrom,\
|
||||
readonly=on \
|
||||
-drive file=/some/block/device/cdrom,format=raw,if=none,id=drive-ide0-0-1,\
|
||||
media=cdrom,readonly=on \
|
||||
-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 \
|
||||
-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \
|
||||
|
|
Loading…
Reference in New Issue