[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 1/4] parallels: add support of containers to the driver



This patch makes parallelsLoadDomains to be able to load information
about containers. So functions, which return different information
and change state will work.

parallelsDomainDefineXML will be fixed in separate patch.

Signed-off-by: Dmitry Guryanov <dguryanov parallels com>
---
 src/parallels/parallels_driver.c |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 06a75b3..45a3d82 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -130,6 +130,15 @@ parallelsBuildCapabilities(void)
                                       "parallels", NULL, NULL, 0, NULL) == NULL)
         goto no_memory;
 
+    if ((guest = virCapabilitiesAddGuest(caps, "exe", PARALLELS_DEFAULT_ARCH,
+                                         64, "parallels",
+                                         NULL, 0, NULL)) == NULL)
+        goto no_memory;
+
+    if (virCapabilitiesAddGuestDomain(guest,
+                                      "parallels", NULL, NULL, 0, NULL) == NULL)
+        goto no_memory;
+
     caps->defaultConsoleTargetType = parallelsDefaultConsoleType;
     return caps;
 
@@ -490,8 +499,20 @@ parallelsLoadDomain(parallelsConnPtr privconn, virJSONValuePtr jobj)
     def->mem.max_balloon <<= 10;
     def->mem.cur_balloon = def->mem.max_balloon;
 
-    if (!(def->os.type = strdup("hvm")))
-        goto no_memory;
+    if (!(tmp = virJSONValueObjectGetString(jobj, "Type"))) {
+        parallelsParseError();
+        goto cleanup;
+    }
+
+    if (STREQ(tmp, "CT")) {
+        if (!(def->os.type = strdup("exe")))
+            goto no_memory;
+        if (!(def->os.init = strdup("/sbin/init")))
+            goto no_memory;
+    } else if (STREQ(tmp, "VM")) {
+        if (!(def->os.type = strdup("hvm")))
+            goto no_memory;
+    }
 
     if (!(def->os.arch = strdup(PARALLELS_DEFAULT_ARCH)))
         goto no_memory;
@@ -577,7 +598,7 @@ parallelsLoadDomains(parallelsConnPtr privconn, const char *domain_name)
     int ret = -1;
 
     jobj = parallelsParseOutput(PRLCTL, "list", "-j", "-a", "-i", "-H",
-                                "--vmtype", "vm", domain_name, NULL);
+                                "--vmtype", "all", domain_name, NULL);
     if (!jobj) {
         parallelsParseError();
         goto cleanup;
-- 
1.7.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]