---
src/vbox/vbox_common.c | 35 +++++++++++++++++++++++++++++++++++
src/vbox/vbox_tmpl.c | 36 ------------------------------------
src/vbox/vbox_uniformed_api.h | 1 +
3 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 8eedd4d..4acf0c8 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -514,3 +514,38 @@ int vboxConnectListDomains(virConnectPtr conn, int *ids, int nids)
gVBoxAPI.UArray.vboxArrayRelease(&machines);
return ret;
}
+
+int vboxConnectNumOfDomains(virConnectPtr conn)
+{
+ VBOX_OBJECT_CHECK(conn, int, -1);
+ vboxArray machines = VBOX_ARRAY_INITIALIZER;
+ PRUint32 state;
+ nsresult rc;
+ size_t i;
+
+ rc = gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj,
ARRAY_GET_MACHINES);
+ if (NS_FAILED(rc)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not get number of Domains, rc=%08x"),
(unsigned)rc);
+ goto cleanup;
+ }
+
+ ret = 0;
+ for (i = 0; i < machines.count; ++i) {
+ IMachine *machine = machines.items[i];
+
+ if (machine) {
+ PRBool isAccessible = PR_FALSE;
+ gVBoxAPI.UIMachine.GetAccessible(machine, &isAccessible);
+ if (isAccessible) {
+ gVBoxAPI.UIMachine.GetState(machine, &state);
+ if (gVBoxAPI.machineStateChecker.Online(state))
+ ret++;
+ }
+ }
+ }
+
+ cleanup:
+ gVBoxAPI.UArray.vboxArrayRelease(&machines);
+ return ret;
+}
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 1138566..ffd523f 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -917,42 +917,6 @@ vboxSocketParseAddrUtf16(vboxGlobalData *data, const PRUnichar
*utf16,
return result;
}
-static int vboxConnectNumOfDomains(virConnectPtr conn)
-{
- VBOX_OBJECT_CHECK(conn, int, -1);
- vboxArray machines = VBOX_ARRAY_INITIALIZER;
- PRUint32 state;
- nsresult rc;
- size_t i;
-
- rc = vboxArrayGet(&machines, data->vboxObj,
data->vboxObj->vtbl->GetMachines);
- if (NS_FAILED(rc)) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Could not get number of Domains, rc=%08x"),
(unsigned)rc);
- goto cleanup;
- }
-
- ret = 0;
- for (i = 0; i < machines.count; ++i) {
- IMachine *machine = machines.items[i];
-
- if (machine) {
- PRBool isAccessible = PR_FALSE;
- machine->vtbl->GetAccessible(machine, &isAccessible);
- if (isAccessible) {
- machine->vtbl->GetState(machine, &state);
- if ((state >= MachineState_FirstOnline) &&
- (state <= MachineState_LastOnline))
- ret++;
- }
- }
- }
-
- cleanup:
- vboxArrayRelease(&machines);
- return ret;
-}
-
static virDomainPtr vboxDomainCreateXML(virConnectPtr conn, const char *xml,
unsigned int flags)
{
diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h
index 1035ce8..78dd1e7 100644
--- a/src/vbox/vbox_uniformed_api.h
+++ b/src/vbox/vbox_uniformed_api.h
@@ -253,6 +253,7 @@ int vboxConnectIsAlive(virConnectPtr conn);
int vboxConnectGetMaxVcpus(virConnectPtr conn, const char *type);
char *vboxConnectGetCapabilities(virConnectPtr conn);
int vboxConnectListDomains(virConnectPtr conn, int *ids, int nids);
+int vboxConnectNumOfDomains(virConnectPtr conn);
/* Version specified functions for installing uniformed API */
void vbox22InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
--
1.7.9.5