提交 b2e54a33 编写于 作者: P Peter Krempa

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: NPeter Krempa <pkrempa@redhat.com>
上级 ca2943ad
...@@ -9400,7 +9400,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, ...@@ -9400,7 +9400,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
physical_block_size); physical_block_size);
goto error; goto error;
} }
} else if (!def->src->driverName && } else if (!virDomainDiskGetDriver(def) &&
virXMLNodeNameEqual(cur, "driver")) { virXMLNodeNameEqual(cur, "driver")) {
if (virDomainVirtioOptionsParseXML(cur, &def->virtio) < 0) if (virDomainVirtioOptionsParseXML(cur, &def->virtio) < 0)
goto error; goto error;
...@@ -23101,7 +23101,7 @@ virDomainDiskDefFormat(virBufferPtr buf, ...@@ -23101,7 +23101,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
virBufferAddLit(buf, ">\n"); virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
virBufferEscapeString(&driverBuf, " name='%s'", def->src->driverName); virBufferEscapeString(&driverBuf, " name='%s'", virDomainDiskGetDriver(def));
if (def->src->format > 0) if (def->src->format > 0)
virBufferAsprintf(&driverBuf, " type='%s'", virBufferAsprintf(&driverBuf, " type='%s'",
virStorageFileFormatTypeToString(def->src->format)); virStorageFileFormatTypeToString(def->src->format));
......
...@@ -783,7 +783,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt, ...@@ -783,7 +783,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
def->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY; def->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
} }
} else if (STREQ(keywords[i], "format")) { } else if (STREQ(keywords[i], "format")) {
if (VIR_STRDUP(def->src->driverName, "qemu") < 0) if (virDomainDiskSetDriver(def, "qemu") < 0)
goto error; goto error;
def->src->format = virStorageFileFormatTypeFromString(values[i]); def->src->format = virStorageFileFormatTypeFromString(values[i]);
} else if (STREQ(keywords[i], "cache")) { } else if (STREQ(keywords[i], "cache")) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册