]> xenbits.xensource.com Git - libvirt.git/commitdiff
virCaps: get rid of defaultDiskDriverType
authorPeter Krempa <pkrempa@redhat.com>
Wed, 13 Mar 2013 14:28:11 +0000 (15:28 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 4 Apr 2013 20:42:38 +0000 (22:42 +0200)
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.

21 files changed:
src/conf/capabilities.h
src/conf/domain_conf.c
src/qemu/qemu_conf.c
src/qemu/qemu_domain.c
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-export.args
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-export.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6-export.args
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6-export.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6.args
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-ipv6.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-unix.args
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd-unix.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd.args
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-nbd.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth.args
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-ipv6.args
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-ipv6.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.args
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd.xml
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-sheepdog.args
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-sheepdog.xml

index 5e7a5f6a779ffd5bb3d9dfdd80efc0f9bbc85268..743b1f03b38e763b49f51ed2cb85dac5893cc3a5 100644 (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;
 };
index 062469635a27844d64ddc1b9cb1ae348e74c23cc..ec2cf23289305a7f5437120e7c7a12463031a124 100644 (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
index 268223f75d79ffafabe392c0081b67685b55f3c5..084b69441e08cee8cc2b8df1de18d9e477bcc918 100644 (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"));
index 30732578a67cfa01df3a957df26be408c34effe8..e5e9223d15abb53cd0830530206066c0cdc770f7 100644 (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;
+            }
         }
     }
 
index bc9d93dc539b137cdfd7615d0e73dd071cb34706..ca70ce4fc4abbb36b99b2a41eab79d0ade3147dc 100644 (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
index f2b5ca46fd6978627f5361a141ca478830271cac..7a84604a444d145a5af1981e3961f1f59aebe44f 100644 (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'/>
index 15410735528f92d331887f0db0c1bff082160783..745efe7223f55823ee94b88fe5625671633beb9a 100644 (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
index 595d7ea397a7f28c80a0c0a716b80aec950c067e..c063db8cf159a0ff797e20043bd7ab11802eefde 100644 (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'/>
index a28d015e61c2743da3a5292fc19487eb621467df..0331ff5b5fe1f6b3bb85b60f0fb3d942e0421ed5 100644 (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
index 3c5c99df7e81c24cc52b2a0ee0eea3398f8133f3..540aa024101a927c9a5464a3136d4d3f7233cd98 100644 (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'/>
index 977b68faba146a3bf44c34c396bd974a1d8b4d58..84cae4a1293ef0243eb4c6f39f9dd634835a3b5f 100644 (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
index 46114d53cc9d0f284d036015ab2f851910ad8ffd..a4126f5bd4823ef62a71f085089f1768a5aeb9fc 100644 (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'/>
index 856217b09235a83b2deed593a3a3a2f4657aaae8..8d0f69f9d8b4e585764939df37b739cc0afaf0a7 100644 (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
index e31da875c7fd7fb9c23c20ade2f8d29e80d5747f..36301a96c51cf885c568ae6799f2371edd548778 100644 (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'/>
index 4f3ccd52f15d4ed0dab450e6b4b122119f7134ff..6714553061e7f611013bd3c268c9b2cc8f81a4de 100644 (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=:\
index 0c67229bbcdbcc827c286c5ca32c490a23dbac08..66231612ea0ad8dff92b7ea2fda8af833c3a5fef 100644 (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\;\
index a2ca2d2f0dc278f468c962190330d41905afe9cc..be4edbf753919bd775b96377840d8a508e6f12d0 100644 (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'/>
index ad3ed3eee6fb30861c1a2380fc036c3440a88ab4..cf433a3a1a1538d8408bb4b8d8eb0da8ab70c82f 100644 (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,\
index 8309cae648d1145a4799c231a2c906f41f5fdfed..081f9a6ce4add36ea09b2102c732d034db05d0b2 100644 (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'/>
index 3e9d91362167c1781eb2cb735c42dda308d57648..e0a5cfaede25d9224c415faf5d2906d1b9f172e2 100644 (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
index 7917357eea56b6ddde390b2dd3200394b6fa47cc..ac89dd7f896ddf5f733b6369b33c90a03ec33c3a 100644 (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'/>