]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
openvz: Ditch openvzGetNodeCPUs
authorMartin Kletzander <mkletzan@redhat.com>
Sat, 11 Mar 2017 15:14:17 +0000 (16:14 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Mon, 27 Mar 2017 11:13:29 +0000 (13:13 +0200)
There is particular function for this, there is no need to build whole
nodeinfo for it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
src/openvz/openvz_conf.c
src/openvz/openvz_conf.h
src/openvz/openvz_driver.c

index b02e1aab8b86f3bc74fb3567f1d94b99add3d0e9..e4d7634d2eff45e9341b0449bddc52962523b580 100644 (file)
@@ -51,6 +51,7 @@
 #include "virfile.h"
 #include "vircommand.h"
 #include "virstring.h"
+#include "virhostcpu.h"
 
 #define VIR_FROM_THIS VIR_FROM_OPENVZ
 
@@ -570,7 +571,7 @@ int openvzLoadDomains(struct openvz_driver *driver)
         }
 
         if (ret == 0 || vcpus == 0)
-            vcpus = openvzGetNodeCPUs();
+            vcpus = virHostCPUGetCount();
 
         if (virDomainDefSetVcpusMax(def, vcpus, driver->xmlopt) < 0)
             goto cleanup;
@@ -628,17 +629,6 @@ int openvzLoadDomains(struct openvz_driver *driver)
     return -1;
 }
 
-unsigned int
-openvzGetNodeCPUs(void)
-{
-    virNodeInfo nodeinfo;
-
-    if (nodeGetInfo(&nodeinfo) < 0)
-        return 0;
-
-    return nodeinfo.cpus;
-}
-
 static int
 openvzWriteConfigParam(const char * conf_file, const char *param, const char *value)
 {
index fc36740d26c68cb2e4ef01b1b64c2fad3223febb..be7e16df531d7b2b662dce08879a318abd667227 100644 (file)
@@ -67,7 +67,6 @@ int openvzLoadDomains(struct openvz_driver *driver);
 void openvzFreeDriver(struct openvz_driver *driver);
 int strtoI(const char *str);
 int openvzSetDefinedUUID(int vpsid, unsigned char *uuid);
-unsigned int openvzGetNodeCPUs(void);
 int openvzGetVEID(const char *name);
 int openvzReadNetworkConf(virDomainDefPtr def, int veid);
 
index eaa9ef68c57671678c9f650dd63d20213bc48332..01ad7628455af80de18c6fc62cd02a629a8c7bfc 100644 (file)
@@ -1362,7 +1362,7 @@ static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
     const char *prog[] = { VZCTL, "--quiet", "set", PROGRAM_SENTINEL,
                            "--cpus", str_vcpus, "--save", NULL };
     unsigned int pcpus;
-    pcpus = openvzGetNodeCPUs();
+    pcpus = virHostCPUGetCount();
     if (pcpus > 0 && pcpus < nvcpus)
         nvcpus = pcpus;