mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-31 10:05:31 +00:00
virCaps: get rid of defaultDiskDriverType
Use the qemu specific callback to fill this data in the qemu driver as it's the only place where it was used and fix tests as the qemu test capability object didn't configure the defaults for the tests.
This commit is contained in:
parent
b5def001cc
commit
b299084988
@ -163,7 +163,6 @@ struct _virCaps {
|
||||
|
||||
/* Move to virDomainXMLOption later */
|
||||
unsigned char macPrefix[VIR_MAC_PREFIX_BUFLEN];
|
||||
int defaultDiskDriverType; /* enum virStorageFileFormat */
|
||||
int (*defaultConsoleTargetType)(const char *ostype, virArch guestarch);
|
||||
bool hasWideScsiBus;
|
||||
};
|
||||
|
@ -4824,9 +4824,6 @@ virDomainDiskDefParseXML(virCapsPtr caps,
|
||||
driverType);
|
||||
goto error;
|
||||
}
|
||||
} else if (def->type == VIR_DOMAIN_DISK_TYPE_FILE ||
|
||||
def->type == VIR_DOMAIN_DISK_TYPE_BLOCK) {
|
||||
def->format = caps->defaultDiskDriverType;
|
||||
}
|
||||
|
||||
if (mirrorFormat) {
|
||||
@ -4837,8 +4834,6 @@ virDomainDiskDefParseXML(virCapsPtr caps,
|
||||
driverType);
|
||||
goto error;
|
||||
}
|
||||
} else if (def->mirror) {
|
||||
def->mirrorFormat = caps->defaultDiskDriverType;
|
||||
}
|
||||
|
||||
if (def->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE
|
||||
|
@ -574,12 +574,6 @@ virCapsPtr virQEMUDriverCreateCapabilities(virQEMUDriverPtr driver)
|
||||
if (!(caps = virQEMUCapsInit(driver->qemuCapsCache)))
|
||||
goto no_memory;
|
||||
|
||||
if (cfg->allowDiskFormatProbing) {
|
||||
caps->defaultDiskDriverType = VIR_STORAGE_FILE_AUTO;
|
||||
} else {
|
||||
caps->defaultDiskDriverType = VIR_STORAGE_FILE_RAW;
|
||||
}
|
||||
|
||||
if (virGetHostUUID(caps->host.host_uuid)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot get the host uuid"));
|
||||
|
@ -693,13 +693,41 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
||||
goto no_memory;
|
||||
}
|
||||
|
||||
if (dev->type == VIR_DOMAIN_DEVICE_DISK &&
|
||||
!dev->data.disk->driverName &&
|
||||
driver &&
|
||||
(cfg = virQEMUDriverGetConfig(driver))) {
|
||||
if (!cfg->allowDiskFormatProbing &&
|
||||
!(dev->data.disk->driverName = strdup("qemu"))) {
|
||||
goto no_memory;
|
||||
/* set default disk types and drivers */
|
||||
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
|
||||
virDomainDiskDefPtr disk = dev->data.disk;
|
||||
|
||||
/* both of these require data from the driver config */
|
||||
if (driver && (cfg = virQEMUDriverGetConfig(driver))) {
|
||||
/* assign default storage format and driver according to config */
|
||||
if (cfg->allowDiskFormatProbing) {
|
||||
/* default disk format for drives */
|
||||
if (disk->format == VIR_STORAGE_FILE_NONE &&
|
||||
(disk->type == VIR_DOMAIN_DISK_TYPE_FILE ||
|
||||
disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK))
|
||||
disk->format = VIR_STORAGE_FILE_AUTO;
|
||||
|
||||
/* default disk format for mirrored drive */
|
||||
if (disk->mirror &&
|
||||
disk->mirrorFormat == VIR_STORAGE_FILE_NONE)
|
||||
disk->mirrorFormat = VIR_STORAGE_FILE_AUTO;
|
||||
} else {
|
||||
/* default driver if probing is forbidden */
|
||||
if (!disk->driverName &&
|
||||
!(disk->driverName = strdup("qemu")))
|
||||
goto no_memory;
|
||||
|
||||
/* default disk format for drives */
|
||||
if (disk->format == VIR_STORAGE_FILE_NONE &&
|
||||
(disk->type == VIR_DOMAIN_DISK_TYPE_FILE ||
|
||||
disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK))
|
||||
disk->format = VIR_STORAGE_FILE_RAW;
|
||||
|
||||
/* default disk format for mirrored drive */
|
||||
if (disk->mirror &&
|
||||
disk->mirrorFormat == VIR_STORAGE_FILE_NONE)
|
||||
disk->mirrorFormat = VIR_STORAGE_FILE_RAW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
|
||||
pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
|
||||
-no-acpi -boot c -usb -drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0 \
|
||||
-no-acpi -boot c -usb \
|
||||
-drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,format=raw \
|
||||
-drive file=nbd:example.org:6000:exportname=bar,if=virtio,format=raw \
|
||||
-net none -serial none -parallel none
|
||||
|
@ -15,6 +15,7 @@
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu</emulator>
|
||||
<disk type='block' device='disk'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
<target dev='hda' bus='ide'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
|
||||
pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
|
||||
-no-acpi -boot c -usb -drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0 \
|
||||
-no-acpi -boot c -usb \
|
||||
-drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,format=raw \
|
||||
-drive 'file=nbd://[::1]:6000/bar,if=virtio,format=raw' -net none \
|
||||
-serial none -parallel none
|
||||
|
@ -15,6 +15,7 @@
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu</emulator>
|
||||
<disk type='block' device='disk'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
<target dev='hda' bus='ide'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
|
||||
pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
|
||||
-no-acpi -boot c -usb -drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0 \
|
||||
-no-acpi -boot c -usb \
|
||||
-drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,format=raw \
|
||||
-drive 'file=nbd://[::1]:6000,if=virtio,format=raw' -net none \
|
||||
-serial none -parallel none
|
||||
|
@ -15,6 +15,7 @@
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu</emulator>
|
||||
<disk type='block' device='disk'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
<target dev='hda' bus='ide'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
|
||||
pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
|
||||
-no-acpi -boot c -usb -drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0 \
|
||||
-no-acpi -boot c -usb \
|
||||
-drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,format=raw \
|
||||
-drive file=nbd:unix:/var/run/nbdsock:exportname=bar,if=virtio,format=raw \
|
||||
-net none -serial none -parallel none
|
||||
|
@ -15,6 +15,7 @@
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu</emulator>
|
||||
<disk type='block' device='disk'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
<target dev='hda' bus='ide'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
|
||||
pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
|
||||
-no-acpi -boot c -usb -drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0 -drive \
|
||||
file=nbd:example.org:6000,if=virtio,format=raw -net none -serial none \
|
||||
-no-acpi -boot c -usb \
|
||||
-drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,format=raw \
|
||||
-drive file=nbd:example.org:6000,if=virtio,format=raw -net none -serial none \
|
||||
-parallel none
|
||||
|
@ -15,6 +15,7 @@
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu</emulator>
|
||||
<disk type='block' device='disk'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
<target dev='hda' bus='ide'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
|
@ -1,7 +1,7 @@
|
||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
|
||||
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
|
||||
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -drive \
|
||||
file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0 -drive \
|
||||
file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,format=raw -drive \
|
||||
'file=rbd:pool/image:\
|
||||
id=myname:\
|
||||
key=QVFDVm41aE82SHpGQWhBQXEwTkN2OGp0SmNJY0UrSE9CbE1RMUE=:\
|
||||
|
@ -1,7 +1,7 @@
|
||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
|
||||
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
|
||||
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -drive \
|
||||
file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0 -drive \
|
||||
file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,format=raw -drive \
|
||||
'file=rbd:pool/image:auth_supported=none:\
|
||||
mon_host=[\:\:1]\:6321\;example.org\:6789\;\
|
||||
[ffff\:1234\:567\:abc\:\:0f]\:6322\;\
|
||||
|
@ -15,6 +15,7 @@
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu</emulator>
|
||||
<disk type='block' device='disk'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
<target dev='hda' bus='ide'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
|
@ -1,7 +1,7 @@
|
||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
|
||||
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor \
|
||||
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -drive \
|
||||
file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0 -drive \
|
||||
file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,format=raw -drive \
|
||||
'file=rbd:pool/image:auth_supported=none:\
|
||||
mon_host=mon1.example.org\:6321\;mon2.example.org\:6322\;\
|
||||
mon3.example.org\:6322,\
|
||||
|
@ -15,6 +15,7 @@
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu</emulator>
|
||||
<disk type='block' device='disk'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
<target dev='hda' bus='ide'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
|
@ -1,5 +1,6 @@
|
||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
|
||||
pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
|
||||
-no-acpi -boot c -usb -drive file=/dev/HostVG/QEMU,,Guest,,,,1,if=ide,bus=0,unit=0 \
|
||||
-no-acpi -boot c -usb \
|
||||
-drive file=/dev/HostVG/QEMU,,Guest,,,,1,if=ide,bus=0,unit=0,format=raw \
|
||||
-drive file=sheepdog:example.org:6000:image,,with,,commas,if=virtio,format=raw \
|
||||
-net none -serial none -parallel none
|
||||
|
@ -15,6 +15,7 @@
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu</emulator>
|
||||
<disk type='block' device='disk'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source dev='/dev/HostVG/QEMU,Guest,,1'/>
|
||||
<target dev='hda' bus='ide'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
|
Loading…
Reference in New Issue
Block a user