<source protocol="rbd" name="image_name2">
<host name="hostname" port="7000"/>
<snapshot name="snapname"/>
+ <config file="/path/to/file"/>
</source>
<target dev="hdc" bus="ide"/>
<auth username='myuser'>
source for storage protocols.
Supported for 'rbd' <span class="since">since 1.2.11 (QEMU only).</span>
</dd>
+ <dt><code>config</code></dt>
+ <dd>
+ The <code>file</code> attribute for the <code>config</code> element
+ provides a fully qualified path to a configuration file to be
+ provided as a parameter to the client of a networked storage
+ protocol. Supported for 'rbd' <span class="since">since 1.2.11
+ (QEMU only).</span>
+ </dd>
</dl>
<p>
<empty/>
</element>
</optional>
+ <optional>
+ <element name="config">
+ <attribute name="file">
+ <ref name="absFilePath"/>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
<empty/>
</element>
</interleave>
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
virDomainDiskDefPtr disk = dev->data.disk;
- /* internal snapshots are currently supported only with rbd: */
+ /* internal snapshots and config files are currently supported
+ * only with rbd: */
if (virStorageSourceGetActualType(disk->src) != VIR_STORAGE_TYPE_NETWORK &&
disk->src->protocol != VIR_STORAGE_NET_PROTOCOL_RBD) {
if (disk->src->snapshot) {
"only with 'rbd' disks"));
return -1;
}
+
+ if (disk->src->configFile) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("<config> element is currently supported "
+ "only with 'rbd' disks"));
+ return -1;
+ }
}
}
/* snapshot currently works only for remote disks */
src->snapshot = virXPathString("string(./snapshot/@name)", ctxt);
+ /* config file currently only works with remote disks */
+ src->configFile = virXPathString("string(./config/@file)", ctxt);
+
if (virDomainStorageHostParse(node, &src->hosts, &src->nhosts) < 0)
goto cleanup;
break;
VIR_FREE(path);
- if (src->nhosts == 0 && !src->snapshot) {
+ if (src->nhosts == 0 && !src->snapshot && !src->configFile) {
virBufferAddLit(buf, "/>\n");
} else {
virBufferAddLit(buf, ">\n");
virBufferEscapeString(buf, "<snapshot name='%s'/>\n",
src->snapshot);
+ virBufferEscapeString(buf, "<config file='%s'/>\n",
+ src->configFile);
+
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</source>\n");
}
}
}
+ if (src->configFile)
+ virBufferEscape(&buf, '\\', ":", ":conf=%s", src->configFile);
+
if (virBufferCheckError(&buf) < 0)
goto cleanup;
VIR_STRDUP(ret->relPath, src->relPath) < 0 ||
VIR_STRDUP(ret->backingStoreRaw, src->backingStoreRaw) < 0 ||
VIR_STRDUP(ret->snapshot, src->snapshot) < 0 ||
+ VIR_STRDUP(ret->configFile, src->configFile) < 0 ||
VIR_STRDUP(ret->compat, src->compat) < 0)
goto error;
}
}
+ if (STRPREFIX(p, "conf=") &&
+ VIR_STRDUP(src->configFile, p + strlen("conf=")) < 0)
+ goto error;
+
p = next;
}
VIR_FREE(options);
int protocol; /* virStorageNetProtocol */
char *volume; /* volume name for remote storage */
char *snapshot; /* for storage systems supporting internal snapshots */
+ char *configFile; /* some storage systems use config file as part of
+ the source definition */
size_t nhosts;
virStorageNetHostDefPtr hosts;
virStorageSourcePoolDefPtr srcpool;
-drive 'file=rbd:pool/image@foo:auth_supported=none:\
mon_host=mon1.example.org\:6321\;mon2.example.org\:6322\;\
mon3.example.org\:6322,if=virtio,format=raw' \
+-drive file=rbd:pool/image@foo:auth_supported=none:\
+conf=/blah/test.conf,if=virtio,format=raw \
-net none -serial none -parallel none
</source>
<target dev='vdc' bus='virtio'/>
</disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='rbd' name='pool/image'>
+ <snapshot name='foo'/>
+ <config file='/blah/test.conf'/>
+ </source>
+ <target dev='vdd' bus='virtio'/>
+ </disk>
<controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='pci' index='0' model='pci-root'/>