On 13.03.2015 16:40, Maxim Nestratov wrote:
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 4c90a18..b6026fd 100644
--- a/src/parallels/parallels_sdk.c
+++ b/src/parallels/parallels_sdk.c
@@ -2957,6 +2957,19 @@ prlsdkDoApplyConfig(virConnectPtr conn,
prlsdkCheckRetGoto(pret, error);
VIR_FREE(mask);
+ 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);
We can use virArchToString() to report human readable cpu arch.
+ goto error;
+ }
+ prlsdkCheckRetGoto(pret, error);
+
if (prlsdkClearDevices(sdkdom) < 0)
goto error;
ACK with this squashed in:
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c
index ec3372f..3a7efe3 100644
--- a/src/parallels/parallels_sdk.c
+++ b/src/parallels/parallels_sdk.c
@@ -2894,7 +2894,9 @@ prlsdkDoApplyConfig(PRL_HANDLE sdkdom,
pret = PrlVmCfg_SetCpuMode(sdkdom, PCM_CPU_MODE_32);
break;
default:
- virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown CPU mode: %X"),
def->os.arch);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unknown CPU mode: %s"),
+ virArchToString(def->os.arch));
goto error;
}
prlsdkCheckRetGoto(pret, error);
Michal