[PATCH 37/66] vbox: Rewrite vboxDomainGetVcpusFlags

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

 



---
 src/vbox/vbox_common.c        |   28 ++++++++++++++++++++++++++++
 src/vbox/vbox_tmpl.c          |   29 -----------------------------
 src/vbox/vbox_uniformed_api.h |    1 +
 3 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 1df946d..120ad6c 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -2826,3 +2826,31 @@ int vboxDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
 {
     return vboxDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_AFFECT_LIVE);
 }
+
+int vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
+{
+    VBOX_OBJECT_CHECK(dom->conn, int, -1);
+    ISystemProperties *systemProperties = NULL;
+    PRUint32 maxCPUCount = 0;
+
+    if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
+        virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
+        return -1;
+    }
+
+    /* Currently every domain supports the same number of max cpus
+     * as that supported by vbox and thus take it directly from
+     * the systemproperties.
+     */
+
+    gVBoxAPI.UIVirtualBox.GetSystemProperties(data->vboxObj, &systemProperties);
+    if (systemProperties) {
+        gVBoxAPI.UISystemProperties.GetMaxGuestCPUCount(systemProperties, &maxCPUCount);
+        VBOX_RELEASE(systemProperties);
+    }
+
+    if (maxCPUCount > 0)
+        ret = maxCPUCount;
+
+    return ret;
+}
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index db16092..50e4653 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -955,35 +955,6 @@ static virDomainState _vboxConvertState(PRUint32 state)
 }
 
 static int
-vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
-{
-    VBOX_OBJECT_CHECK(dom->conn, int, -1);
-    ISystemProperties *systemProperties = NULL;
-    PRUint32 maxCPUCount = 0;
-
-    if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
-        virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
-        return -1;
-    }
-
-    /* Currently every domain supports the same number of max cpus
-     * as that supported by vbox and thus take it directly from
-     * the systemproperties.
-     */
-
-    data->vboxObj->vtbl->GetSystemProperties(data->vboxObj, &systemProperties);
-    if (systemProperties) {
-        systemProperties->vtbl->GetMaxGuestCPUCount(systemProperties, &maxCPUCount);
-        VBOX_RELEASE(systemProperties);
-    }
-
-    if (maxCPUCount > 0)
-        ret = maxCPUCount;
-
-    return ret;
-}
-
-static int
 vboxDomainGetMaxVcpus(virDomainPtr dom)
 {
     return vboxDomainGetVcpusFlags(dom, (VIR_DOMAIN_AFFECT_LIVE |
diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h
index cb04501..5bab8fa 100644
--- a/src/vbox/vbox_uniformed_api.h
+++ b/src/vbox/vbox_uniformed_api.h
@@ -441,6 +441,7 @@ int vboxDomainGetState(virDomainPtr dom, int *state,
 int vboxDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
                             unsigned int flags);
 int vboxDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus);
+int vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags);
 
 /* Version specified functions for installing uniformed API */
 void vbox22InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
-- 
1.7.9.5

--
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]