]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf, qemu: Replace access to disk driver name with accessors
authorPeter Krempa <pkrempa@redhat.com>
Tue, 10 Apr 2018 14:51:47 +0000 (16:51 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 18 Apr 2018 14:16:48 +0000 (16:16 +0200)
Replace direct usage of disk->src->driverName with the existing
accessors. The parser code where we assign the driver from XML is
intentionally not fixed to save an allocation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
src/conf/domain_conf.c
src/qemu/qemu_parse_command.c

index 83b3750b0df60e1eee785c97cd17c703a845ab1f..4c1199ca37dab26fe7cf6a14d3d544a7da5040fd 100644 (file)
@@ -9400,7 +9400,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
                                physical_block_size);
                 goto error;
             }
-        } else if (!def->src->driverName &&
+        } else if (!virDomainDiskGetDriver(def) &&
                    virXMLNodeNameEqual(cur, "driver")) {
             if (virDomainVirtioOptionsParseXML(cur, &def->virtio) < 0)
                 goto error;
@@ -23101,7 +23101,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
     virBufferAddLit(buf, ">\n");
     virBufferAdjustIndent(buf, 2);
 
-    virBufferEscapeString(&driverBuf, " name='%s'", def->src->driverName);
+    virBufferEscapeString(&driverBuf, " name='%s'", virDomainDiskGetDriver(def));
     if (def->src->format > 0)
         virBufferAsprintf(&driverBuf, " type='%s'",
                           virStorageFileFormatTypeToString(def->src->format));
index 5f27d296b311ed2a74d120f70f4a466b6aaa8ae4..0ce963222f9cee0dc720c751cd1ef9bd7664394a 100644 (file)
@@ -783,7 +783,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
                 def->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
             }
         } else if (STREQ(keywords[i], "format")) {
-            if (VIR_STRDUP(def->src->driverName, "qemu") < 0)
+            if (virDomainDiskSetDriver(def, "qemu") < 0)
                 goto error;
             def->src->format = virStorageFileFormatTypeFromString(values[i]);
         } else if (STREQ(keywords[i], "cache")) {