Maxim Nestratov (3):
parallels: don't forget to unlock domain if unregister fails
parallels: fix home directory for VMs
parallels: minor cleanup
Mikhail Feoktistov (1):
parallels: set cpu mode when applying xml configuration
Show replies by date
From: Mikhail Feoktistov <mfeoktistov(a)parallels.com>
Otherwise exporting existing domain config and defining a new one like this:
virsh -c parallels:///system dumpxml instance01 > my.xml
virsh -c parallels:///system define my.xml
leads to an error because PCS default x64 mode turns to x32.
Thus, we need to set correct cpuMode in prlsdkDoApplyConfig() explicitly.
Signed-off-by: Mikhail Feoktistov <mfeoktistov(a)parallels.com>
Signed-off-by: Maxim Nestratov <mnestratov(a)parallels.com>
---
src/parallels/parallels_sdk.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c
index fec145d..9a2d658 100644
--- a/src/parallels/parallels_sdk.c
+++ b/src/parallels/parallels_sdk.c
@@ -2869,6 +2869,19 @@ prlsdkDoApplyConfig(PRL_HANDLE sdkdom,
pret = PrlVmCfg_SetCpuCount(sdkdom, def->vcpus);
prlsdkCheckRetGoto(pret, error);
+ switch (def->os.arch) {
+ case VIR_ARCH_X86_64:
+ pret = PrlVmCfg_SetCpuMode(sdkdom, PCM_CPU_MODE_64);
+ break;
+ case VIR_ARCH_I686:
+ pret = PrlVmCfg_SetCpuMode(sdkdom, PCM_CPU_MODE_32);
+ break;
+ default:
+ virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown CPU mode: %X"),
def->os.arch);
+ goto error;
+ }
+ prlsdkCheckRetGoto(pret, error);
+
if (prlsdkClearDevices(sdkdom) < 0)
goto error;
--
1.7.1
Signed-off-by: Maxim Nestratov <mnestratov(a)parallels.com>
---
src/parallels/parallels_driver.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 650b790..623b122 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -943,6 +943,7 @@ parallelsDomainUndefineFlags(virDomainPtr domain,
{
parallelsConnPtr privconn = domain->conn->privateData;
virDomainObjPtr dom = NULL;
+ int ret;
virCheckFlags(0, -1);
@@ -952,7 +953,11 @@ parallelsDomainUndefineFlags(virDomainPtr domain,
return -1;
}
- return prlsdkUnregisterDomain(privconn, dom);
+ ret = prlsdkUnregisterDomain(privconn, dom);
+ if (ret)
+ virObjectUnlock(dom);
+
+ return ret;
}
static int
--
1.7.1
Failures of parallelsStorageOpen occured because we incorrectly treated
path to VM' configuration file as a directory. Now initialization of
parallels VM domains home directory is fixed.
Signed-off-by: Maxim Nestratov <mnestratov(a)parallels.com>
---
src/parallels/parallels_sdk.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c
index 9a2d658..e0c5895 100644
--- a/src/parallels/parallels_sdk.c
+++ b/src/parallels/parallels_sdk.c
@@ -1247,6 +1247,14 @@ prlsdkLoadDomain(parallelsConnPtr privconn,
pret = PrlVmCfg_GetHomePath(sdkdom, pdom->home, &buflen);
prlsdkCheckRetGoto(pret, error);
+ /* For VMs pdom->home is actually /directory/config.pvs */
+ if (!IS_CT(def)) {
+ /* Get rid of /config.pvs in path string */
+ char *s = strrchr(pdom->home, '/');
+ if (s)
+ *s = '\0';
+ }
+
if (olddom) {
/* assign new virDomainDef without any checks */
/* we can't use virDomainObjAssignDef, because it checks
--
1.7.1
indentation is fixed, unnecessary error message removed,
unnecessary job freeing removed
Signed-off-by: Maxim Nestratov <mnestratov(a)parallels.com>
---
src/parallels/parallels_sdk.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c
index e0c5895..0c9837a 100644
--- a/src/parallels/parallels_sdk.c
+++ b/src/parallels/parallels_sdk.c
@@ -702,7 +702,7 @@ prlsdkGetNetInfo(PRL_HANDLE netAdapter, virDomainNetDefPtr net, bool
isCt)
goto cleanup;
pret = PrlVmDevNet_GetHostInterfaceName(netAdapter, net->ifname, &buflen);
- prlsdkCheckRetGoto(pret, cleanup);
+ prlsdkCheckRetGoto(pret, cleanup);
if (isCt && netAdapterIndex == (PRL_UINT32) -1) {
/* venet devices don't have mac address and
@@ -1352,7 +1352,6 @@ prlsdkLoadDomains(parallelsConnPtr privconn)
error:
PrlHandle_Free(result);
- PrlHandle_Free(job);
return -1;
}
@@ -1732,8 +1731,6 @@ prlsdkDomainChangeState(virDomainPtr domain,
pdom = dom->privateData;
pret = chstate(privconn, pdom->sdkdom);
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("Can't change domain state: %d"), pret);
if (PRL_FAILED(pret)) {
virResetLastError();
--
1.7.1