From b2e54a3377d07c5fd27163def7c501887535c5e5 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 10 Apr 2018 16:51:47 +0200 Subject: [PATCH] conf, qemu: Replace access to disk driver name with accessors 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 --- 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 83b3750b0d..4c1199ca37 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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)); 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")) {