diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h index 5e7a5f6a77..743b1f03b3 100644 --- a/src/conf/capabilities.h +++ b/src/conf/capabilities.h @@ -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; }; diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 062469635a..ec2cf23289 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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 diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 268223f75d..084b69441e 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -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")); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 30732578a6..e5e9223d15 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -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; + } } } diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-export.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-export.args index bc9d93dc53..ca70ce4fc4 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-export.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-export.args @@ -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 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-export.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-export.xml index f2b5ca46fd..7a84604a44 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-export.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-export.xml @@ -15,6 +15,7 @@ /usr/bin/qemu +
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6-export.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6-export.args index 1541073552..745efe7223 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6-export.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6-export.args @@ -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 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6-export.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6-export.xml index 595d7ea397..c063db8cf1 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6-export.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6-export.xml @@ -15,6 +15,7 @@ /usr/bin/qemu +
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6.args index a28d015e61..0331ff5b5f 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6.args @@ -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 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6.xml index 3c5c99df7e..540aa02410 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6.xml @@ -15,6 +15,7 @@ /usr/bin/qemu +
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-unix.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-unix.args index 977b68faba..84cae4a129 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-unix.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-unix.args @@ -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 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-unix.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-unix.xml index 46114d53cc..a4126f5bd4 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-unix.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-unix.xml @@ -15,6 +15,7 @@ /usr/bin/qemu +
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd.args index 856217b092..8d0f69f9d8 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd.args @@ -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 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd.xml index e31da875c7..36301a96c5 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd.xml @@ -15,6 +15,7 @@ /usr/bin/qemu +
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth.args index 4f3ccd52f1..6714553061 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth.args @@ -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=:\ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-ipv6.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-ipv6.args index 0c67229bbc..66231612ea 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-ipv6.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-ipv6.args @@ -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\;\ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-ipv6.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-ipv6.xml index a2ca2d2f0d..be4edbf753 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-ipv6.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-ipv6.xml @@ -15,6 +15,7 @@ /usr/bin/qemu +
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.args index ad3ed3eee6..cf433a3a1a 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.args @@ -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,\ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.xml index 8309cae648..081f9a6ce4 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.xml @@ -15,6 +15,7 @@ /usr/bin/qemu +
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-sheepdog.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-sheepdog.args index 3e9d913621..e0a5cfaede 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-sheepdog.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-sheepdog.args @@ -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 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-sheepdog.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-sheepdog.xml index 7917357eea..ac89dd7f89 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-sheepdog.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-sheepdog.xml @@ -15,6 +15,7 @@ /usr/bin/qemu +