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:
Peter Krempa 2013-03-13 15:28:11 +01:00
parent b5def001cc
commit b299084988
21 changed files with 59 additions and 29 deletions

View File

@ -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;
};

View File

@ -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

View File

@ -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"));

View File

@ -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;
}
}
}

View File

@ -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

View File

@ -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'/>

View File

@ -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

View File

@ -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'/>

View File

@ -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

View File

@ -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'/>

View File

@ -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

View File

@ -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'/>

View File

@ -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

View File

@ -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'/>

View File

@ -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=:\

View File

@ -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\;\

View File

@ -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'/>

View File

@ -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,\

View File

@ -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'/>

View File

@ -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

View File

@ -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'/>