/* Move to virDomainXMLOption later */
unsigned char macPrefix[VIR_MAC_PREFIX_BUFLEN];
- int defaultDiskDriverType; /* enum virStorageFileFormat */
int (*defaultConsoleTargetType)(const char *ostype, virArch guestarch);
bool hasWideScsiBus;
};
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) {
driverType);
goto error;
}
- } else if (def->mirror) {
- def->mirrorFormat = caps->defaultDiskDriverType;
}
if (def->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE
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"));
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;
+ }
}
}
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
<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'/>
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
<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'/>
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
<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'/>
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
<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'/>
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
<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'/>
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=:\
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\;\
<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'/>
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,\
<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'/>
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
<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'/>