From: A.Burluka <aburluka(a)parallels.com>
Openstack Nova (starting at
icehouse release) requires this function to start VM. Because the
information is taken from host capabilities xml, I've expanded it
and add cpu section in it.
---
src/parallels/parallels_driver.c | 34 ++++++++++++++++++++++++++++++++--
1 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index f1d5ecc..3aa73f0 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -51,6 +51,7 @@
#include "nodeinfo.h"
#include "c-ctype.h"
#include "virstring.h"
+#include "cpu/cpu.h"
#include "parallels_driver.h"
#include "parallels_utils.h"
@@ -117,7 +118,9 @@ parallelsDomObjFreePrivate(void *p)
static virCapsPtr
parallelsBuildCapabilities(void)
{
- virCapsPtr caps;
+ virCapsPtr caps = NULL;
+ virCPUDefPtr cpu = NULL;
+ virCPUDataPtr data = NULL;
virCapsGuestPtr guest;
if ((caps = virCapabilitiesNew(virArchFromHost(),
@@ -147,11 +150,25 @@ parallelsBuildCapabilities(void)
"parallels", NULL, NULL, 0, NULL) ==
NULL)
goto error;
+ if (VIR_ALLOC(cpu) < 0)
+ goto error;
+
+ cpu->arch = caps->host.arch;
+ cpu->type = VIR_CPU_TYPE_HOST;
+ caps->host.cpu = cpu;
+
+ if (!(data = cpuNodeData(cpu->arch))
+ || cpuDecode(cpu, data, NULL, 0, NULL) < 0) {
+ goto error;
+ }
+
+ cleanup:
+ cpuDataFree(data);
return caps;
error:
virObjectUnref(caps);
- return NULL;
+ goto cleanup;
}
static char *
@@ -2312,6 +2329,18 @@ static int parallelsConnectIsAlive(virConnectPtr conn
ATTRIBUTE_UNUSED)
}
+static char *
+parallelsConnectBaselineCPU(virConnectPtr conn ATTRIBUTE_UNUSED,
+ const char **xmlCPUs,
+ unsigned int ncpus,
+ unsigned int flags)
+{
+ virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, NULL);
+
+ return cpuBaselineXML(xmlCPUs, ncpus, NULL, 0, flags);
+}
+
+
static int
parallelsNodeGetCpuMask(parallelsDomObjPtr privatedomdata,
virBitmapPtr *cpumask,
@@ -2471,6 +2500,7 @@ static virDriver parallelsDriver = {
.connectGetHostname = parallelsConnectGetHostname, /* 0.10.0 */
.nodeGetInfo = parallelsNodeGetInfo, /* 0.10.0 */
.connectGetCapabilities = parallelsConnectGetCapabilities, /* 0.10.0 */
+ .connectBaselineCPU = parallelsConnectBaselineCPU, /* 1.2.6 */
.connectListDomains = parallelsConnectListDomains, /* 0.10.0 */
.connectNumOfDomains = parallelsConnectNumOfDomains, /* 0.10.0 */
.connectListDefinedDomains = parallelsConnectListDefinedDomains, /* 0.10.0 */
--
1.7.1