[libvirt] [PATCH 3/6] conf, qemu: Replace access to disk driver name with accessors

Peter Krempa posted 6 patches 7 years ago
[libvirt] [PATCH 3/6] conf, qemu: Replace access to disk driver name with accessors
Posted by Peter Krempa 7 years ago
Replace direct usage of disk->src->driverName with the existing
accessors. The parser code where we assign the driver form XML is
intentionally not fixed to save an allocation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/conf/domain_conf.c        | 4 ++--
 src/qemu/qemu_parse_command.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0dc1c3a276..987f65df23 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9395,7 +9395,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;
@@ -23100,7 +23100,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));
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
index 5f27d296b3..0ce963222f 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -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")) {
-- 
2.16.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/6] conf, qemu: Replace access to disk driver name with accessors
Posted by Ján Tomko 7 years ago
You really make me question the usefulness of commit msg prefixes

On Wed, Apr 18, 2018 at 12:55:40PM +0200, Peter Krempa wrote:
>Replace direct usage of disk->src->driverName with the existing
>accessors. The parser code where we assign the driver form XML is

s/form/from/

>intentionally not fixed to save an allocation.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/conf/domain_conf.c        | 4 ++--
> src/qemu/qemu_parse_command.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list