aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Guryanov <dguryanov@parallels.com>2012-09-12 16:40:54 +0400
committerDaniel Veillard <veillard@redhat.com>2012-09-13 21:19:58 +0800
commita62116de3259b3826a53fd146fdd89f792bd69c0 (patch)
tree5a6a2d6fc2b681c0bc7135cb892cc092158c0927 /src/parallels
parentparallels: fix parallelsDomainDefineXML for existing containers (diff)
downloadlibvirt-a62116de3259b3826a53fd146fdd89f792bd69c0.tar.gz
libvirt-a62116de3259b3826a53fd146fdd89f792bd69c0.tar.bz2
libvirt-a62116de3259b3826a53fd146fdd89f792bd69c0.zip
parallels: implement containers creation
Add separate function parallelsCreateCt, which creates container. Also add example xml configuration domain-parallels-ct-simple.xml. Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
Diffstat (limited to 'src/parallels')
-rw-r--r--src/parallels/parallels_driver.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 3bfd3f2e0..52b12b597 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -1663,6 +1663,36 @@ parallelsCreateVm(virConnectPtr conn, virDomainDefPtr def)
return -1;
}
+static int
+parallelsCreateCt(virConnectPtr conn ATTRIBUTE_UNUSED, virDomainDefPtr def)
+{
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+ virUUIDFormat(def->uuid, uuidstr);
+
+ if (def->nfss != 1 ||
+ def->fss[0]->type != VIR_DOMAIN_FS_TYPE_TEMPLATE) {
+
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("There must be only 1 template FS for "
+ "container creation"));
+ goto error;
+ }
+
+ if (parallelsCmdRun(PRLCTL, "create", def->name, "--vmtype", "ct",
+ "--uuid", uuidstr,
+ "--ostemplate", def->fss[0]->src, NULL) < 0)
+ goto error;
+
+ if (parallelsCmdRun(PRLCTL, "set", def->name, "--vnc-mode", "auto", NULL) < 0)
+ goto error;
+
+ return 0;
+
+error:
+ return -1;
+}
+
static virDomainPtr
parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
{
@@ -1703,8 +1733,17 @@ parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
def = NULL;
} else {
- if (parallelsCreateVm(conn, def))
+ if (STREQ(def->os.type, "hvm")) {
+ if (parallelsCreateVm(conn, def))
+ goto cleanup;
+ } else if (STREQ(def->os.type, "exe")) {
+ if (parallelsCreateCt(conn, def))
+ goto cleanup;
+ } else {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Unsupported OS type: %s"), def->os.type);
goto cleanup;
+ }
if (parallelsLoadDomains(privconn, def->name))
goto cleanup;
dom = virDomainFindByName(&privconn->domains, def->name);