# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1210005853 25200
# Node ID 2ec4259b46e7b0eeb275edbd8eb2d6051318b417
# Parent 51420bb16e9a4e1ff1a125aa4333a6d29e6f8234
Handle LXC disk XML generation
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 51420bb16e9a -r 2ec4259b46e7 libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Mon May 05 09:44:13 2008 -0700
+++ b/libxkutil/xmlgen.c Mon May 05 09:44:13 2008 -0700
@@ -149,6 +149,24 @@ static char *disk_file_xml(const char *p
return xml;
}
+static char *disk_fs_xml(const char *path, const char *vdev)
+{
+ char *xml;
+ int ret;
+
+ ret = asprintf(&xml,
+ "<filesystem type='mount'>\n"
+ " <source dir='%s'/>\n"
+ " <target dir='%s'/>\n"
+ "</filesystem>\n",
+ path,
+ vdev);
+ if (ret == -1)
+ xml = NULL;
+
+ return xml;
+}
+
static bool disk_to_xml(char **xml, struct virt_device *dev)
{
char *_xml = NULL;
@@ -160,6 +178,8 @@ static bool disk_to_xml(char **xml, stru
/* If it's not a block device, we assume a file,
which should be a reasonable fail-safe */
_xml = disk_file_xml(disk->source, disk->virtual_dev);
+ else if (disk->disk_type == DISK_FS)
+ _xml = disk_fs_xml(disk->source, disk->virtual_dev);
else
return false;