diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 02ca509..8e2a7b6 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -344,7 +344,7 @@
disk
disk
element is the main container for describing
- disks. The type
attribute is either "file" or "block"
+ disks. The type
attribute is either "file", "block" or "pool"
and refers to the underlying source for the disk. The optional
device
attribute indicates how the disk is to be exposed
to the guest OS. Possible values for this attribute are "floppy", "disk"
@@ -354,7 +354,11 @@
type
is "file", then the file
attribute
specifies the fully-qualified path to the file holding the disk. If the disk
type
is "block", then the dev
attribute specifies
- the path to the host device to serve as the disk. Since 0.0.3type
+ is "pool", then the pool
and volume
specify the
+ virtual location of the disk, the path is automatically resolved if the pool
+ and the volume exist.
+ Since 0.0.3target
target
element controls the bus / device under which the
disk is exposed to the guest OS. The dev
attribute indicates
diff --git a/src/xml.c b/src/xml.c
index 22dc211..9fd093e 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -1300,6 +1300,8 @@ virDomainParseXMLDiskDesc(virConnectPtr conn, xmlNodePtr node,
typ = 0;
else if (xmlStrEqual(type, BAD_CAST "block"))
typ = 1;
+ else if (xmlStrEqual(type, BAD_CAST "pool"))
+ typ = 2;
xmlFree(type);
}
device = xmlGetProp(node, BAD_CAST "device");
@@ -1309,11 +1311,24 @@ virDomainParseXMLDiskDesc(virConnectPtr conn, xmlNodePtr node,
if (cur->type == XML_ELEMENT_NODE) {
if ((source == NULL) &&
(xmlStrEqual(cur->name, BAD_CAST "source"))) {
-
if (typ == 0)
source = xmlGetProp(cur, BAD_CAST "file");
- else
+ else if (typ == 1)
source = xmlGetProp(cur, BAD_CAST "dev");
+ else if (typ == 2) {
+ xmlChar *pool = xmlGetProp(cur, BAD_CAST "pool");
+ xmlChar *volume = xmlGetProp(cur, BAD_CAST "volume");
+ if (pool != NULL && volume != NULL) {
+ virStoragePoolPtr virPool;
+ virPool = virStoragePoolLookupByName(conn, (const char *) pool);
+ if (virPool != NULL) {
+ virStorageVolPtr virVol;
+ virVol = virStorageVolLookupByName(virPool, (const char *) volume);
+ if (virVol != NULL)
+ source = BAD_CAST virStorageVolGetPath(virVol);
+ }
+ }
+ }
} else if ((target == NULL) &&
(xmlStrEqual(cur->name, BAD_CAST "target"))) {
target = xmlGetProp(cur, BAD_CAST "dev");
@@ -1411,7 +1426,8 @@ virDomainParseXMLDiskDesc(virConnectPtr conn, xmlNodePtr node,
virBufferVSprintf(buf, "(uname 'phy:%s')", source);
else
virBufferVSprintf(buf, "(uname 'phy:/dev/%s')", source);
- }
+ } else if (typ == 2)
+ virBufferVSprintf(buf, "(uname 'phy:%s')", source);
}
if (ro == 1)
virBufferAddLit(buf, "(mode 'r')");