On Mon, Jun 02, 2014 at 06:06:39PM +0400, Alexander Burluka wrote:
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.
Small nit-pick - it'd be nice to split this patch in 2. One
patch doing virConnectBaselineCPU impl as $subject describes,
and one patch including CPU info in the capabilities XML.
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;
I think you should also fill in the sockets/cores/threads info
while you're doing this, since openstack is likely to start using
this data too in the near future. eg
virNodeInfo nodeinfo;
...
if (nodeGetInfo(&nodeinfo))
goto error;
...
cpu->sockets = nodeinfo.sockets;
cpu->cores = nodeinfo.cores;
cpu->threads = nodeinfo.threads;
Regards,
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|