Re: [PATCH 1/4] parallels: set cpu mode when applying xml configuration

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

 



On 13.03.2015 16:40, Maxim Nestratov wrote:
> From: Mikhail Feoktistov <mfeoktistov@xxxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxxx>
> Signed-off-by: Maxim Nestratov <mnestratov@xxxxxxxxxxxxx>
> ---
>  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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]