From 0d76794366f912114db70f82fa23a5c0b1a9540b Mon Sep 17 00:00:00 2001 From: Maxim Nestratov Date: Tue, 26 May 2015 20:12:00 +0300 Subject: [PATCH] parallels: set virtType depending on driver name We remember driver name in a new field 'drivername' within private parallels connection structure. When a new domain is defined we use this name to set corresponding virtType. We set VIR_DOMAIN_VIRT_VZ for 'vz' driver and VIR_DOMAIN_VIRT_PARALLELS for 'Parallels'. Signed-off-by: Maxim Nestratov --- src/parallels/parallels_driver.c | 2 ++ src/parallels/parallels_sdk.c | 6 +++++- src/parallels/parallels_utils.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 44b4de86b0..e3ac90d3a1 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -241,6 +241,8 @@ parallelsOpenDefault(virConnectPtr conn) goto err_free; } + privconn->drivername = conn->driver->name; + if (prlsdkInit()) { VIR_DEBUG("%s", _("Can't initialize Parallels SDK")); goto err_free; diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index 39c200a474..05f11b0d42 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -1256,7 +1256,11 @@ prlsdkLoadDomain(parallelsConnPtr privconn, pdom = olddom->privateData; } - def->virtType = VIR_DOMAIN_VIRT_PARALLELS; + if (STREQ(privconn->drivername, "vz")) + def->virtType = VIR_DOMAIN_VIRT_VZ; + else + def->virtType = VIR_DOMAIN_VIRT_PARALLELS; + def->id = -1; /* we will remove this field in the near future, so let's set it diff --git a/src/parallels/parallels_utils.h b/src/parallels/parallels_utils.h index 2d1d40528a..e8a92bb024 100644 --- a/src/parallels/parallels_utils.h +++ b/src/parallels/parallels_utils.h @@ -68,6 +68,7 @@ struct _parallelsConn { virDomainXMLOptionPtr xmlopt; virObjectEventStatePtr domainEventState; virStorageDriverStatePtr storageState; + const char *drivername; }; typedef struct _parallelsConn parallelsConn;