[Libvirt-cim] [PATCH] LXC osinfo xml generation bits

Dan Smith danms at us.ibm.com
Fri Apr 25 17:03:13 UTC 2008


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1209142937 25200
# Node ID e1ce6d481719f6d884bcd662294b18136371c300
# Parent  b425f4f1a59fac3b594b7536f00f18f20a4709c2
LXC osinfo xml generation bits

Signed-off-by: Dan Smith <danms at us.ibm.com>

diff -r b425f4f1a59f -r e1ce6d481719 libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c	Fri Apr 25 09:11:59 2008 -0700
+++ b/libxkutil/xmlgen.c	Fri Apr 25 10:02:17 2008 -0700
@@ -533,6 +533,23 @@ static char *_kvm_os_xml(struct domain *
         return xml;
 }
 
+static char *_lxc_os_xml(struct domain *domain)
+{
+        struct lxc_os_info *os = &domain->os_info.lxc;
+        int ret;
+        char *xml = NULL;
+
+        ret = asprintf(&xml,
+                       "<os>\n"
+                       "  <init>%s</init>\n"
+                       "</os>\n",
+                       os->init);
+        if (ret == -1)
+                xml = NULL;
+
+        return xml;
+}
+
 static char *os_xml(struct domain *domain)
 {
         if (domain->type == DOMAIN_XENPV)
@@ -541,6 +558,8 @@ static char *os_xml(struct domain *domai
                 return _xenfv_os_xml(domain);
         else if (domain->type == DOMAIN_KVM)
                 return _kvm_os_xml(domain);
+        else if (domain->type == DOMAIN_LXC)
+                return _lxc_os_xml(domain);
         else
                 return strdup("<!-- unsupported domain type -->\n");
 }
@@ -561,6 +580,8 @@ char *system_to_xml(struct domain *domin
                 domtype = "xen";
         else if (dominfo->type == DOMAIN_KVM)
                 domtype = "kvm";
+        else if (dominfo->type == DOMAIN_LXC)
+                domtype = "lxc";
         else
                 domtype = "unknown";
 




More information about the Libvirt-cim mailing list