openvz: Ditch openvzGetNodeCPUs
There is particular function for this, there is no need to build whole nodeinfo for it. Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
3c2b3a6f31
commit
9fff1fa334
@ -51,6 +51,7 @@
|
|||||||
#include "virfile.h"
|
#include "virfile.h"
|
||||||
#include "vircommand.h"
|
#include "vircommand.h"
|
||||||
#include "virstring.h"
|
#include "virstring.h"
|
||||||
|
#include "virhostcpu.h"
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_OPENVZ
|
#define VIR_FROM_THIS VIR_FROM_OPENVZ
|
||||||
|
|
||||||
@ -570,7 +571,7 @@ int openvzLoadDomains(struct openvz_driver *driver)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret == 0 || vcpus == 0)
|
if (ret == 0 || vcpus == 0)
|
||||||
vcpus = openvzGetNodeCPUs();
|
vcpus = virHostCPUGetCount();
|
||||||
|
|
||||||
if (virDomainDefSetVcpusMax(def, vcpus, driver->xmlopt) < 0)
|
if (virDomainDefSetVcpusMax(def, vcpus, driver->xmlopt) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -628,17 +629,6 @@ int openvzLoadDomains(struct openvz_driver *driver)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
|
||||||
openvzGetNodeCPUs(void)
|
|
||||||
{
|
|
||||||
virNodeInfo nodeinfo;
|
|
||||||
|
|
||||||
if (nodeGetInfo(&nodeinfo) < 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return nodeinfo.cpus;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
openvzWriteConfigParam(const char * conf_file, const char *param, const char *value)
|
openvzWriteConfigParam(const char * conf_file, const char *param, const char *value)
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,6 @@ int openvzLoadDomains(struct openvz_driver *driver);
|
|||||||
void openvzFreeDriver(struct openvz_driver *driver);
|
void openvzFreeDriver(struct openvz_driver *driver);
|
||||||
int strtoI(const char *str);
|
int strtoI(const char *str);
|
||||||
int openvzSetDefinedUUID(int vpsid, unsigned char *uuid);
|
int openvzSetDefinedUUID(int vpsid, unsigned char *uuid);
|
||||||
unsigned int openvzGetNodeCPUs(void);
|
|
||||||
int openvzGetVEID(const char *name);
|
int openvzGetVEID(const char *name);
|
||||||
int openvzReadNetworkConf(virDomainDefPtr def, int veid);
|
int openvzReadNetworkConf(virDomainDefPtr def, int veid);
|
||||||
|
|
||||||
|
@ -1362,7 +1362,7 @@ static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
|
|||||||
const char *prog[] = { VZCTL, "--quiet", "set", PROGRAM_SENTINEL,
|
const char *prog[] = { VZCTL, "--quiet", "set", PROGRAM_SENTINEL,
|
||||||
"--cpus", str_vcpus, "--save", NULL };
|
"--cpus", str_vcpus, "--save", NULL };
|
||||||
unsigned int pcpus;
|
unsigned int pcpus;
|
||||||
pcpus = openvzGetNodeCPUs();
|
pcpus = virHostCPUGetCount();
|
||||||
if (pcpus > 0 && pcpus < nvcpus)
|
if (pcpus > 0 && pcpus < nvcpus)
|
||||||
nvcpus = pcpus;
|
nvcpus = pcpus;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user