with an attribute <code>type</code> giving the driver type (such
as qcow2), of the new file created by the external
snapshot of the new file.
+
+ Optionally <code>metadata_cache</code> sub-element can be used
+ with same semantics as the identically named subelement of the
+ domain definition disk's driver.
</dd>
<dt><code>seclabel</code></dt>
</dl>
goto cleanup;
}
+ if (virParseScaledValue("./driver/metadata_cache/max_size", NULL,
+ ctxt,
+ &def->src->metadataCacheMaxSize,
+ 1, ULLONG_MAX, false) < 0)
+ goto cleanup;
+
/* validate that the passed path is absolute */
if (virStorageSourceIsRelative(def->src)) {
virReportError(VIR_ERR_XML_ERROR,
virDomainSnapshotLocationTypeToString(disk->snapshot));
if (disk->src->path || disk->src->format != 0) {
+ g_auto(virBuffer) driverAttrBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) driverChildBuf = VIR_BUFFER_INIT_CHILD(&childBuf);
+
virBufferAsprintf(&attrBuf, " type='%s'", virStorageTypeToString(disk->src->type));
if (disk->src->format > 0)
- virBufferEscapeString(&childBuf, "<driver type='%s'/>\n",
+ virBufferEscapeString(&driverAttrBuf, " type='%s'",
virStorageFileFormatTypeToString(disk->src->format));
+ if (disk->src->metadataCacheMaxSize > 0) {
+ g_auto(virBuffer) metadataCacheChildBuf = VIR_BUFFER_INIT_CHILD(&driverChildBuf);
+
+ virBufferAsprintf(&metadataCacheChildBuf,
+ "<max_size unit='bytes'>%llu</max_size>\n",
+ disk->src->metadataCacheMaxSize);
+
+ virXMLFormatElement(&driverChildBuf, "metadata_cache", NULL, &metadataCacheChildBuf);
+ }
+
+ virXMLFormatElement(&childBuf, "driver", &driverAttrBuf, &driverChildBuf);
+
if (virDomainDiskSourceFormat(&childBuf, disk->src, "source", 0, false, 0,
false, false, xmlopt) < 0)
return -1;
--- /dev/null
+<domainsnapshot>
+ <name>my snap name</name>
+ <description>!@#$%^</description>
+ <creationTime>1386166249</creationTime>
+ <disks>
+ <disk name='hdd' snapshot='external' type='file'>
+ <driver type='qcow2'>
+ <metadata_cache>
+ <max_size unit='bytes'>1234</max_size>
+ </metadata_cache>
+ </driver>
+ <source file='/path/to/new'/>
+ </disk>
+ </disks>
+ <domain>
+ <uuid>9d37b878-a7cc-9f9a-b78f-49b3abad25a8</uuid>
+ </domain>
+</domainsnapshot>