From: "Daniel P. Berrange" <berrange(a)redhat.com>
The APIs names for accessing the domain list object are
very inconsistent. Rename them all to have a standard
virDomainObjList prefix.
---
src/conf/domain_conf.c | 156 +++++++++++++++++---------------
src/conf/domain_conf.h | 56 ++++++------
src/libvirt_private.syms | 20 ++---
src/libxl/libxl_conf.h | 2 +-
src/libxl/libxl_driver.c | 172 ++++++++++++++++++-----------------
src/lxc/lxc_conf.h | 2 +-
src/lxc/lxc_driver.c | 144 ++++++++++++++---------------
src/lxc/lxc_process.c | 12 +--
src/openvz/openvz_conf.c | 6 +-
src/openvz/openvz_conf.h | 2 +-
src/openvz/openvz_driver.c | 67 +++++++-------
src/parallels/parallels_driver.c | 52 +++++------
src/parallels/parallels_storage.c | 2 +-
src/parallels/parallels_utils.h | 2 +-
src/qemu/qemu_conf.c | 2 +-
src/qemu/qemu_conf.h | 2 +-
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_driver.c | 184 +++++++++++++++++++-------------------
src/qemu/qemu_migration.c | 8 +-
src/qemu/qemu_process.c | 2 +-
src/test/test_driver.c | 179 ++++++++++++++++++------------------
src/uml/uml_conf.h | 2 +-
src/uml/uml_driver.c | 140 ++++++++++++++---------------
src/vmware/vmware_conf.c | 7 +-
src/vmware/vmware_conf.h | 2 +-
src/vmware/vmware_driver.c | 72 +++++++--------
26 files changed, 665 insertions(+), 632 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index abf2b6b..990e6e4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -776,18 +776,30 @@ virDomainObjListDataFree(void *payload, const void *name
ATTRIBUTE_UNUSED)
virObjectUnref(obj);
}
-int virDomainObjListInit(virDomainObjListPtr doms)
+virDomainObjListPtr virDomainObjListNew(void)
{
+ virDomainObjListPtr doms;
+
+ if (VIR_ALLOC(doms) < 0) {
+ virReportOOMError();
+ return NULL;
+ }
+
doms->objs = virHashCreate(50, virDomainObjListDataFree);
- if (!doms->objs)
- return -1;
- return 0;
+ if (!doms->objs) {
+ VIR_FREE(doms);
+ return NULL;
+ }
+ return doms;
}
-void virDomainObjListDeinit(virDomainObjListPtr doms)
+void virDomainObjListFree(virDomainObjListPtr doms)
{
+ if (!doms)
+ return;
virHashFree(doms->objs);
+ VIR_FREE(doms);
}
@@ -807,8 +819,8 @@ static int virDomainObjListSearchID(const void *payload,
return want;
}
-virDomainObjPtr virDomainFindByID(const virDomainObjListPtr doms,
- int id)
+virDomainObjPtr virDomainObjListFindByID(const virDomainObjListPtr doms,
+ int id)
{
virDomainObjPtr obj;
obj = virHashSearch(doms->objs, virDomainObjListSearchID, &id);
@@ -818,8 +830,8 @@ virDomainObjPtr virDomainFindByID(const virDomainObjListPtr doms,
}
-virDomainObjPtr virDomainFindByUUID(const virDomainObjListPtr doms,
- const unsigned char *uuid)
+virDomainObjPtr virDomainObjListFindByUUID(const virDomainObjListPtr doms,
+ const unsigned char *uuid)
{
char uuidstr[VIR_UUID_STRING_BUFLEN];
virDomainObjPtr obj;
@@ -846,8 +858,8 @@ static int virDomainObjListSearchName(const void *payload,
return want;
}
-virDomainObjPtr virDomainFindByName(const virDomainObjListPtr doms,
- const char *name)
+virDomainObjPtr virDomainObjListFindByName(const virDomainObjListPtr doms,
+ const char *name)
{
virDomainObjPtr obj;
obj = virHashSearch(doms->objs, virDomainObjListSearchName, name);
@@ -1842,15 +1854,15 @@ void virDomainObjAssignDef(virDomainObjPtr domain,
}
}
-virDomainObjPtr virDomainAssignDef(virCapsPtr caps,
- virDomainObjListPtr doms,
- const virDomainDefPtr def,
- bool live)
+virDomainObjPtr virDomainObjListAdd(virDomainObjListPtr doms,
+ virCapsPtr caps,
+ const virDomainDefPtr def,
+ bool live)
{
virDomainObjPtr domain;
char uuidstr[VIR_UUID_STRING_BUFLEN];
- if ((domain = virDomainFindByUUID(doms, def->uuid))) {
+ if ((domain = virDomainObjListFindByUUID(doms, def->uuid))) {
virDomainObjAssignDef(domain, def, live);
return domain;
}
@@ -1982,8 +1994,8 @@ cleanup:
* and must also have locked 'dom', to ensure no one else
* is either waiting for 'dom' or still using it
*/
-void virDomainRemoveInactive(virDomainObjListPtr doms,
- virDomainObjPtr dom)
+void virDomainObjListRemove(virDomainObjListPtr doms,
+ virDomainObjPtr dom)
{
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->def->uuid, uuidstr);
@@ -14775,14 +14787,15 @@ cleanup:
}
-static virDomainObjPtr virDomainLoadConfig(virCapsPtr caps,
- virDomainObjListPtr doms,
- const char *configDir,
- const char *autostartDir,
- const char *name,
- unsigned int expectedVirtTypes,
- virDomainLoadConfigNotify notify,
- void *opaque)
+static virDomainObjPtr
+virDomainObjListLoadConfig(virDomainObjListPtr doms,
+ virCapsPtr caps,
+ const char *configDir,
+ const char *autostartDir,
+ const char *name,
+ unsigned int expectedVirtTypes,
+ virDomainLoadConfigNotify notify,
+ void *opaque)
{
char *configFile = NULL, *autostartLink = NULL;
virDomainDefPtr def = NULL;
@@ -14805,7 +14818,7 @@ static virDomainObjPtr virDomainLoadConfig(virCapsPtr caps,
/* if the domain is already in our hashtable, we only need to
* update the autostart flag
*/
- if ((dom = virDomainFindByUUID(doms, def->uuid))) {
+ if ((dom = virDomainObjListFindByUUID(doms, def->uuid))) {
dom->autostart = autostart;
if (virDomainObjIsActive(dom) &&
@@ -14820,7 +14833,7 @@ static virDomainObjPtr virDomainLoadConfig(virCapsPtr caps,
return dom;
}
- if (!(dom = virDomainAssignDef(caps, doms, def, false)))
+ if (!(dom = virDomainObjListAdd(doms, caps, def, false)))
goto error;
dom->autostart = autostart;
@@ -14839,13 +14852,14 @@ error:
return NULL;
}
-static virDomainObjPtr virDomainLoadStatus(virCapsPtr caps,
- virDomainObjListPtr doms,
- const char *statusDir,
- const char *name,
- unsigned int expectedVirtTypes,
- virDomainLoadConfigNotify notify,
- void *opaque)
+static virDomainObjPtr
+virDomainObjListLoadStatus(virDomainObjListPtr doms,
+ virCapsPtr caps,
+ const char *statusDir,
+ const char *name,
+ unsigned int expectedVirtTypes,
+ virDomainLoadConfigNotify notify,
+ void *opaque)
{
char *statusFile = NULL;
virDomainObjPtr obj = NULL;
@@ -14884,14 +14898,14 @@ error:
return NULL;
}
-int virDomainLoadAllConfigs(virCapsPtr caps,
- virDomainObjListPtr doms,
- const char *configDir,
- const char *autostartDir,
- int liveStatus,
- unsigned int expectedVirtTypes,
- virDomainLoadConfigNotify notify,
- void *opaque)
+int virDomainObjListLoadAllConfigs(virDomainObjListPtr doms,
+ virCapsPtr caps,
+ const char *configDir,
+ const char *autostartDir,
+ int liveStatus,
+ unsigned int expectedVirtTypes,
+ virDomainLoadConfigNotify notify,
+ void *opaque)
{
DIR *dir;
struct dirent *entry;
@@ -14920,22 +14934,22 @@ int virDomainLoadAllConfigs(virCapsPtr caps,
kill the whole process */
VIR_INFO("Loading config file '%s.xml'", entry->d_name);
if (liveStatus)
- dom = virDomainLoadStatus(caps,
- doms,
- configDir,
- entry->d_name,
- expectedVirtTypes,
- notify,
- opaque);
+ dom = virDomainObjListLoadStatus(doms,
+ caps,
+ configDir,
+ entry->d_name,
+ expectedVirtTypes,
+ notify,
+ opaque);
else
- dom = virDomainLoadConfig(caps,
- doms,
- configDir,
- autostartDir,
- entry->d_name,
- expectedVirtTypes,
- notify,
- opaque);
+ dom = virDomainObjListLoadConfig(doms,
+ caps,
+ configDir,
+ autostartDir,
+ entry->d_name,
+ expectedVirtTypes,
+ notify,
+ opaque);
if (dom) {
virObjectUnlock(dom);
if (!liveStatus)
@@ -15046,7 +15060,7 @@ virDomainFSDefPtr virDomainGetRootFilesystem(virDomainDefPtr def)
}
/*
- * virDomainObjIsDuplicate:
+ * virDomainObjListIsDuplicate:
* @doms : virDomainObjListPtr to search
* @def : virDomainDefPtr definition of domain to lookup
* @check_active: If true, ensure that domain is not active
@@ -15056,16 +15070,16 @@ virDomainFSDefPtr virDomainGetRootFilesystem(virDomainDefPtr
def)
* 1 if domain is a duplicate
*/
int
-virDomainObjIsDuplicate(virDomainObjListPtr doms,
- virDomainDefPtr def,
- unsigned int check_active)
+virDomainObjListIsDuplicate(virDomainObjListPtr doms,
+ virDomainDefPtr def,
+ unsigned int check_active)
{
int ret = -1;
int dupVM = 0;
virDomainObjPtr vm = NULL;
/* See if a VM with matching UUID already exists */
- vm = virDomainFindByUUID(doms, def->uuid);
+ vm = virDomainObjListFindByUUID(doms, def->uuid);
if (vm) {
/* UUID matches, but if names don't match, refuse it */
if (STRNEQ(vm->def->name, def->name)) {
@@ -15090,7 +15104,7 @@ virDomainObjIsDuplicate(virDomainObjListPtr doms,
dupVM = 1;
} else {
/* UUID does not match, but if a name matches, refuse it */
- vm = virDomainFindByName(doms, def->name);
+ vm = virDomainObjListFindByName(doms, def->name);
if (vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(vm->def->uuid, uuidstr);
@@ -15966,10 +15980,10 @@ cleanup:
#undef MATCH
int
-virDomainList(virConnectPtr conn,
- virHashTablePtr domobjs,
- virDomainPtr **domains,
- unsigned int flags)
+virDomainObjListExport(virDomainObjListPtr doms,
+ virConnectPtr conn,
+ virDomainPtr **domains,
+ unsigned int flags)
{
int ret = -1;
int i;
@@ -15977,13 +15991,13 @@ virDomainList(virConnectPtr conn,
struct virDomainListData data = { conn, NULL, flags, 0, false };
if (domains) {
- if (VIR_ALLOC_N(data.domains, virHashSize(domobjs) + 1) < 0) {
+ if (VIR_ALLOC_N(data.domains, virHashSize(doms->objs) + 1) < 0) {
virReportOOMError();
goto cleanup;
}
}
- virHashForEach(domobjs, virDomainListPopulate, &data);
+ virHashForEach(doms->objs, virDomainListPopulate, &data);
if (data.error)
goto cleanup;
@@ -15999,7 +16013,7 @@ virDomainList(virConnectPtr conn,
cleanup:
if (data.domains) {
- int count = virHashSize(domobjs);
+ int count = virHashSize(doms->objs);
for (i = 0; i < count; i++)
virObjectUnref(data.domains[i]);
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9a9e0b1..fab04a2 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1907,15 +1907,15 @@ virDomainObjIsActive(virDomainObjPtr dom)
virDomainObjPtr virDomainObjNew(virCapsPtr caps);
-int virDomainObjListInit(virDomainObjListPtr objs);
-void virDomainObjListDeinit(virDomainObjListPtr objs);
+virDomainObjListPtr virDomainObjListNew(void);
+void virDomainObjListFree(virDomainObjListPtr objs);
-virDomainObjPtr virDomainFindByID(const virDomainObjListPtr doms,
- int id);
-virDomainObjPtr virDomainFindByUUID(const virDomainObjListPtr doms,
- const unsigned char *uuid);
-virDomainObjPtr virDomainFindByName(const virDomainObjListPtr doms,
- const char *name);
+virDomainObjPtr virDomainObjListFindByID(const virDomainObjListPtr doms,
+ int id);
+virDomainObjPtr virDomainObjListFindByUUID(const virDomainObjListPtr doms,
+ const unsigned char *uuid);
+virDomainObjPtr virDomainObjListFindByName(const virDomainObjListPtr doms,
+ const char *name);
bool virDomainObjTaint(virDomainObjPtr obj,
enum virDomainTaintFlags taint);
@@ -1975,10 +1975,10 @@ virDomainChrDefPtr virDomainChrDefNew(void);
/* live == true means def describes an active domain (being migrated or
* restored) as opposed to a new persistent configuration of the domain */
-virDomainObjPtr virDomainAssignDef(virCapsPtr caps,
- virDomainObjListPtr doms,
- const virDomainDefPtr def,
- bool live);
+virDomainObjPtr virDomainObjListAdd(virDomainObjListPtr doms,
+ virCapsPtr caps,
+ const virDomainDefPtr def,
+ bool live);
void virDomainObjAssignDef(virDomainObjPtr domain,
const virDomainDefPtr def,
bool live);
@@ -2000,8 +2000,8 @@ virDomainDefPtr virDomainDefCopy(virCapsPtr caps, virDomainDefPtr
src,
virDomainDefPtr
virDomainObjCopyPersistentDef(virCapsPtr caps, virDomainObjPtr dom);
-void virDomainRemoveInactive(virDomainObjListPtr doms,
- virDomainObjPtr dom);
+void virDomainObjListRemove(virDomainObjListPtr doms,
+ virDomainObjPtr dom);
virDomainDeviceDefPtr virDomainDeviceDefParse(virCapsPtr caps,
virDomainDefPtr def,
@@ -2138,14 +2138,14 @@ typedef void (*virDomainLoadConfigNotify)(virDomainObjPtr dom,
int newDomain,
void *opaque);
-int virDomainLoadAllConfigs(virCapsPtr caps,
- virDomainObjListPtr doms,
- const char *configDir,
- const char *autostartDir,
- int liveStatus,
- unsigned int expectedVirtTypes,
- virDomainLoadConfigNotify notify,
- void *opaque);
+int virDomainObjListLoadAllConfigs(virDomainObjListPtr doms,
+ virCapsPtr caps,
+ const char *configDir,
+ const char *autostartDir,
+ int liveStatus,
+ unsigned int expectedVirtTypes,
+ virDomainLoadConfigNotify notify,
+ void *opaque);
int virDomainDeleteConfig(const char *configDir,
const char *autostartDir,
@@ -2163,9 +2163,9 @@ int virDomainFSIndexByName(virDomainDefPtr def, const char *name);
int virDomainVideoDefaultType(virDomainDefPtr def);
int virDomainVideoDefaultRAM(virDomainDefPtr def, int type);
-int virDomainObjIsDuplicate(virDomainObjListPtr doms,
- virDomainDefPtr def,
- unsigned int check_active);
+int virDomainObjListIsDuplicate(virDomainObjListPtr doms,
+ virDomainDefPtr def,
+ unsigned int check_active);
int virDomainObjListNumOfDomains(virDomainObjListPtr doms, int active);
@@ -2366,8 +2366,10 @@ VIR_ENUM_DECL(virDomainStartupPolicy)
VIR_CONNECT_LIST_DOMAINS_FILTERS_AUTOSTART | \
VIR_CONNECT_LIST_DOMAINS_FILTERS_SNAPSHOT)
-int virDomainList(virConnectPtr conn, virHashTablePtr domobjs,
- virDomainPtr **domains, unsigned int flags);
+int virDomainObjListExport(virDomainObjListPtr doms,
+ virConnectPtr conn,
+ virDomainPtr **domains,
+ unsigned int flags);
virDomainVcpuPinDefPtr virDomainLookupVcpuPin(virDomainDefPtr def,
int vcpuid);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index c589236..8fe181b 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -284,7 +284,6 @@ virBlkioDeviceWeightArrayClear;
virDiskNameToBusDeviceIndex;
virDiskNameToIndex;
virDomainActualNetDefFree;
-virDomainAssignDef;
virDomainBlockedReasonTypeFromString;
virDomainBlockedReasonTypeToString;
virDomainBootMenuTypeFromString;
@@ -375,9 +374,6 @@ virDomainEmulatorPinAdd;
virDomainEmulatorPinDel;
virDomainFeatureStateTypeFromString;
virDomainFeatureStateTypeToString;
-virDomainFindByID;
-virDomainFindByName;
-virDomainFindByUUID;
virDomainFSDefFree;
virDomainFSIndexByName;
virDomainFSTypeFromString;
@@ -442,9 +438,7 @@ virDomainLifecycleCrashTypeFromString;
virDomainLifecycleCrashTypeToString;
virDomainLifecycleTypeFromString;
virDomainLifecycleTypeToString;
-virDomainList;
virDomainLiveConfigHelperMethod;
-virDomainLoadAllConfigs;
virDomainLockFailureTypeFromString;
virDomainLockFailureTypeToString;
virDomainLookupVcpuPin;
@@ -476,12 +470,19 @@ virDomainObjAssignDef;
virDomainObjCopyPersistentDef;
virDomainObjGetPersistentDef;
virDomainObjGetState;
-virDomainObjIsDuplicate;
-virDomainObjListDeinit;
+virDomainObjListAdd;
+virDomainObjListExport;
+virDomainObjListFindByID;
+virDomainObjListFindByName;
+virDomainObjListFindByUUID;
+virDomainObjListFree;
virDomainObjListGetActiveIDs;
virDomainObjListGetInactiveNames;
-virDomainObjListInit;
+virDomainObjListIsDuplicate;
+virDomainObjListLoadAllConfigs;
+virDomainObjListNew;
virDomainObjListNumOfDomains;
+virDomainObjListRemove;
virDomainObjNew;
virDomainObjSetDefTransient;
virDomainObjSetState;
@@ -496,7 +497,6 @@ virDomainPMSuspendedReasonTypeFromString;
virDomainPMSuspendedReasonTypeToString;
virDomainRedirdevBusTypeFromString;
virDomainRedirdevBusTypeToString;
-virDomainRemoveInactive;
virDomainRunningReasonTypeFromString;
virDomainRunningReasonTypeToString;
virDomainSaveConfig;
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index 019792b..4c3280e 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -67,7 +67,7 @@ struct _libxlDriverPrivate {
virStateInhibitCallback inhibitCallback;
void *inhibitOpaque;
- virDomainObjList domains;
+ virDomainObjListPtr domains;
virDomainEventStatePtr domainEventState;
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index c898753..b6dce0d 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -684,7 +684,7 @@ libxlEventHandler(void *data ATTRIBUTE_UNUSED, const libxl_event
*event)
goto cleanup;
libxlDriverLock(driver);
- vm = virDomainFindByID(&driver->domains, event->domid);
+ vm = virDomainObjListFindByID(driver->domains, event->domid);
libxlDriverUnlock(driver);
if (!vm)
@@ -703,7 +703,7 @@ libxlEventHandler(void *data ATTRIBUTE_UNUSED, const libxl_event
*event)
}
libxlVmReap(driver, vm, reason);
if (!vm->persistent) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
break;
@@ -1052,7 +1052,7 @@ libxlReconnectDomain(void *payload,
out:
libxlVmCleanup(driver, vm, VIR_DOMAIN_SHUTOFF_UNKNOWN);
if (!vm->persistent)
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
else
virObjectUnlock(vm);
}
@@ -1060,7 +1060,7 @@ out:
static void
libxlReconnectDomains(libxlDriverPrivatePtr driver)
{
- virHashForEach(driver->domains.objs, libxlReconnectDomain, driver);
+ virHashForEach(driver->domains->objs, libxlReconnectDomain, driver);
}
static int
@@ -1071,7 +1071,7 @@ libxlShutdown(void)
libxlDriverLock(libxl_driver);
virCapabilitiesFree(libxl_driver->caps);
- virDomainObjListDeinit(&libxl_driver->domains);
+ virDomainObjListFree(libxl_driver->domains);
libxl_ctx_free(libxl_driver->ctx);
xtl_logger_destroy(libxl_driver->logger);
if (libxl_driver->logger_file)
@@ -1138,8 +1138,8 @@ libxlStartup(bool privileged,
LIBXL_VNC_PORT_MAX)))
goto error;
- if (virDomainObjListInit(&libxl_driver->domains) < 0)
- goto out_of_memory;
+ if (!(libxl_driver->domains = virDomainObjListNew()))
+ goto error;
if (virAsprintf(&libxl_driver->configDir,
"%s", LIBXL_CONFIG_DIR) == -1)
@@ -1233,29 +1233,29 @@ libxlStartup(bool privileged,
libxl_driver->caps->privateDataFreeFunc = libxlDomainObjPrivateFree;
/* Load running domains first. */
- if (virDomainLoadAllConfigs(libxl_driver->caps,
- &libxl_driver->domains,
- libxl_driver->stateDir,
- libxl_driver->autostartDir,
- 1, 1 << VIR_DOMAIN_VIRT_XEN,
- NULL, NULL) < 0)
+ if (virDomainObjListLoadAllConfigs(libxl_driver->domains,
+ libxl_driver->caps,
+ libxl_driver->stateDir,
+ libxl_driver->autostartDir,
+ 1, 1 << VIR_DOMAIN_VIRT_XEN,
+ NULL, NULL) < 0)
goto error;
libxlReconnectDomains(libxl_driver);
/* Then inactive persistent configs */
- if (virDomainLoadAllConfigs(libxl_driver->caps,
- &libxl_driver->domains,
- libxl_driver->configDir,
- libxl_driver->autostartDir,
- 0, 1 << VIR_DOMAIN_VIRT_XEN,
- NULL, NULL) < 0)
+ if (virDomainObjListLoadAllConfigs(libxl_driver->domains,
+ libxl_driver->caps,
+ libxl_driver->configDir,
+ libxl_driver->autostartDir,
+ 0, 1 << VIR_DOMAIN_VIRT_XEN,
+ NULL, NULL) < 0)
goto error;
- virHashForEach(libxl_driver->domains.objs, libxlAutostartDomain,
+ virHashForEach(libxl_driver->domains->objs, libxlAutostartDomain,
libxl_driver);
- virHashForEach(libxl_driver->domains.objs, libxlDomainManagedSaveLoad,
+ virHashForEach(libxl_driver->domains->objs, libxlDomainManagedSaveLoad,
libxl_driver);
libxlDriverUnlock(libxl_driver);
@@ -1281,14 +1281,14 @@ libxlReload(void)
return 0;
libxlDriverLock(libxl_driver);
- virDomainLoadAllConfigs(libxl_driver->caps,
- &libxl_driver->domains,
- libxl_driver->configDir,
- libxl_driver->autostartDir,
- 1, 1 << VIR_DOMAIN_VIRT_XEN,
- NULL, libxl_driver);
-
- virHashForEach(libxl_driver->domains.objs, libxlAutostartDomain,
+ virDomainObjListLoadAllConfigs(libxl_driver->domains,
+ libxl_driver->caps,
+ libxl_driver->configDir,
+ libxl_driver->autostartDir,
+ 1, 1 << VIR_DOMAIN_VIRT_XEN,
+ NULL, libxl_driver);
+
+ virHashForEach(libxl_driver->domains->objs, libxlAutostartDomain,
libxl_driver);
libxlDriverUnlock(libxl_driver);
@@ -1409,7 +1409,7 @@ libxlListDomains(virConnectPtr conn, int *ids, int nids)
int n;
libxlDriverLock(driver);
- n = virDomainObjListGetActiveIDs(&driver->domains, ids, nids);
+ n = virDomainObjListGetActiveIDs(driver->domains, ids, nids);
libxlDriverUnlock(driver);
return n;
@@ -1422,7 +1422,7 @@ libxlNumDomains(virConnectPtr conn)
int n;
libxlDriverLock(driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 1);
+ n = virDomainObjListNumOfDomains(driver->domains, 1);
libxlDriverUnlock(driver);
return n;
@@ -1445,17 +1445,18 @@ libxlDomainCreateXML(virConnectPtr conn, const char *xml,
VIR_DOMAIN_XML_INACTIVE)))
goto cleanup;
- if (virDomainObjIsDuplicate(&driver->domains, def, 1) < 0)
+ if (virDomainObjListIsDuplicate(driver->domains, def, 1) < 0)
goto cleanup;
- if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains, def, false)))
+ if (!(vm = virDomainObjListAdd(driver->domains,
+ driver->caps,
+ def, false)))
goto cleanup;
def = NULL;
if (libxlVmStart(driver, vm, (flags & VIR_DOMAIN_START_PAUSED) != 0,
-1) < 0) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
goto cleanup;
}
@@ -1480,7 +1481,7 @@ libxlDomainLookupByID(virConnectPtr conn, int id)
virDomainPtr dom = NULL;
libxlDriverLock(driver);
- vm = virDomainFindByID(&driver->domains, id);
+ vm = virDomainObjListFindByID(driver->domains, id);
libxlDriverUnlock(driver);
if (!vm) {
@@ -1506,7 +1507,7 @@ libxlDomainLookupByUUID(virConnectPtr conn, const unsigned char
*uuid)
virDomainPtr dom = NULL;
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -1532,7 +1533,7 @@ libxlDomainLookupByName(virConnectPtr conn, const char *name)
virDomainPtr dom = NULL;
libxlDriverLock(driver);
- vm = virDomainFindByName(&driver->domains, name);
+ vm = virDomainObjListFindByName(driver->domains, name);
libxlDriverUnlock(driver);
if (!vm) {
@@ -1560,7 +1561,7 @@ libxlDomainSuspend(virDomainPtr dom)
int ret = -1;
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -1618,7 +1619,7 @@ libxlDomainResume(virDomainPtr dom)
int ret = -1;
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -1678,7 +1679,7 @@ libxlDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
virCheckFlags(0, -1);
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -1731,7 +1732,7 @@ libxlDomainReboot(virDomainPtr dom, unsigned int flags)
virCheckFlags(0, -1);
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -1774,7 +1775,7 @@ libxlDomainDestroyFlags(virDomainPtr dom,
virCheckFlags(0, -1);
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -1799,7 +1800,7 @@ libxlDomainDestroyFlags(virDomainPtr dom,
}
if (!vm->persistent) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
@@ -1828,7 +1829,7 @@ libxlDomainGetOSType(virDomainPtr dom)
char *type = NULL;
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -1855,7 +1856,7 @@ libxlDomainGetMaxMemory(virDomainPtr dom)
unsigned long long ret = 0;
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -1886,7 +1887,7 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
VIR_DOMAIN_MEM_MAXIMUM, -1);
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -2005,7 +2006,7 @@ libxlDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
int ret = -1;
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -2052,7 +2053,7 @@ libxlDomainGetState(virDomainPtr dom,
virCheckFlags(0, -1);
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -2163,7 +2164,7 @@ libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char
*dxml,
}
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -2182,7 +2183,7 @@ libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char
*dxml,
goto cleanup;
if (!vm->persistent) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
@@ -2225,17 +2226,19 @@ libxlDomainRestoreFlags(virConnectPtr conn, const char *from,
if (fd < 0)
goto cleanup;
- if (virDomainObjIsDuplicate(&driver->domains, def, 1) < 0)
+ if (virDomainObjListIsDuplicate(driver->domains, def, 1) < 0)
goto cleanup;
- if (!(vm = virDomainAssignDef(driver->caps, &driver->domains, def, true)))
+ if (!(vm = virDomainObjListAdd(driver->domains,
+ driver->caps,
+ def, true)))
goto cleanup;
def = NULL;
if ((ret = libxlVmStart(driver, vm, false, fd)) < 0 &&
!vm->persistent) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
@@ -2268,7 +2271,7 @@ libxlDomainCoreDump(virDomainPtr dom, const char *to, unsigned int
flags)
virCheckFlags(VIR_DUMP_LIVE | VIR_DUMP_CRASH, -1);
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -2319,7 +2322,7 @@ libxlDomainCoreDump(virDomainPtr dom, const char *to, unsigned int
flags)
}
if ((flags & VIR_DUMP_CRASH) && !vm->persistent) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
@@ -2360,7 +2363,7 @@ libxlDomainManagedSave(virDomainPtr dom, unsigned int flags)
virCheckFlags(0, -1);
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -2389,7 +2392,7 @@ libxlDomainManagedSave(virDomainPtr dom, unsigned int flags)
goto cleanup;
if (!vm->persistent) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
@@ -2434,7 +2437,7 @@ libxlDomainHasManagedSaveImage(virDomainPtr dom, unsigned int
flags)
virCheckFlags(0, -1);
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -2463,7 +2466,7 @@ libxlDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
virCheckFlags(0, -1);
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -2522,7 +2525,7 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
}
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -2641,7 +2644,7 @@ libxlDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
VIR_DOMAIN_VCPU_MAXIMUM, -1);
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -2698,7 +2701,7 @@ libxlDomainPinVcpu(virDomainPtr dom, unsigned int vcpu, unsigned
char *cpumap,
libxl_bitmap map;
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -2765,7 +2768,7 @@ libxlDomainGetVcpus(virDomainPtr dom, virVcpuInfoPtr info, int
maxinfo,
unsigned char *cpumap;
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -2828,7 +2831,7 @@ libxlDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
/* Flags checked by virDomainDefFormat */
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -2944,7 +2947,7 @@ libxlListDefinedDomains(virConnectPtr conn,
int n;
libxlDriverLock(driver);
- n = virDomainObjListGetInactiveNames(&driver->domains, names, nnames);
+ n = virDomainObjListGetInactiveNames(driver->domains, names, nnames);
libxlDriverUnlock(driver);
return n;
}
@@ -2956,7 +2959,7 @@ libxlNumDefinedDomains(virConnectPtr conn)
int n;
libxlDriverLock(driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 0);
+ n = virDomainObjListNumOfDomains(driver->domains, 0);
libxlDriverUnlock(driver);
return n;
@@ -2973,7 +2976,7 @@ libxlDomainCreateWithFlags(virDomainPtr dom,
virCheckFlags(VIR_DOMAIN_START_PAUSED, -1);
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -3019,18 +3022,19 @@ libxlDomainDefineXML(virConnectPtr conn, const char *xml)
VIR_DOMAIN_XML_INACTIVE)))
goto cleanup;
- if ((dupVM = virDomainObjIsDuplicate(&driver->domains, def, 0)) < 0)
+ if ((dupVM = virDomainObjListIsDuplicate(driver->domains, def, 0)) < 0)
goto cleanup;
- if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains, def, false)))
+ if (!(vm = virDomainObjListAdd(driver->domains,
+ driver->caps,
+ def, false)))
goto cleanup;
def = NULL;
vm->persistent = 1;
if (virDomainSaveConfig(driver->configDir,
vm->newDef ? vm->newDef : vm->def) < 0) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
goto cleanup;
}
@@ -3067,7 +3071,7 @@ libxlDomainUndefineFlags(virDomainPtr dom,
virCheckFlags(VIR_DOMAIN_UNDEFINE_MANAGED_SAVE, -1);
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -3114,7 +3118,7 @@ libxlDomainUndefineFlags(virDomainPtr dom,
if (virDomainObjIsActive(vm)) {
vm->persistent = 0;
} else {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
@@ -3506,7 +3510,7 @@ libxlDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
VIR_DOMAIN_DEVICE_MODIFY_CONFIG, -1);
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching
uuid"));
@@ -3707,7 +3711,7 @@ libxlDomainGetAutostart(virDomainPtr dom, int *autostart)
int ret = -1;
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -3736,7 +3740,7 @@ libxlDomainSetAutostart(virDomainPtr dom, int autostart)
int ret = -1;
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -3806,7 +3810,7 @@ libxlDomainGetSchedulerType(virDomainPtr dom, int *nparams)
libxl_scheduler sched_id;
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -3871,7 +3875,7 @@ libxlDomainGetSchedulerParametersFlags(virDomainPtr dom,
virCheckFlags(0, -1);
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -3954,7 +3958,7 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom,
return -1;
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -4024,7 +4028,7 @@ libxlDomainIsActive(virDomainPtr dom)
int ret = -1;
libxlDriverLock(driver);
- obj = virDomainFindByUUID(&driver->domains, dom->uuid);
+ obj = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!obj) {
virReportError(VIR_ERR_NO_DOMAIN, NULL);
@@ -4046,7 +4050,7 @@ libxlDomainIsPersistent(virDomainPtr dom)
int ret = -1;
libxlDriverLock(driver);
- obj = virDomainFindByUUID(&driver->domains, dom->uuid);
+ obj = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!obj) {
virReportError(VIR_ERR_NO_DOMAIN, NULL);
@@ -4068,7 +4072,7 @@ libxlDomainIsUpdated(virDomainPtr dom)
int ret = -1;
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN, NULL);
@@ -4135,7 +4139,7 @@ libxlListAllDomains(virConnectPtr conn,
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
libxlDriverLock(driver);
- ret = virDomainList(conn, driver->domains.objs, domains, flags);
+ ret = virDomainObjListExport(driver->domains, conn, domains, flags);
libxlDriverUnlock(driver);
return ret;
diff --git a/src/lxc/lxc_conf.h b/src/lxc/lxc_conf.h
index d45e0a0..a6c111e 100644
--- a/src/lxc/lxc_conf.h
+++ b/src/lxc/lxc_conf.h
@@ -58,7 +58,7 @@ struct _virLXCDriver {
virStateInhibitCallback inhibitCallback;
void *inhibitOpaque;
- virDomainObjList domains;
+ virDomainObjListPtr domains;
char *configDir;
char *autostartDir;
char *stateDir;
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 1fe8039..3611821 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -84,7 +84,7 @@ static int
lxcVMFilterRebuild(virConnectPtr conn ATTRIBUTE_UNUSED,
virHashIterator iter, void *data)
{
- virHashForEach(lxc_driver->domains.objs, iter, data);
+ virHashForEach(lxc_driver->domains->objs, iter, data);
return 0;
}
@@ -208,7 +208,7 @@ static virDomainPtr lxcDomainLookupByID(virConnectPtr conn,
virDomainPtr dom = NULL;
lxcDriverLock(driver);
- vm = virDomainFindByID(&driver->domains, id);
+ vm = virDomainObjListFindByID(driver->domains, id);
lxcDriverUnlock(driver);
if (!vm) {
@@ -235,7 +235,7 @@ static virDomainPtr lxcDomainLookupByUUID(virConnectPtr conn,
virDomainPtr dom = NULL;
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, uuid);
lxcDriverUnlock(driver);
if (!vm) {
@@ -264,7 +264,7 @@ static virDomainPtr lxcDomainLookupByName(virConnectPtr conn,
virDomainPtr dom = NULL;
lxcDriverLock(driver);
- vm = virDomainFindByName(&driver->domains, name);
+ vm = virDomainObjListFindByName(driver->domains, name);
lxcDriverUnlock(driver);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN,
@@ -290,7 +290,7 @@ static int lxcDomainIsActive(virDomainPtr dom)
int ret = -1;
lxcDriverLock(driver);
- obj = virDomainFindByUUID(&driver->domains, dom->uuid);
+ obj = virDomainObjListFindByUUID(driver->domains, dom->uuid);
lxcDriverUnlock(driver);
if (!obj) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -315,7 +315,7 @@ static int lxcDomainIsPersistent(virDomainPtr dom)
int ret = -1;
lxcDriverLock(driver);
- obj = virDomainFindByUUID(&driver->domains, dom->uuid);
+ obj = virDomainObjListFindByUUID(driver->domains, dom->uuid);
lxcDriverUnlock(driver);
if (!obj) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -339,7 +339,7 @@ static int lxcDomainIsUpdated(virDomainPtr dom)
int ret = -1;
lxcDriverLock(driver);
- obj = virDomainFindByUUID(&driver->domains, dom->uuid);
+ obj = virDomainObjListFindByUUID(driver->domains, dom->uuid);
lxcDriverUnlock(driver);
if (!obj) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -361,7 +361,7 @@ static int lxcListDomains(virConnectPtr conn, int *ids, int nids) {
int n;
lxcDriverLock(driver);
- n = virDomainObjListGetActiveIDs(&driver->domains, ids, nids);
+ n = virDomainObjListGetActiveIDs(driver->domains, ids, nids);
lxcDriverUnlock(driver);
return n;
@@ -372,7 +372,7 @@ static int lxcNumDomains(virConnectPtr conn) {
int n;
lxcDriverLock(driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 1);
+ n = virDomainObjListNumOfDomains(driver->domains, 1);
lxcDriverUnlock(driver);
return n;
@@ -384,7 +384,7 @@ static int lxcListDefinedDomains(virConnectPtr conn,
int n;
lxcDriverLock(driver);
- n = virDomainObjListGetInactiveNames(&driver->domains, names, nnames);
+ n = virDomainObjListGetInactiveNames(driver->domains, names, nnames);
lxcDriverUnlock(driver);
return n;
@@ -396,7 +396,7 @@ static int lxcNumDefinedDomains(virConnectPtr conn) {
int n;
lxcDriverLock(driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 0);
+ n = virDomainObjListNumOfDomains(driver->domains, 0);
lxcDriverUnlock(driver);
return n;
@@ -422,7 +422,7 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const char
*xml)
if (virSecurityManagerVerify(driver->securityManager, def) < 0)
goto cleanup;
- if ((dupVM = virDomainObjIsDuplicate(&driver->domains, def, 0)) < 0)
+ if ((dupVM = virDomainObjListIsDuplicate(driver->domains, def, 0)) < 0)
goto cleanup;
if ((def->nets != NULL) && !(driver->have_netns)) {
@@ -431,15 +431,16 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const char
*xml)
goto cleanup;
}
- if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains, def, false)))
+ if (!(vm = virDomainObjListAdd(driver->domains,
+ driver->caps,
+ def, false)))
goto cleanup;
def = NULL;
vm->persistent = 1;
if (virDomainSaveConfig(driver->configDir,
vm->newDef ? vm->newDef : vm->def) < 0) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
goto cleanup;
}
@@ -475,7 +476,7 @@ static int lxcDomainUndefineFlags(virDomainPtr dom,
virCheckFlags(0, -1);
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -502,7 +503,7 @@ static int lxcDomainUndefineFlags(virDomainPtr dom,
if (virDomainObjIsActive(vm)) {
vm->persistent = 0;
} else {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
@@ -531,7 +532,7 @@ static int lxcDomainGetInfo(virDomainPtr dom,
int ret = -1, rc;
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -596,7 +597,7 @@ lxcDomainGetState(virDomainPtr dom,
virCheckFlags(0, -1);
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
lxcDriverUnlock(driver);
if (!vm) {
@@ -623,7 +624,7 @@ static char *lxcGetOSType(virDomainPtr dom)
char *ret = NULL;
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
lxcDriverUnlock(driver);
if (!vm) {
@@ -654,7 +655,7 @@ lxcDomainGetMaxMemory(virDomainPtr dom)
unsigned long long ret = 0;
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
lxcDriverUnlock(driver);
if (!vm) {
@@ -679,7 +680,7 @@ static int lxcDomainSetMaxMemory(virDomainPtr dom, unsigned long
newmax) {
int ret = -1;
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
lxcDriverUnlock(driver);
if (!vm) {
@@ -712,7 +713,7 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem)
{
int ret = -1;
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
lxcDriverUnlock(driver);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -787,7 +788,7 @@ lxcDomainSetMemoryParameters(virDomainPtr dom,
return -1;
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (vm == NULL) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -857,7 +858,7 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
virCheckFlags(0, -1);
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (vm == NULL) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -950,7 +951,7 @@ static char *lxcDomainGetXMLDesc(virDomainPtr dom,
/* Flags checked by virDomainDefFormat */
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
lxcDriverUnlock(driver);
if (!vm) {
@@ -990,7 +991,7 @@ static int lxcDomainStartWithFlags(virDomainPtr dom, unsigned int
flags)
virCheckFlags(VIR_DOMAIN_START_AUTODESTROY, -1);
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -1077,7 +1078,7 @@ lxcDomainCreateAndStart(virConnectPtr conn,
if (virSecurityManagerVerify(driver->securityManager, def) < 0)
goto cleanup;
- if (virDomainObjIsDuplicate(&driver->domains, def, 1) < 0)
+ if (virDomainObjListIsDuplicate(driver->domains, def, 1) < 0)
goto cleanup;
if ((def->nets != NULL) && !(driver->have_netns)) {
@@ -1087,8 +1088,9 @@ lxcDomainCreateAndStart(virConnectPtr conn,
}
- if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains, def, false)))
+ if (!(vm = virDomainObjListAdd(driver->domains,
+ driver->caps,
+ def, false)))
goto cleanup;
def = NULL;
@@ -1096,7 +1098,7 @@ lxcDomainCreateAndStart(virConnectPtr conn,
(flags & VIR_DOMAIN_START_AUTODESTROY),
VIR_DOMAIN_RUNNING_BOOTED) < 0) {
virDomainAuditStart(vm, "booted", false);
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
goto cleanup;
}
@@ -1128,7 +1130,7 @@ static int lxcDomainGetSecurityLabel(virDomainPtr dom,
virSecurityLabelPtr secla
int ret = -1;
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
memset(seclabel, 0, sizeof(*seclabel));
@@ -1315,7 +1317,7 @@ lxcDomainDestroyFlags(virDomainPtr dom,
virCheckFlags(0, -1);
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -1338,7 +1340,7 @@ lxcDomainDestroyFlags(virDomainPtr dom,
priv->doneStopEvent = true;
virDomainAuditStop(vm, "destroyed");
if (!vm->persistent) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
@@ -1442,7 +1444,7 @@ static int lxcStartup(bool privileged,
}
lxcDriverLock(lxc_driver);
- if (virDomainObjListInit(&lxc_driver->domains) < 0)
+ if (!(lxc_driver->domains = virDomainObjListNew()))
goto cleanup;
lxc_driver->domainEventState = virDomainEventStateNew();
@@ -1478,23 +1480,23 @@ static int lxcStartup(bool privileged,
goto cleanup;
/* Get all the running persistent or transient configs first */
- if (virDomainLoadAllConfigs(lxc_driver->caps,
- &lxc_driver->domains,
- lxc_driver->stateDir,
- NULL,
- 1, 1 << VIR_DOMAIN_VIRT_LXC,
- NULL, NULL) < 0)
+ if (virDomainObjListLoadAllConfigs(lxc_driver->domains,
+ lxc_driver->caps,
+ lxc_driver->stateDir,
+ NULL,
+ 1, 1 << VIR_DOMAIN_VIRT_LXC,
+ NULL, NULL) < 0)
goto cleanup;
- virLXCProcessReconnectAll(lxc_driver, &lxc_driver->domains);
+ virLXCProcessReconnectAll(lxc_driver, lxc_driver->domains);
/* Then inactive persistent configs */
- if (virDomainLoadAllConfigs(lxc_driver->caps,
- &lxc_driver->domains,
- lxc_driver->configDir,
- lxc_driver->autostartDir,
- 0, 1 << VIR_DOMAIN_VIRT_LXC,
- NULL, NULL) < 0)
+ if (virDomainObjListLoadAllConfigs(lxc_driver->domains,
+ lxc_driver->caps,
+ lxc_driver->configDir,
+ lxc_driver->autostartDir,
+ 0, 1 << VIR_DOMAIN_VIRT_LXC,
+ NULL, NULL) < 0)
goto cleanup;
lxcDriverUnlock(lxc_driver);
@@ -1536,12 +1538,12 @@ lxcReload(void) {
return 0;
lxcDriverLock(lxc_driver);
- virDomainLoadAllConfigs(lxc_driver->caps,
- &lxc_driver->domains,
- lxc_driver->configDir,
- lxc_driver->autostartDir,
- 0, 1 << VIR_DOMAIN_VIRT_LXC,
- lxcNotifyLoadDomain, lxc_driver);
+ virDomainObjListLoadAllConfigs(lxc_driver->domains,
+ lxc_driver->caps,
+ lxc_driver->configDir,
+ lxc_driver->autostartDir,
+ 0, 1 << VIR_DOMAIN_VIRT_LXC,
+ lxcNotifyLoadDomain, lxc_driver);
lxcDriverUnlock(lxc_driver);
return 0;
@@ -1554,7 +1556,7 @@ static int lxcShutdown(void)
lxcDriverLock(lxc_driver);
virNWFilterUnRegisterCallbackDriver(&lxcCallbackDriver);
- virDomainObjListDeinit(&lxc_driver->domains);
+ virDomainObjListFree(lxc_driver->domains);
virDomainEventStateFree(lxc_driver->domainEventState);
virLXCProcessAutoDestroyShutdown(lxc_driver);
@@ -1774,7 +1776,7 @@ lxcSetSchedulerParametersFlags(virDomainPtr dom,
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (vm == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -1916,7 +1918,7 @@ lxcGetSchedulerParametersFlags(virDomainPtr dom,
cpu_bw_status = !!rc;
}
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (vm == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -2029,7 +2031,7 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (vm == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -2127,7 +2129,7 @@ lxcDomainGetBlkioParameters(virDomainPtr dom,
VIR_DOMAIN_AFFECT_CONFIG, -1);
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (vm == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -2228,7 +2230,7 @@ lxcDomainInterfaceStats(virDomainPtr dom,
int ret = -1;
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
lxcDriverUnlock(driver);
if (!vm) {
@@ -2283,7 +2285,7 @@ static int lxcDomainGetAutostart(virDomainPtr dom,
int ret = -1;
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
lxcDriverUnlock(driver);
if (!vm) {
@@ -2311,7 +2313,7 @@ static int lxcDomainSetAutostart(virDomainPtr dom,
int ret = -1;
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -2479,7 +2481,7 @@ static int lxcDomainSuspend(virDomainPtr dom)
int ret = -1;
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -2544,7 +2546,7 @@ static int lxcDomainResume(virDomainPtr dom)
int ret = -1;
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -2604,7 +2606,7 @@ lxcDomainOpenConsole(virDomainPtr dom,
lxcDriverLock(driver);
virUUIDFormat(dom->uuid, uuidstr);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"),
uuidstr);
@@ -2682,7 +2684,7 @@ lxcDomainSendProcessSignal(virDomainPtr dom,
lxcDriverLock(driver);
virUUIDFormat(dom->uuid, uuidstr);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
lxcDriverUnlock(driver);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN,
@@ -2747,7 +2749,7 @@ lxcListAllDomains(virConnectPtr conn,
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
lxcDriverLock(driver);
- ret = virDomainList(conn, driver->domains.objs, domains, flags);
+ ret = virDomainObjListExport(driver->domains, conn, domains, flags);
lxcDriverUnlock(driver);
return ret;
@@ -2769,7 +2771,7 @@ lxcDomainShutdownFlags(virDomainPtr dom,
VIR_DOMAIN_SHUTDOWN_SIGNAL, -1);
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
lxcDriverUnlock(driver);
if (!vm) {
@@ -2858,7 +2860,7 @@ lxcDomainReboot(virDomainPtr dom,
VIR_DOMAIN_REBOOT_SIGNAL, -1);
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
lxcDriverUnlock(driver);
if (!vm) {
@@ -4301,7 +4303,7 @@ lxcDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
affect = flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG);
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -4485,7 +4487,7 @@ static int lxcDomainOpenNamespace(virDomainPtr dom,
virCheckFlags(0, -1);
lxcDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
lxcDriverUnlock(driver);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 5598a86..0c943ea 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -85,8 +85,8 @@ static void virLXCProcessAutoDestroyDom(void *payload,
return;
}
- if (!(dom = virDomainFindByUUID(&data->driver->domains,
- uuid))) {
+ if (!(dom = virDomainObjListFindByUUID(data->driver->domains,
+ uuid))) {
VIR_DEBUG("No domain object to kill");
return;
}
@@ -101,7 +101,7 @@ static void virLXCProcessAutoDestroyDom(void *payload,
priv->doneStopEvent = true;
if (dom && !dom->persistent)
- virDomainRemoveInactive(&data->driver->domains, dom);
+ virDomainObjListRemove(data->driver->domains, dom);
if (dom)
virObjectUnlock(dom);
@@ -576,7 +576,7 @@ static void virLXCProcessMonitorEOFNotify(virLXCMonitorPtr mon,
VIR_DEBUG("Stop event has already been sent");
}
if (!vm->persistent) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
} else {
@@ -590,7 +590,7 @@ static void virLXCProcessMonitorEOFNotify(virLXCMonitorPtr mon,
VIR_DOMAIN_EVENT_STOPPED,
priv->stopReason);
if (!vm->persistent) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
}
@@ -1290,7 +1290,7 @@ virLXCProcessAutostartAll(virLXCDriverPtr driver)
struct virLXCProcessAutostartData data = { driver, conn };
lxcDriverLock(driver);
- virHashForEach(driver->domains.objs, virLXCProcessAutostartDomain, &data);
+ virHashForEach(driver->domains->objs, virLXCProcessAutostartDomain,
&data);
lxcDriverUnlock(driver);
if (conn)
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 59de0fe..46f30ca 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -558,7 +558,7 @@ openvzFreeDriver(struct openvz_driver *driver)
if (!driver)
return;
- virDomainObjListDeinit(&driver->domains);
+ virDomainObjListFree(driver->domains);
virCapabilitiesFree(driver->caps);
VIR_FREE(driver);
}
@@ -656,14 +656,14 @@ int openvzLoadDomains(struct openvz_driver *driver) {
openvzReadMemConf(dom->def, veid);
virUUIDFormat(dom->def->uuid, uuidstr);
- if (virHashLookup(driver->domains.objs, uuidstr)) {
+ if (virHashLookup(driver->domains->objs, uuidstr)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Duplicate container UUID %s detected for %d"),
uuidstr,
veid);
goto cleanup;
}
- if (virHashAddEntry(driver->domains.objs, uuidstr, dom) < 0) {
+ if (virHashAddEntry(driver->domains->objs, uuidstr, dom) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Could not add UUID for container %d"), veid);
goto cleanup;
diff --git a/src/openvz/openvz_conf.h b/src/openvz/openvz_conf.h
index c1007f0..d7f21b3 100644
--- a/src/openvz/openvz_conf.h
+++ b/src/openvz/openvz_conf.h
@@ -45,7 +45,7 @@ struct openvz_driver {
virMutex lock;
virCapsPtr caps;
- virDomainObjList domains;
+ virDomainObjListPtr domains;
int version;
};
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index e12a84b..24d4202 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -240,9 +240,8 @@ openvzDomainGetHostname(virDomainPtr dom, unsigned int flags)
virDomainObjPtr vm;
virCheckFlags(0, NULL);
-
openvzDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!vm) {
@@ -280,7 +279,7 @@ static virDomainPtr openvzDomainLookupByID(virConnectPtr conn,
virDomainPtr dom = NULL;
openvzDriverLock(driver);
- vm = virDomainFindByID(&driver->domains, id);
+ vm = virDomainObjListFindByID(driver->domains, id);
openvzDriverUnlock(driver);
if (!vm) {
@@ -313,7 +312,7 @@ static char *openvzGetOSType(virDomainPtr dom)
char *ret = NULL;
openvzDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!vm) {
@@ -338,7 +337,7 @@ static virDomainPtr openvzDomainLookupByUUID(virConnectPtr conn,
virDomainPtr dom = NULL;
openvzDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, uuid);
openvzDriverUnlock(driver);
if (!vm) {
@@ -363,7 +362,7 @@ static virDomainPtr openvzDomainLookupByName(virConnectPtr conn,
virDomainPtr dom = NULL;
openvzDriverLock(driver);
- vm = virDomainFindByName(&driver->domains, name);
+ vm = virDomainObjListFindByName(driver->domains, name);
openvzDriverUnlock(driver);
if (!vm) {
@@ -389,7 +388,7 @@ static int openvzDomainGetInfo(virDomainPtr dom,
int ret = -1;
openvzDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!vm) {
@@ -437,7 +436,7 @@ openvzDomainGetState(virDomainPtr dom,
virCheckFlags(0, -1);
openvzDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!vm) {
@@ -462,7 +461,7 @@ static int openvzDomainIsActive(virDomainPtr dom)
int ret = -1;
openvzDriverLock(driver);
- obj = virDomainFindByUUID(&driver->domains, dom->uuid);
+ obj = virDomainObjListFindByUUID(driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!obj) {
virReportError(VIR_ERR_NO_DOMAIN, NULL);
@@ -484,7 +483,7 @@ static int openvzDomainIsPersistent(virDomainPtr dom)
int ret = -1;
openvzDriverLock(driver);
- obj = virDomainFindByUUID(&driver->domains, dom->uuid);
+ obj = virDomainObjListFindByUUID(driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!obj) {
virReportError(VIR_ERR_NO_DOMAIN, NULL);
@@ -511,7 +510,7 @@ static char *openvzDomainGetXMLDesc(virDomainPtr dom, unsigned int
flags) {
/* Flags checked by virDomainDefFormat */
openvzDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!vm) {
@@ -555,7 +554,7 @@ static int openvzDomainSuspend(virDomainPtr dom) {
int ret = -1;
openvzDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!vm) {
@@ -593,7 +592,7 @@ static int openvzDomainResume(virDomainPtr dom) {
int ret = -1;
openvzDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!vm) {
@@ -636,7 +635,7 @@ openvzDomainShutdownFlags(virDomainPtr dom,
virCheckFlags(0, -1);
openvzDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!vm) {
@@ -687,7 +686,7 @@ static int openvzDomainReboot(virDomainPtr dom,
virCheckFlags(0, -1);
openvzDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!vm) {
@@ -961,15 +960,16 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
VIR_DOMAIN_XML_INACTIVE)) == NULL)
goto cleanup;
- vm = virDomainFindByName(&driver->domains, vmdef->name);
+ vm = virDomainObjListFindByName(driver->domains, vmdef->name);
if (vm) {
virReportError(VIR_ERR_OPERATION_FAILED,
_("Already an OPENVZ VM active with the id
'%s'"),
vmdef->name);
goto cleanup;
}
- if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains, vmdef, false)))
+ if (!(vm = virDomainObjListAdd(driver->domains,
+ driver->caps,
+ vmdef, false)))
goto cleanup;
vmdef = NULL;
vm->persistent = 1;
@@ -1047,15 +1047,16 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
VIR_DOMAIN_XML_INACTIVE)) == NULL)
goto cleanup;
- vm = virDomainFindByName(&driver->domains, vmdef->name);
+ vm = virDomainObjListFindByName(driver->domains, vmdef->name);
if (vm) {
virReportError(VIR_ERR_OPERATION_FAILED,
_("Already an OPENVZ VM defined with the id
'%s'"),
vmdef->name);
goto cleanup;
}
- if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains, vmdef, false)))
+ if (!(vm = virDomainObjListAdd(driver->domains,
+ driver->caps,
+ vmdef, false)))
goto cleanup;
vmdef = NULL;
/* All OpenVZ domains seem to be persistent - this is a bit of a violation
@@ -1126,7 +1127,7 @@ openvzDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
virCheckFlags(0, -1);
openvzDriverLock(driver);
- vm = virDomainFindByName(&driver->domains, dom->name);
+ vm = virDomainObjListFindByName(driver->domains, dom->name);
openvzDriverUnlock(driver);
if (!vm) {
@@ -1180,7 +1181,7 @@ openvzDomainUndefineFlags(virDomainPtr dom,
virCheckFlags(0, -1);
openvzDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
@@ -1198,7 +1199,7 @@ openvzDomainUndefineFlags(virDomainPtr dom,
if (virDomainObjIsActive(vm)) {
vm->persistent = 0;
} else {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
@@ -1227,7 +1228,7 @@ openvzDomainSetAutostart(virDomainPtr dom, int autostart)
int ret = -1;
openvzDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!vm) {
@@ -1257,7 +1258,7 @@ openvzDomainGetAutostart(virDomainPtr dom, int *autostart)
int ret = -1;
openvzDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!vm) {
@@ -1352,7 +1353,7 @@ static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int
nvcpus,
}
openvzDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!vm) {
@@ -1439,7 +1440,7 @@ static virDrvOpenStatus openvzOpen(virConnectPtr conn,
return VIR_DRV_OPEN_ERROR;
}
- if (virDomainObjListInit(&driver->domains) < 0)
+ if (!(driver->domains = virDomainObjListNew()))
goto cleanup;
if (!(driver->caps = openvzCapsInit()))
@@ -1548,7 +1549,7 @@ static int openvzNumDomains(virConnectPtr conn) {
int n;
openvzDriverLock(driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 1);
+ n = virDomainObjListNumOfDomains(driver->domains, 1);
openvzDriverUnlock(driver);
return n;
@@ -1662,7 +1663,7 @@ static int openvzNumDefinedDomains(virConnectPtr conn) {
int n;
openvzDriverLock(driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 0);
+ n = virDomainObjListNumOfDomains(driver->domains, 0);
openvzDriverUnlock(driver);
return n;
@@ -1951,7 +1952,7 @@ openvzDomainInterfaceStats(virDomainPtr dom,
int ret = -1;
openvzDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
openvzDriverUnlock(driver);
if (!vm) {
@@ -2052,7 +2053,7 @@ openvzDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml,
VIR_DOMAIN_DEVICE_MODIFY_CONFIG, -1);
openvzDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN, "%s",
@@ -2105,7 +2106,7 @@ openvzListAllDomains(virConnectPtr conn,
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
openvzDriverLock(driver);
- ret = virDomainList(conn, driver->domains.objs, domains, flags);
+ ret = virDomainObjListExport(driver->domains, conn, domains, flags);
openvzDriverUnlock(driver);
return ret;
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 9c88d71..6f3e995 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -830,8 +830,9 @@ parallelsLoadDomain(parallelsConnPtr privconn, virJSONValuePtr jobj)
if (parallelsAddVNCInfo(def, jobj) < 0)
goto cleanup;
- if (!(dom = virDomainAssignDef(privconn->caps,
- &privconn->domains, def, false)))
+ if (!(dom = virDomainObjListAdd(privconn->domains,
+ privconn->caps,
+ def, false)))
goto cleanup;
/* dom is locked here */
@@ -928,7 +929,7 @@ parallelsOpenDefault(virConnectPtr conn)
if (!(privconn->caps = parallelsBuildCapabilities()))
goto error;
- if (virDomainObjListInit(&privconn->domains) < 0)
+ if (!(privconn->domains = virDomainObjListNew()))
goto error;
conn->privateData = privconn;
@@ -939,7 +940,7 @@ parallelsOpenDefault(virConnectPtr conn)
return VIR_DRV_OPEN_SUCCESS;
error:
- virDomainObjListDeinit(&privconn->domains);
+ virDomainObjListFree(privconn->domains);
virCapabilitiesFree(privconn->caps);
virStoragePoolObjListFree(&privconn->pools);
VIR_FREE(privconn);
@@ -986,7 +987,7 @@ parallelsClose(virConnectPtr conn)
parallelsDriverLock(privconn);
virCapabilitiesFree(privconn->caps);
- virDomainObjListDeinit(&privconn->domains);
+ virDomainObjListFree(privconn->domains);
conn->privateData = NULL;
parallelsDriverUnlock(privconn);
@@ -1049,7 +1050,7 @@ parallelsListDomains(virConnectPtr conn, int *ids, int maxids)
int n;
parallelsDriverLock(privconn);
- n = virDomainObjListGetActiveIDs(&privconn->domains, ids, maxids);
+ n = virDomainObjListGetActiveIDs(privconn->domains, ids, maxids);
parallelsDriverUnlock(privconn);
return n;
@@ -1062,7 +1063,7 @@ parallelsNumOfDomains(virConnectPtr conn)
int count;
parallelsDriverLock(privconn);
- count = virDomainObjListNumOfDomains(&privconn->domains, 1);
+ count = virDomainObjListNumOfDomains(privconn->domains, 1);
parallelsDriverUnlock(privconn);
return count;
@@ -1076,7 +1077,7 @@ parallelsListDefinedDomains(virConnectPtr conn, char **const names,
int maxnames
parallelsDriverLock(privconn);
memset(names, 0, sizeof(*names) * maxnames);
- n = virDomainObjListGetInactiveNames(&privconn->domains, names,
+ n = virDomainObjListGetInactiveNames(privconn->domains, names,
maxnames);
parallelsDriverUnlock(privconn);
@@ -1090,7 +1091,7 @@ parallelsNumOfDefinedDomains(virConnectPtr conn)
int count;
parallelsDriverLock(privconn);
- count = virDomainObjListNumOfDomains(&privconn->domains, 0);
+ count = virDomainObjListNumOfDomains(privconn->domains, 0);
parallelsDriverUnlock(privconn);
return count;
@@ -1106,7 +1107,7 @@ parallelsListAllDomains(virConnectPtr conn,
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
parallelsDriverLock(privconn);
- ret = virDomainList(conn, privconn->domains.objs, domains, flags);
+ ret = virDomainObjListExport(privconn->domains, conn, domains, flags);
parallelsDriverUnlock(privconn);
return ret;
@@ -1120,7 +1121,7 @@ parallelsLookupDomainByID(virConnectPtr conn, int id)
virDomainObjPtr dom;
parallelsDriverLock(privconn);
- dom = virDomainFindByID(&privconn->domains, id);
+ dom = virDomainObjListFindByID(privconn->domains, id);
parallelsDriverUnlock(privconn);
if (dom == NULL) {
@@ -1146,7 +1147,7 @@ parallelsLookupDomainByUUID(virConnectPtr conn, const unsigned char
*uuid)
virDomainObjPtr dom;
parallelsDriverLock(privconn);
- dom = virDomainFindByUUID(&privconn->domains, uuid);
+ dom = virDomainObjListFindByUUID(privconn->domains, uuid);
parallelsDriverUnlock(privconn);
if (dom == NULL) {
@@ -1175,7 +1176,7 @@ parallelsLookupDomainByName(virConnectPtr conn, const char *name)
virDomainObjPtr dom;
parallelsDriverLock(privconn);
- dom = virDomainFindByName(&privconn->domains, name);
+ dom = virDomainObjListFindByName(privconn->domains, name);
parallelsDriverUnlock(privconn);
if (dom == NULL) {
@@ -1202,7 +1203,7 @@ parallelsGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info)
int ret = -1;
parallelsDriverLock(privconn);
- privdom = virDomainFindByUUID(&privconn->domains, domain->uuid);
+ privdom = virDomainObjListFindByUUID(privconn->domains, domain->uuid);
parallelsDriverUnlock(privconn);
if (privdom == NULL) {
@@ -1232,7 +1233,7 @@ parallelsGetOSType(virDomainPtr domain)
char *ret = NULL;
parallelsDriverLock(privconn);
- privdom = virDomainFindByUUID(&privconn->domains, domain->uuid);
+ privdom = virDomainObjListFindByUUID(privconn->domains, domain->uuid);
if (privdom == NULL) {
parallelsDomNotFoundError(domain);
goto cleanup;
@@ -1256,7 +1257,7 @@ parallelsDomainIsPersistent(virDomainPtr domain)
int ret = -1;
parallelsDriverLock(privconn);
- privdom = virDomainFindByUUID(&privconn->domains, domain->uuid);
+ privdom = virDomainObjListFindByUUID(privconn->domains, domain->uuid);
if (privdom == NULL) {
parallelsDomNotFoundError(domain);
goto cleanup;
@@ -1281,7 +1282,7 @@ parallelsDomainGetState(virDomainPtr domain,
virCheckFlags(0, -1);
parallelsDriverLock(privconn);
- privdom = virDomainFindByUUID(&privconn->domains, domain->uuid);
+ privdom = virDomainObjListFindByUUID(privconn->domains, domain->uuid);
parallelsDriverUnlock(privconn);
if (privdom == NULL) {
@@ -1309,7 +1310,7 @@ parallelsDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
/* Flags checked by virDomainDefFormat */
parallelsDriverLock(privconn);
- privdom = virDomainFindByUUID(&privconn->domains, domain->uuid);
+ privdom = virDomainObjListFindByUUID(privconn->domains, domain->uuid);
parallelsDriverUnlock(privconn);
if (privdom == NULL) {
@@ -1336,7 +1337,7 @@ parallelsDomainGetAutostart(virDomainPtr domain, int *autostart)
int ret = -1;
parallelsDriverLock(privconn);
- privdom = virDomainFindByUUID(&privconn->domains, domain->uuid);
+ privdom = virDomainObjListFindByUUID(privconn->domains, domain->uuid);
parallelsDriverUnlock(privconn);
if (privdom == NULL) {
@@ -1368,7 +1369,7 @@ parallelsDomainChangeState(virDomainPtr domain,
int ret = -1;
parallelsDriverLock(privconn);
- privdom = virDomainFindByUUID(&privconn->domains, domain->uuid);
+ privdom = virDomainObjListFindByUUID(privconn->domains, domain->uuid);
parallelsDriverUnlock(privconn);
if (privdom == NULL) {
@@ -2334,13 +2335,13 @@ parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
goto cleanup;
}
- if ((dupVM = virDomainObjIsDuplicate(&privconn->domains, def, 0)) < 0) {
+ if ((dupVM = virDomainObjListIsDuplicate(privconn->domains, def, 0)) < 0) {
virReportError(VIR_ERR_INVALID_ARG, "%s", _("Already
exists"));
goto cleanup;
}
if (dupVM == 1) {
- olddom = virDomainFindByUUID(&privconn->domains, def->uuid);
+ olddom = virDomainObjListFindByUUID(privconn->domains, def->uuid);
} else {
if (STREQ(def->os.type, "hvm")) {
if (parallelsCreateVm(conn, def))
@@ -2355,7 +2356,7 @@ parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
}
if (parallelsLoadDomains(privconn, def->name))
goto cleanup;
- olddom = virDomainFindByName(&privconn->domains, def->name);
+ olddom = virDomainObjListFindByName(privconn->domains, def->name);
if (!olddom) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Domain for '%s' is not defined after
creation"),
@@ -2370,8 +2371,9 @@ parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
}
virObjectUnlock(olddom);
- if (!(dom = virDomainAssignDef(privconn->caps,
- &privconn->domains, def, false))) {
+ if (!(dom = virDomainObjListAdd(privconn->domains,
+ privconn->caps,
+ def, false))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Can't allocate domobj"));
goto cleanup;
diff --git a/src/parallels/parallels_storage.c b/src/parallels/parallels_storage.c
index 34911a4..612168e 100644
--- a/src/parallels/parallels_storage.c
+++ b/src/parallels/parallels_storage.c
@@ -458,7 +458,7 @@ static int parallelsLoadPools(virConnectPtr conn)
data.conn = conn;
data.failed = false;
- virHashForEach(privconn->domains.objs, parallelsPoolsAdd, &data);
+ virHashForEach(privconn->domains->objs, parallelsPoolsAdd, &data);
if (data.failed)
goto error;
diff --git a/src/parallels/parallels_utils.h b/src/parallels/parallels_utils.h
index cf006e8..910cd8b 100644
--- a/src/parallels/parallels_utils.h
+++ b/src/parallels/parallels_utils.h
@@ -39,7 +39,7 @@
struct _parallelsConn {
virMutex lock;
- virDomainObjList domains;
+ virDomainObjListPtr domains;
virStoragePoolObjList pools;
virNetworkObjList networks;
virCapsPtr caps;
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 46c1892..48ad77f 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -676,7 +676,7 @@ qemuDriverCloseCallbackRun(void *payload,
*/
virUUIDFormat(uuid, uuidstr);
- if (!(dom = virDomainFindByUUID(&data->driver->domains, uuid))) {
+ if (!(dom = virDomainObjListFindByUUID(data->driver->domains, uuid))) {
VIR_DEBUG("No domain object with UUID %s", uuidstr);
return;
}
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index b9fcebf..a96ff76 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -169,7 +169,7 @@ struct _virQEMUDriver {
virStateInhibitCallback inhibitCallback;
void *inhibitOpaque;
- virDomainObjList domains;
+ virDomainObjListPtr domains;
char *qemuImgBinary;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index cc02f0e..cb031d8 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1882,7 +1882,7 @@ qemuDomainRemoveInactive(virQEMUDriverPtr driver,
VIR_WARN("unable to remove snapshot directory %s", snapDir);
VIR_FREE(snapDir);
}
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
virObjectUnref(cfg);
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f98a757..3cc7916 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -168,7 +168,7 @@ static int
qemuVMFilterRebuild(virConnectPtr conn ATTRIBUTE_UNUSED,
virHashIterator iter, void *data)
{
- virHashForEach(qemu_driver->domains.objs, iter, data);
+ virHashForEach(qemu_driver->domains->objs, iter, data);
return 0;
}
@@ -206,7 +206,7 @@ qemuDomObjFromDomainDriver(virDomainPtr domain, virQEMUDriverPtr
*drv)
char uuidstr[VIR_UUID_STRING_BUFLEN];
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, domain->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, domain->uuid);
if (!vm) {
virUUIDFormat(domain->uuid, uuidstr);
virReportError(VIR_ERR_NO_DOMAIN,
@@ -336,7 +336,7 @@ qemuAutostartDomains(virQEMUDriverPtr driver)
struct qemuAutostartData data = { driver, conn };
qemuDriverLock(driver);
- virHashForEach(driver->domains.objs, qemuAutostartDomain, &data);
+ virHashForEach(driver->domains->objs, qemuAutostartDomain, &data);
qemuDriverUnlock(driver);
if (conn)
@@ -681,8 +681,8 @@ qemuStartup(bool privileged,
/* Don't have a dom0 so start from 1 */
qemu_driver->nextvmid = 1;
- if (virDomainObjListInit(&qemu_driver->domains) < 0)
- goto out_of_memory;
+ if (!(qemu_driver->domains = virDomainObjListNew()))
+ goto error;
/* Init domain events */
qemu_driver->domainEventState = virDomainEventStateNew();
@@ -863,42 +863,42 @@ qemuStartup(bool privileged,
goto error;
/* Get all the running persistent or transient configs first */
- if (virDomainLoadAllConfigs(qemu_driver->caps,
- &qemu_driver->domains,
- cfg->stateDir,
- NULL,
- 1, QEMU_EXPECTED_VIRT_TYPES,
- NULL, NULL) < 0)
+ if (virDomainObjListLoadAllConfigs(qemu_driver->domains,
+ qemu_driver->caps,
+ cfg->stateDir,
+ NULL,
+ 1, QEMU_EXPECTED_VIRT_TYPES,
+ NULL, NULL) < 0)
goto error;
/* find the maximum ID from active and transient configs to initialize
* the driver with. This is to avoid race between autostart and reconnect
* threads */
- virHashForEach(qemu_driver->domains.objs,
+ virHashForEach(qemu_driver->domains->objs,
qemuDomainFindMaxID,
&qemu_driver->nextvmid);
- virHashForEach(qemu_driver->domains.objs, qemuDomainNetsRestart, NULL);
+ virHashForEach(qemu_driver->domains->objs, qemuDomainNetsRestart, NULL);
conn = virConnectOpen(cfg->uri);
qemuProcessReconnectAll(conn, qemu_driver);
/* Then inactive persistent configs */
- if (virDomainLoadAllConfigs(qemu_driver->caps,
- &qemu_driver->domains,
- cfg->configDir,
- cfg->autostartDir,
- 0, QEMU_EXPECTED_VIRT_TYPES,
- NULL, NULL) < 0)
+ if (virDomainObjListLoadAllConfigs(qemu_driver->domains,
+ qemu_driver->caps,
+ cfg->configDir,
+ cfg->autostartDir,
+ 0, QEMU_EXPECTED_VIRT_TYPES,
+ NULL, NULL) < 0)
goto error;
- virHashForEach(qemu_driver->domains.objs,
+ virHashForEach(qemu_driver->domains->objs,
qemuDomainSnapshotLoad,
cfg->snapshotDir);
- virHashForEach(qemu_driver->domains.objs,
+ virHashForEach(qemu_driver->domains->objs,
qemuDomainManagedSaveLoad,
qemu_driver);
@@ -959,12 +959,12 @@ qemuReload(void) {
qemuDriverLock(qemu_driver);
cfg = virQEMUDriverGetConfig(qemu_driver);
- virDomainLoadAllConfigs(qemu_driver->caps,
- &qemu_driver->domains,
- cfg->configDir,
- cfg->autostartDir,
- 0, QEMU_EXPECTED_VIRT_TYPES,
- qemuNotifyLoadDomain, qemu_driver);
+ virDomainObjListLoadAllConfigs(qemu_driver->domains,
+ qemu_driver->caps,
+ cfg->configDir,
+ cfg->autostartDir,
+ 0, QEMU_EXPECTED_VIRT_TYPES,
+ qemuNotifyLoadDomain, qemu_driver);
qemuDriverUnlock(qemu_driver);
virObjectUnref(cfg);
return 0;
@@ -1054,7 +1054,7 @@ qemuShutdown(void) {
virCapabilitiesFree(qemu_driver->caps);
qemuCapsCacheFree(qemu_driver->capsCache);
- virDomainObjListDeinit(&qemu_driver->domains);
+ virDomainObjListFree(qemu_driver->domains);
virObjectUnref(qemu_driver->remotePorts);
virSysinfoDefFree(qemu_driver->hostsysinfo);
@@ -1379,7 +1379,7 @@ static virDomainPtr qemuDomainLookupByID(virConnectPtr conn,
virDomainPtr dom = NULL;
qemuDriverLock(driver);
- vm = virDomainFindByID(&driver->domains, id);
+ vm = virDomainObjListFindByID(driver->domains, id);
qemuDriverUnlock(driver);
if (!vm) {
@@ -1404,7 +1404,7 @@ static virDomainPtr qemuDomainLookupByUUID(virConnectPtr conn,
virDomainPtr dom = NULL;
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, uuid);
qemuDriverUnlock(driver);
if (!vm) {
@@ -1431,7 +1431,7 @@ static virDomainPtr qemuDomainLookupByName(virConnectPtr conn,
virDomainPtr dom = NULL;
qemuDriverLock(driver);
- vm = virDomainFindByName(&driver->domains, name);
+ vm = virDomainObjListFindByName(driver->domains, name);
qemuDriverUnlock(driver);
if (!vm) {
@@ -1521,7 +1521,7 @@ static int qemuListDomains(virConnectPtr conn, int *ids, int nids)
{
int n;
qemuDriverLock(driver);
- n = virDomainObjListGetActiveIDs(&driver->domains, ids, nids);
+ n = virDomainObjListGetActiveIDs(driver->domains, ids, nids);
qemuDriverUnlock(driver);
return n;
@@ -1532,7 +1532,7 @@ static int qemuNumDomains(virConnectPtr conn) {
int n;
qemuDriverLock(driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 1);
+ n = virDomainObjListNumOfDomains(driver->domains, 1);
qemuDriverUnlock(driver);
return n;
@@ -1589,7 +1589,7 @@ static virDomainPtr qemuDomainCreate(virConnectPtr conn, const char
*xml,
if (virSecurityManagerVerify(driver->securityManager, def) < 0)
goto cleanup;
- if (virDomainObjIsDuplicate(&driver->domains, def, 1) < 0)
+ if (virDomainObjListIsDuplicate(driver->domains, def, 1) < 0)
goto cleanup;
if (!(caps = qemuCapsCacheLookup(driver->capsCache, def->emulator)))
@@ -1601,9 +1601,9 @@ static virDomainPtr qemuDomainCreate(virConnectPtr conn, const char
*xml,
if (qemuDomainAssignAddresses(def, caps, NULL) < 0)
goto cleanup;
- if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains,
- def, false)))
+ if (!(vm = virDomainObjListAdd(driver->domains,
+ driver->caps,
+ def, false)))
goto cleanup;
def = NULL;
@@ -1670,7 +1670,7 @@ static int qemuDomainSuspend(virDomainPtr dom) {
virQEMUDriverConfigPtr cfg = NULL;
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -1753,7 +1753,7 @@ static int qemuDomainResume(virDomainPtr dom) {
virQEMUDriverConfigPtr cfg = NULL;
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -2048,7 +2048,7 @@ qemuDomainDestroyFlags(virDomainPtr dom,
virCheckFlags(VIR_DOMAIN_DESTROY_GRACEFUL, -1);
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -2275,7 +2275,7 @@ static int qemuDomainInjectNMI(virDomainPtr domain, unsigned int
flags)
virCheckFlags(0, -1);
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, domain->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, domain->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(domain->uuid, uuidstr);
@@ -3031,7 +3031,7 @@ qemuDomainSaveFlags(virDomainPtr dom, const char *path, const char
*dxml,
}
}
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -3341,7 +3341,7 @@ static int qemuDomainCoreDump(virDomainPtr dom,
VIR_DUMP_MEMORY_ONLY, -1);
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -4525,7 +4525,7 @@ static int qemuDomainGetSecurityLabel(virDomainPtr dom,
virSecurityLabelPtr secl
int ret = -1;
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
memset(seclabel, 0, sizeof(*seclabel));
@@ -4585,7 +4585,7 @@ static int qemuDomainGetSecurityLabelList(virDomainPtr dom,
/* Protect domain data with qemu lock */
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -4985,13 +4985,13 @@ qemuDomainRestoreFlags(virConnectPtr conn,
if (fd < 0)
goto cleanup;
- if (virDomainObjIsDuplicate(&driver->domains, def, 1) < 0)
+ if (virDomainObjListIsDuplicate(driver->domains, def, 1) < 0)
goto cleanup;
- if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains,
- def, true))) {
- /* virDomainAssignDef already set the error */
+ if (!(vm = virDomainObjListAdd(driver->domains,
+ driver->caps,
+ def, true))) {
+ /* virDomainLitsAdd already set the error */
goto cleanup;
}
def = NULL;
@@ -5198,7 +5198,7 @@ static char *qemuDomainGetXMLDesc(virDomainPtr dom,
/* Flags checked by virDomainDefFormat */
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -5432,7 +5432,7 @@ static int qemuListDefinedDomains(virConnectPtr conn,
int n;
qemuDriverLock(driver);
- n = virDomainObjListGetInactiveNames(&driver->domains, names, nnames);
+ n = virDomainObjListGetInactiveNames(driver->domains, names, nnames);
qemuDriverUnlock(driver);
return n;
}
@@ -5442,7 +5442,7 @@ static int qemuNumDefinedDomains(virConnectPtr conn) {
int n;
qemuDriverLock(driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 0);
+ n = virDomainObjListNumOfDomains(driver->domains, 0);
qemuDriverUnlock(driver);
return n;
@@ -5539,7 +5539,7 @@ qemuDomainStartWithFlags(virDomainPtr dom, unsigned int flags)
VIR_DOMAIN_START_FORCE_BOOT, -1);
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -5601,7 +5601,7 @@ static virDomainPtr qemuDomainDefine(virConnectPtr conn, const char
*xml) {
if (virSecurityManagerVerify(driver->securityManager, def) < 0)
goto cleanup;
- if ((dupVM = virDomainObjIsDuplicate(&driver->domains, def, 0)) < 0)
+ if ((dupVM = virDomainObjListIsDuplicate(driver->domains, def, 0)) < 0)
goto cleanup;
if (!(caps = qemuCapsCacheLookup(driver->capsCache, def->emulator)))
@@ -5616,9 +5616,9 @@ static virDomainPtr qemuDomainDefine(virConnectPtr conn, const char
*xml) {
/* We need to differentiate two cases:
* a) updating an existing domain - must preserve previous definition
* so we can roll back if something fails
- * b) defining a brand new domain - virDomainAssignDef is just sufficient
+ * b) defining a brand new domain - virDomainObjListAdd is just sufficient
*/
- if ((vm = virDomainFindByUUID(&driver->domains, def->uuid))) {
+ if ((vm = virDomainObjListFindByUUID(driver->domains, def->uuid))) {
if (virDomainObjIsActive(vm)) {
def_backup = vm->newDef;
vm->newDef = def;
@@ -5627,9 +5627,9 @@ static virDomainPtr qemuDomainDefine(virConnectPtr conn, const char
*xml) {
vm->def = def;
}
} else {
- if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains,
- def, false))) {
+ if (!(vm = virDomainObjListAdd(driver->domains,
+ driver->caps,
+ def, false))) {
goto cleanup;
}
}
@@ -5702,7 +5702,7 @@ qemuDomainUndefineFlags(virDomainPtr dom,
qemuDriverLock(driver);
cfg = virQEMUDriverGetConfig(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -6428,7 +6428,7 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
affect = flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG);
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -6629,7 +6629,7 @@ static int qemuDomainSetAutostart(virDomainPtr dom,
virQEMUDriverConfigPtr cfg = NULL;
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
cfg = virQEMUDriverGetConfig(driver);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -6910,7 +6910,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
return -1;
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (vm == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("No such domain %s"), dom->uuid);
@@ -7065,7 +7065,7 @@ qemuDomainGetBlkioParameters(virDomainPtr dom,
* that can't parse it. */
flags &= ~VIR_TYPED_PARAM_STRING_OKAY;
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (vm == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -7261,7 +7261,7 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (vm == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -7421,7 +7421,7 @@ qemuDomainGetMemoryParameters(virDomainPtr dom,
/* We don't return strings, and thus trivially support this flag. */
flags &= ~VIR_TYPED_PARAM_STRING_OKAY;
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (vm == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -7584,7 +7584,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (vm == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -7736,7 +7736,7 @@ qemuDomainGetNumaParameters(virDomainPtr dom,
* that can't parse it. */
flags &= ~VIR_TYPED_PARAM_STRING_OKAY;
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (vm == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -7942,7 +7942,7 @@ qemuSetSchedulerParametersFlags(virDomainPtr dom,
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (vm == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -8228,7 +8228,7 @@ qemuGetSchedulerParametersFlags(virDomainPtr dom,
cpu_bw_status = !!rc;
}
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (vm == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -8759,7 +8759,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
return -1;
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (vm == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -8925,7 +8925,7 @@ qemuDomainGetInterfaceParameters(virDomainPtr dom,
flags &= ~VIR_TYPED_PARAM_STRING_OKAY;
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (vm == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -9589,7 +9589,7 @@ qemuDomainMigratePerform(virDomainPtr dom,
goto cleanup;
}
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -9637,7 +9637,7 @@ qemuDomainMigrateFinish2(virConnectPtr dconn,
virCheckFlags(QEMU_MIGRATION_FLAGS, NULL);
qemuDriverLock(driver);
- vm = virDomainFindByName(&driver->domains, dname);
+ vm = virDomainObjListFindByName(driver->domains, dname);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching name '%s'"), dname);
@@ -9679,7 +9679,7 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
virCheckFlags(QEMU_MIGRATION_FLAGS, NULL);
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, domain->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, domain->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(domain->uuid, uuidstr);
@@ -9866,7 +9866,7 @@ qemuDomainMigratePerform3(virDomainPtr dom,
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -9905,7 +9905,7 @@ qemuDomainMigrateFinish3(virConnectPtr dconn,
virCheckFlags(QEMU_MIGRATION_FLAGS, NULL);
qemuDriverLock(driver);
- vm = virDomainFindByName(&driver->domains, dname);
+ vm = virDomainObjListFindByName(driver->domains, dname);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching name '%s'"), dname);
@@ -9938,7 +9938,7 @@ qemuDomainMigrateConfirm3(virDomainPtr domain,
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, domain->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, domain->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(domain->uuid, uuidstr);
@@ -11350,7 +11350,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
qemuDriverLock(driver);
virUUIDFormat(domain->uuid, uuidstr);
- vm = virDomainFindByUUID(&driver->domains, domain->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, domain->uuid);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"),
uuidstr);
@@ -12053,7 +12053,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr
snapshot,
qemuDriverLock(driver);
virUUIDFormat(snapshot->domain->uuid, uuidstr);
- vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, snapshot->domain->uuid);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"),
uuidstr);
@@ -12420,7 +12420,7 @@ static int qemuDomainSnapshotDelete(virDomainSnapshotPtr
snapshot,
qemuDriverLock(driver);
virUUIDFormat(snapshot->domain->uuid, uuidstr);
- vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, snapshot->domain->uuid);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"),
uuidstr);
@@ -12610,7 +12610,7 @@ static virDomainPtr qemuDomainAttach(virConnectPtr conn,
if (!(caps = qemuCapsCacheLookup(driver->capsCache, def->emulator)))
goto cleanup;
- if (virDomainObjIsDuplicate(&driver->domains, def, 1) < 0)
+ if (virDomainObjListIsDuplicate(driver->domains, def, 1) < 0)
goto cleanup;
if (qemuCanonicalizeMachine(def, caps) < 0)
@@ -12619,9 +12619,9 @@ static virDomainPtr qemuDomainAttach(virConnectPtr conn,
if (qemuDomainAssignAddresses(def, caps, NULL) < 0)
goto cleanup;
- if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains,
- def, false)))
+ if (!(vm = virDomainObjListAdd(driver->domains,
+ driver->caps,
+ def, false)))
goto cleanup;
def = NULL;
@@ -13022,7 +13022,7 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const
char *base,
qemuDriverLock(driver);
virUUIDFormat(dom->uuid, uuidstr);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"),
uuidstr);
@@ -13580,7 +13580,7 @@ qemuDomainOpenGraphics(virDomainPtr dom,
qemuDriverLock(driver);
virUUIDFormat(dom->uuid, uuidstr);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"),
uuidstr);
@@ -13676,7 +13676,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
qemuDriverLock(driver);
virUUIDFormat(dom->uuid, uuidstr);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"),
uuidstr);
@@ -13834,7 +13834,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
qemuDriverLock(driver);
virUUIDFormat(dom->uuid, uuidstr);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"),
uuidstr);
@@ -14411,7 +14411,7 @@ qemuDomainGetCPUStats(virDomainPtr domain,
qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, domain->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, domain->uuid);
if (vm == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("No such domain %s"), domain->uuid);
@@ -14608,7 +14608,7 @@ qemuListAllDomains(virConnectPtr conn,
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
qemuDriverLock(driver);
- ret = virDomainList(conn, driver->domains.objs, domains, flags);
+ ret = virDomainObjListExport(driver->domains, conn, domains, flags);
qemuDriverUnlock(driver);
return ret;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index f4aa9a2..5e10876 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1639,12 +1639,12 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
}
}
- if (virDomainObjIsDuplicate(&driver->domains, def, 1) < 0)
+ if (virDomainObjListIsDuplicate(driver->domains, def, 1) < 0)
goto cleanup;
- if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains,
- def, true))) {
+ if (!(vm = virDomainObjListAdd(driver->domains,
+ driver->caps,
+ def, true))) {
/* virDomainAssignDef already set the error */
goto cleanup;
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d1d3d95..bc2a6de 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3446,7 +3446,7 @@ void
qemuProcessReconnectAll(virConnectPtr conn, virQEMUDriverPtr driver)
{
struct qemuProcessReconnectData data = {.conn = conn, .driver = driver};
- virHashForEach(driver->domains.objs, qemuProcessReconnectHelper, &data);
+ virHashForEach(driver->domains->objs, qemuProcessReconnectHelper, &data);
}
int
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index ddc4110..505570f 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -83,7 +83,7 @@ struct _testConn {
int nextDomID;
virCapsPtr caps;
virNodeInfo nodeInfo;
- virDomainObjList domains;
+ virDomainObjListPtr domains;
virNetworkObjList networks;
virInterfaceObjList ifaces;
bool transaction_running;
@@ -546,7 +546,7 @@ static int testOpenDefault(virConnectPtr conn) {
testDriverLock(privconn);
conn->privateData = privconn;
- if (virDomainObjListInit(&privconn->domains) < 0)
+ if (!(privconn->domains = virDomainObjListNew()))
goto error;
memmove(&privconn->nodeInfo, &defaultNodeInfo, sizeof(defaultNodeInfo));
@@ -582,8 +582,9 @@ static int testOpenDefault(virConnectPtr conn) {
if (testDomainGenerateIfnames(domdef) < 0)
goto error;
- if (!(domobj = virDomainAssignDef(privconn->caps,
- &privconn->domains, domdef, false)))
+ if (!(domobj = virDomainObjListAdd(privconn->domains,
+ privconn->caps,
+ domdef, false)))
goto error;
domdef = NULL;
@@ -645,7 +646,7 @@ static int testOpenDefault(virConnectPtr conn) {
return VIR_DRV_OPEN_SUCCESS;
error:
- virDomainObjListDeinit(&privconn->domains);
+ virDomainObjListFree(privconn->domains);
virNetworkObjListFree(&privconn->networks);
virInterfaceObjListFree(&privconn->ifaces);
virStoragePoolObjListFree(&privconn->pools);
@@ -795,7 +796,7 @@ static int testOpenFromFile(virConnectPtr conn,
testDriverLock(privconn);
conn->privateData = privconn;
- if (virDomainObjListInit(&privconn->domains) < 0)
+ if (!(privconn->domains = virDomainObjListNew()))
goto error;
if (!(privconn->caps = testBuildCapabilities(conn)))
@@ -926,8 +927,9 @@ static int testOpenFromFile(virConnectPtr conn,
}
if (testDomainGenerateIfnames(def) < 0 ||
- !(dom = virDomainAssignDef(privconn->caps,
- &privconn->domains, def, false))) {
+ !(dom = virDomainObjListAdd(privconn->domains,
+ privconn->caps,
+ def, false))) {
virDomainDefFree(def);
goto error;
}
@@ -1113,7 +1115,7 @@ static int testOpenFromFile(virConnectPtr conn,
VIR_FREE(ifaces);
VIR_FREE(pools);
VIR_FREE(devs);
- virDomainObjListDeinit(&privconn->domains);
+ virDomainObjListFree(privconn->domains);
virNetworkObjListFree(&privconn->networks);
virInterfaceObjListFree(&privconn->ifaces);
virStoragePoolObjListFree(&privconn->pools);
@@ -1182,7 +1184,7 @@ static int testClose(virConnectPtr conn)
testConnPtr privconn = conn->privateData;
testDriverLock(privconn);
virCapabilitiesFree(privconn->caps);
- virDomainObjListDeinit(&privconn->domains);
+ virDomainObjListFree(privconn->domains);
virNodeDeviceObjListFree(&privconn->devs);
virNetworkObjListFree(&privconn->networks);
virInterfaceObjListFree(&privconn->ifaces);
@@ -1253,7 +1255,7 @@ static int testNumOfDomains(virConnectPtr conn)
int count;
testDriverLock(privconn);
- count = virDomainObjListNumOfDomains(&privconn->domains, 1);
+ count = virDomainObjListNumOfDomains(privconn->domains, 1);
testDriverUnlock(privconn);
return count;
@@ -1266,7 +1268,7 @@ static int testDomainIsActive(virDomainPtr dom)
int ret = -1;
testDriverLock(privconn);
- obj = virDomainFindByUUID(&privconn->domains, dom->uuid);
+ obj = virDomainObjListFindByUUID(privconn->domains, dom->uuid);
testDriverUnlock(privconn);
if (!obj) {
virReportError(VIR_ERR_NO_DOMAIN, NULL);
@@ -1287,7 +1289,7 @@ static int testDomainIsPersistent(virDomainPtr dom)
int ret = -1;
testDriverLock(privconn);
- obj = virDomainFindByUUID(&privconn->domains, dom->uuid);
+ obj = virDomainObjListFindByUUID(privconn->domains, dom->uuid);
testDriverUnlock(privconn);
if (!obj) {
virReportError(VIR_ERR_NO_DOMAIN, NULL);
@@ -1324,13 +1326,14 @@ testDomainCreateXML(virConnectPtr conn, const char *xml,
VIR_DOMAIN_XML_INACTIVE)) == NULL)
goto cleanup;
- if (virDomainObjIsDuplicate(&privconn->domains, def, 1) < 0)
+ if (virDomainObjListIsDuplicate(privconn->domains, def, 1) < 0)
goto cleanup;
if (testDomainGenerateIfnames(def) < 0)
goto cleanup;
- if (!(dom = virDomainAssignDef(privconn->caps,
- &privconn->domains, def, false)))
+ if (!(dom = virDomainObjListAdd(privconn->domains,
+ privconn->caps,
+ def, false)))
goto cleanup;
def = NULL;
@@ -1364,7 +1367,7 @@ static virDomainPtr testLookupDomainByID(virConnectPtr conn,
virDomainObjPtr dom;
testDriverLock(privconn);
- dom = virDomainFindByID(&privconn->domains, id);
+ dom = virDomainObjListFindByID(privconn->domains, id);
testDriverUnlock(privconn);
if (dom == NULL) {
@@ -1390,7 +1393,7 @@ static virDomainPtr testLookupDomainByUUID(virConnectPtr conn,
virDomainObjPtr dom ;
testDriverLock(privconn);
- dom = virDomainFindByUUID(&privconn->domains, uuid);
+ dom = virDomainObjListFindByUUID(privconn->domains, uuid);
testDriverUnlock(privconn);
if (dom == NULL) {
@@ -1416,7 +1419,7 @@ static virDomainPtr testLookupDomainByName(virConnectPtr conn,
virDomainObjPtr dom;
testDriverLock(privconn);
- dom = virDomainFindByName(&privconn->domains, name);
+ dom = virDomainObjListFindByName(privconn->domains, name);
testDriverUnlock(privconn);
if (dom == NULL) {
@@ -1442,7 +1445,7 @@ static int testListDomains(virConnectPtr conn,
int n;
testDriverLock(privconn);
- n = virDomainObjListGetActiveIDs(&privconn->domains, ids, maxids);
+ n = virDomainObjListGetActiveIDs(privconn->domains, ids, maxids);
testDriverUnlock(privconn);
return n;
@@ -1456,8 +1459,8 @@ static int testDestroyDomain(virDomainPtr domain)
int ret = -1;
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
if (privdom == NULL) {
virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
@@ -1470,8 +1473,8 @@ static int testDestroyDomain(virDomainPtr domain)
VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
if (!privdom->persistent) {
- virDomainRemoveInactive(&privconn->domains,
- privdom);
+ virDomainObjListRemove(privconn->domains,
+ privdom);
privdom = NULL;
}
@@ -1493,8 +1496,8 @@ static int testResumeDomain(virDomainPtr domain)
int ret = -1;
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
testDriverUnlock(privconn);
if (privdom == NULL) {
@@ -1535,8 +1538,8 @@ static int testPauseDomain(virDomainPtr domain)
int state;
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
testDriverUnlock(privconn);
if (privdom == NULL) {
@@ -1580,8 +1583,8 @@ static int testShutdownDomainFlags(virDomainPtr domain,
virCheckFlags(0, -1);
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
if (privdom == NULL) {
virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
@@ -1600,8 +1603,8 @@ static int testShutdownDomainFlags(virDomainPtr domain,
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
if (!privdom->persistent) {
- virDomainRemoveInactive(&privconn->domains,
- privdom);
+ virDomainObjListRemove(privconn->domains,
+ privdom);
privdom = NULL;
}
@@ -1630,8 +1633,8 @@ static int testRebootDomain(virDomainPtr domain,
int ret = -1;
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
if (privdom == NULL) {
virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
@@ -1675,8 +1678,8 @@ static int testRebootDomain(virDomainPtr domain,
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
if (!privdom->persistent) {
- virDomainRemoveInactive(&privconn->domains,
- privdom);
+ virDomainObjListRemove(privconn->domains,
+ privdom);
privdom = NULL;
}
}
@@ -1700,8 +1703,8 @@ static int testGetDomainInfo(virDomainPtr domain,
int ret = -1;
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
testDriverUnlock(privconn);
if (privdom == NULL) {
@@ -1741,8 +1744,8 @@ testDomainGetState(virDomainPtr domain,
virCheckFlags(0, -1);
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
testDriverUnlock(privconn);
if (privdom == NULL) {
@@ -1781,8 +1784,8 @@ testDomainSaveFlags(virDomainPtr domain, const char *path,
}
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
if (privdom == NULL) {
virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
@@ -1839,8 +1842,8 @@ testDomainSaveFlags(virDomainPtr domain, const char *path,
VIR_DOMAIN_EVENT_STOPPED_SAVED);
if (!privdom->persistent) {
- virDomainRemoveInactive(&privconn->domains,
- privdom);
+ virDomainObjListRemove(privconn->domains,
+ privdom);
privdom = NULL;
}
@@ -1940,13 +1943,14 @@ testDomainRestoreFlags(virConnectPtr conn,
if (!def)
goto cleanup;
- if (virDomainObjIsDuplicate(&privconn->domains, def, 1) < 0)
+ if (virDomainObjListIsDuplicate(privconn->domains, def, 1) < 0)
goto cleanup;
if (testDomainGenerateIfnames(def) < 0)
goto cleanup;
- if (!(dom = virDomainAssignDef(privconn->caps,
- &privconn->domains, def, true)))
+ if (!(dom = virDomainObjListAdd(privconn->domains,
+ privconn->caps,
+ def, true)))
goto cleanup;
def = NULL;
@@ -1990,8 +1994,8 @@ static int testDomainCoreDump(virDomainPtr domain,
virCheckFlags(VIR_DUMP_CRASH, -1);
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
if (privdom == NULL) {
virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
@@ -2023,8 +2027,8 @@ static int testDomainCoreDump(virDomainPtr domain,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_CRASHED);
if (!privdom->persistent) {
- virDomainRemoveInactive(&privconn->domains,
- privdom);
+ virDomainObjListRemove(privconn->domains,
+ privdom);
privdom = NULL;
}
}
@@ -2053,8 +2057,8 @@ static unsigned long long testGetMaxMemory(virDomainPtr domain) {
unsigned long long ret = 0;
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
testDriverUnlock(privconn);
if (privdom == NULL) {
@@ -2078,8 +2082,8 @@ static int testSetMaxMemory(virDomainPtr domain,
int ret = -1;
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
testDriverUnlock(privconn);
if (privdom == NULL) {
@@ -2105,8 +2109,8 @@ static int testSetMemory(virDomainPtr domain,
int ret = -1;
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
testDriverUnlock(privconn);
if (privdom == NULL) {
@@ -2141,7 +2145,7 @@ testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
VIR_DOMAIN_VCPU_MAXIMUM, -1);
testDriverLock(privconn);
- vm = virDomainFindByUUID(&privconn->domains, domain->uuid);
+ vm = virDomainObjListFindByUUID(privconn->domains, domain->uuid);
testDriverUnlock(privconn);
if (!vm) {
@@ -2202,7 +2206,7 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
}
testDriverLock(privconn);
- privdom = virDomainFindByUUID(&privconn->domains, domain->uuid);
+ privdom = virDomainObjListFindByUUID(privconn->domains, domain->uuid);
testDriverUnlock(privconn);
if (privdom == NULL) {
@@ -2285,7 +2289,7 @@ static int testDomainGetVcpus(virDomainPtr domain,
unsigned long long statbase;
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains, domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains, domain->name);
testDriverUnlock(privconn);
if (privdom == NULL) {
@@ -2371,7 +2375,7 @@ static int testDomainPinVcpu(virDomainPtr domain,
int ret = -1;
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains, domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains, domain->name);
testDriverUnlock(privconn);
if (privdom == NULL) {
@@ -2425,8 +2429,8 @@ static char *testDomainGetXMLDesc(virDomainPtr domain, unsigned int
flags)
/* Flags checked by virDomainDefFormat */
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
testDriverUnlock(privconn);
if (privdom == NULL) {
@@ -2451,7 +2455,7 @@ static int testNumOfDefinedDomains(virConnectPtr conn) {
int count;
testDriverLock(privconn);
- count = virDomainObjListNumOfDomains(&privconn->domains, 0);
+ count = virDomainObjListNumOfDomains(privconn->domains, 0);
testDriverUnlock(privconn);
return count;
@@ -2466,7 +2470,7 @@ static int testListDefinedDomains(virConnectPtr conn,
testDriverLock(privconn);
memset(names, 0, sizeof(*names)*maxnames);
- n = virDomainObjListGetInactiveNames(&privconn->domains, names, maxnames);
+ n = virDomainObjListGetInactiveNames(privconn->domains, names, maxnames);
testDriverUnlock(privconn);
return n;
@@ -2487,13 +2491,14 @@ static virDomainPtr testDomainDefineXML(virConnectPtr conn,
VIR_DOMAIN_XML_INACTIVE)) == NULL)
goto cleanup;
- if ((dupVM = virDomainObjIsDuplicate(&privconn->domains, def, 0)) < 0)
+ if ((dupVM = virDomainObjListIsDuplicate(privconn->domains, def, 0)) < 0)
goto cleanup;
if (testDomainGenerateIfnames(def) < 0)
goto cleanup;
- if (!(dom = virDomainAssignDef(privconn->caps,
- &privconn->domains, def, false)))
+ if (!(dom = virDomainObjListAdd(privconn->domains,
+ privconn->caps,
+ def, false)))
goto cleanup;
def = NULL;
dom->persistent = 1;
@@ -2554,8 +2559,8 @@ static int testDomainCreateWithFlags(virDomainPtr domain, unsigned
int flags) {
virCheckFlags(0, -1);
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
if (privdom == NULL) {
virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
@@ -2602,8 +2607,8 @@ static int testDomainUndefineFlags(virDomainPtr domain,
virCheckFlags(0, -1);
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
if (privdom == NULL) {
virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
@@ -2616,8 +2621,8 @@ static int testDomainUndefineFlags(virDomainPtr domain,
if (virDomainObjIsActive(privdom)) {
privdom->persistent = 0;
} else {
- virDomainRemoveInactive(&privconn->domains,
- privdom);
+ virDomainObjListRemove(privconn->domains,
+ privdom);
privdom = NULL;
}
@@ -2645,8 +2650,8 @@ static int testDomainGetAutostart(virDomainPtr domain,
int ret = -1;
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
testDriverUnlock(privconn);
if (privdom == NULL) {
@@ -2672,8 +2677,8 @@ static int testDomainSetAutostart(virDomainPtr domain,
int ret = -1;
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
testDriverUnlock(privconn);
if (privdom == NULL) {
@@ -2718,8 +2723,8 @@ testDomainGetSchedulerParamsFlags(virDomainPtr domain,
virCheckFlags(0, -1);
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
testDriverUnlock(privconn);
if (privdom == NULL) {
@@ -2768,8 +2773,8 @@ testDomainSetSchedulerParamsFlags(virDomainPtr domain,
return -1;
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
testDriverUnlock(privconn);
if (privdom == NULL) {
@@ -2811,8 +2816,8 @@ static int testDomainBlockStats(virDomainPtr domain,
int ret = -1;
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
testDriverUnlock(privconn);
if (privdom == NULL) {
@@ -2858,8 +2863,8 @@ static int testDomainInterfaceStats(virDomainPtr domain,
int i, found = 0, ret = -1;
testDriverLock(privconn);
- privdom = virDomainFindByName(&privconn->domains,
- domain->name);
+ privdom = virDomainObjListFindByName(privconn->domains,
+ domain->name);
testDriverUnlock(privconn);
if (privdom == NULL) {
@@ -5710,7 +5715,7 @@ static int testListAllDomains(virConnectPtr conn,
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
testDriverLock(privconn);
- ret = virDomainList(conn, privconn->domains.objs, domains, flags);
+ ret = virDomainObjListExport(privconn->domains, conn, domains, flags);
testDriverUnlock(privconn);
return ret;
diff --git a/src/uml/uml_conf.h b/src/uml/uml_conf.h
index a4e264f..ff71b45 100644
--- a/src/uml/uml_conf.h
+++ b/src/uml/uml_conf.h
@@ -51,7 +51,7 @@ struct uml_driver {
unsigned long umlVersion;
int nextvmid;
- virDomainObjList domains;
+ virDomainObjListPtr domains;
size_t nactive;
char *configDir;
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 705495e..591d3e4 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -150,7 +150,7 @@ static int
umlVMFilterRebuild(virConnectPtr conn ATTRIBUTE_UNUSED,
virHashIterator iter, void *data)
{
- virHashForEach(uml_driver->domains.objs, iter, data);
+ virHashForEach(uml_driver->domains->objs, iter, data);
return 0;
}
@@ -223,7 +223,7 @@ umlAutostartConfigs(struct uml_driver *driver) {
struct umlAutostartData data = { driver, conn };
umlDriverLock(driver);
- virHashForEach(driver->domains.objs, umlAutostartDomain, &data);
+ virHashForEach(driver->domains->objs, umlAutostartDomain, &data);
umlDriverUnlock(driver);
if (conn)
@@ -336,7 +336,7 @@ reread:
name = (char *)&(e->name);
- dom = virDomainFindByName(&driver->domains, name);
+ dom = virDomainObjListFindByName(driver->domains, name);
if (!dom) {
continue;
@@ -355,8 +355,8 @@ reread:
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
if (!dom->persistent) {
- virDomainRemoveInactive(&driver->domains,
- dom);
+ virDomainObjListRemove(driver->domains,
+ dom);
dom = NULL;
}
} else if (e->mask & (IN_CREATE | IN_MODIFY)) {
@@ -389,8 +389,8 @@ reread:
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_FAILED);
if (!dom->persistent) {
- virDomainRemoveInactive(&driver->domains,
- dom);
+ virDomainObjListRemove(driver->domains,
+ dom);
dom = NULL;
}
} else if (umlIdentifyChrPTY(driver, dom) < 0) {
@@ -402,8 +402,8 @@ reread:
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_FAILED);
if (!dom->persistent) {
- virDomainRemoveInactive(&driver->domains,
- dom);
+ virDomainObjListRemove(driver->domains,
+ dom);
dom = NULL;
}
}
@@ -450,7 +450,7 @@ umlStartup(bool privileged,
uml_driver->nextvmid = 1;
uml_driver->inotifyWatch = -1;
- if (virDomainObjListInit(¨_driver->domains) < 0)
+ if (!(uml_driver->domains = virDomainObjListNew()))
goto error;
uml_driver->domainEventState = virDomainEventStateNew();
@@ -535,12 +535,12 @@ umlStartup(bool privileged,
if (umlProcessAutoDestroyInit(uml_driver) < 0)
goto error;
- if (virDomainLoadAllConfigs(uml_driver->caps,
- ¨_driver->domains,
- uml_driver->configDir,
- uml_driver->autostartDir,
- 0, 1 << VIR_DOMAIN_VIRT_UML,
- NULL, NULL) < 0)
+ if (virDomainObjListLoadAllConfigs(uml_driver->domains,
+ uml_driver->caps,
+ uml_driver->configDir,
+ uml_driver->autostartDir,
+ 0, 1 << VIR_DOMAIN_VIRT_UML,
+ NULL, NULL) < 0)
goto error;
umlDriverUnlock(uml_driver);
@@ -590,12 +590,12 @@ umlReload(void) {
return 0;
umlDriverLock(uml_driver);
- virDomainLoadAllConfigs(uml_driver->caps,
- ¨_driver->domains,
- uml_driver->configDir,
- uml_driver->autostartDir,
- 0, 1 << VIR_DOMAIN_VIRT_UML,
- umlNotifyLoadDomain, uml_driver);
+ virDomainObjListLoadAllConfigs(uml_driver->domains,
+ uml_driver->caps,
+ uml_driver->configDir,
+ uml_driver->autostartDir,
+ 0, 1 << VIR_DOMAIN_VIRT_UML,
+ umlNotifyLoadDomain, uml_driver);
umlDriverUnlock(uml_driver);
return 0;
@@ -635,9 +635,9 @@ umlShutdown(void) {
/* shutdown active VMs
* XXX allow them to stay around & reconnect */
- virHashForEach(uml_driver->domains.objs, umlShutdownOneVM, uml_driver);
+ virHashForEach(uml_driver->domains->objs, umlShutdownOneVM, uml_driver);
- virDomainObjListDeinit(¨_driver->domains);
+ virDomainObjListFree(uml_driver->domains);
virDomainEventStateFree(uml_driver->domainEventState);
@@ -690,8 +690,8 @@ static void umlProcessAutoDestroyDom(void *payload,
return;
}
- if (!(dom = virDomainFindByUUID(&data->driver->domains,
- uuid))) {
+ if (!(dom = virDomainObjListFindByUUID(data->driver->domains,
+ uuid))) {
VIR_DEBUG("No domain object to kill");
return;
}
@@ -704,7 +704,7 @@ static void umlProcessAutoDestroyDom(void *payload,
VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
if (dom && !dom->persistent)
- virDomainRemoveInactive(&data->driver->domains, dom);
+ virDomainObjListRemove(data->driver->domains, dom);
if (dom)
virObjectUnlock(dom);
@@ -1309,7 +1309,7 @@ static virDomainPtr umlDomainLookupByID(virConnectPtr conn,
virDomainPtr dom = NULL;
umlDriverLock(driver);
- vm = virDomainFindByID(&driver->domains, id);
+ vm = virDomainObjListFindByID(driver->domains, id);
umlDriverUnlock(driver);
if (!vm) {
@@ -1333,7 +1333,7 @@ static virDomainPtr umlDomainLookupByUUID(virConnectPtr conn,
virDomainPtr dom = NULL;
umlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, uuid);
umlDriverUnlock(driver);
if (!vm) {
@@ -1357,7 +1357,7 @@ static virDomainPtr umlDomainLookupByName(virConnectPtr conn,
virDomainPtr dom = NULL;
umlDriverLock(driver);
- vm = virDomainFindByName(&driver->domains, name);
+ vm = virDomainObjListFindByName(driver->domains, name);
umlDriverUnlock(driver);
if (!vm) {
@@ -1382,7 +1382,7 @@ static int umlDomainIsActive(virDomainPtr dom)
int ret = -1;
umlDriverLock(driver);
- obj = virDomainFindByUUID(&driver->domains, dom->uuid);
+ obj = virDomainObjListFindByUUID(driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!obj) {
virReportError(VIR_ERR_NO_DOMAIN, NULL);
@@ -1404,7 +1404,7 @@ static int umlDomainIsPersistent(virDomainPtr dom)
int ret = -1;
umlDriverLock(driver);
- obj = virDomainFindByUUID(&driver->domains, dom->uuid);
+ obj = virDomainObjListFindByUUID(driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!obj) {
virReportError(VIR_ERR_NO_DOMAIN, NULL);
@@ -1425,7 +1425,7 @@ static int umlDomainIsUpdated(virDomainPtr dom)
int ret = -1;
umlDriverLock(driver);
- obj = virDomainFindByUUID(&driver->domains, dom->uuid);
+ obj = virDomainObjListFindByUUID(driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!obj) {
virReportError(VIR_ERR_NO_DOMAIN, NULL);
@@ -1469,7 +1469,7 @@ static int umlListDomains(virConnectPtr conn, int *ids, int nids) {
int n;
umlDriverLock(driver);
- n = virDomainObjListGetActiveIDs(&driver->domains, ids, nids);
+ n = virDomainObjListGetActiveIDs(driver->domains, ids, nids);
umlDriverUnlock(driver);
return n;
@@ -1479,7 +1479,7 @@ static int umlNumDomains(virConnectPtr conn) {
int n;
umlDriverLock(driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 1);
+ n = virDomainObjListNumOfDomains(driver->domains, 1);
umlDriverUnlock(driver);
return n;
@@ -1500,20 +1500,20 @@ static virDomainPtr umlDomainCreate(virConnectPtr conn, const char
*xml,
VIR_DOMAIN_XML_INACTIVE)))
goto cleanup;
- if (virDomainObjIsDuplicate(&driver->domains, def, 1) < 0)
+ if (virDomainObjListIsDuplicate(driver->domains, def, 1) < 0)
goto cleanup;
- if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains,
- def, false)))
+ if (!(vm = virDomainObjListAdd(driver->domains,
+ driver->caps,
+ def, false)))
goto cleanup;
def = NULL;
if (umlStartVMDaemon(conn, driver, vm,
(flags & VIR_DOMAIN_START_AUTODESTROY)) < 0) {
virDomainAuditStart(vm, "booted", false);
- virDomainRemoveInactive(&driver->domains,
- vm);
+ virDomainObjListRemove(driver->domains,
+ vm);
vm = NULL;
goto cleanup;
}
@@ -1546,7 +1546,7 @@ static int umlDomainShutdownFlags(virDomainPtr dom,
virCheckFlags(0, -1);
umlDriverLock(driver);
- vm = virDomainFindByID(&driver->domains, dom->id);
+ vm = virDomainObjListFindByID(driver->domains, dom->id);
umlDriverUnlock(driver);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN,
@@ -1588,7 +1588,7 @@ umlDomainDestroyFlags(virDomainPtr dom,
virCheckFlags(0, -1);
umlDriverLock(driver);
- vm = virDomainFindByID(&driver->domains, dom->id);
+ vm = virDomainObjListFindByID(driver->domains, dom->id);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching id %d"), dom->id);
@@ -1601,8 +1601,8 @@ umlDomainDestroyFlags(virDomainPtr dom,
VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
if (!vm->persistent) {
- virDomainRemoveInactive(&driver->domains,
- vm);
+ virDomainObjListRemove(driver->domains,
+ vm);
vm = NULL;
}
ret = 0;
@@ -1629,7 +1629,7 @@ static char *umlDomainGetOSType(virDomainPtr dom) {
char *type = NULL;
umlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN, "%s",
@@ -1655,7 +1655,7 @@ umlDomainGetMaxMemory(virDomainPtr dom)
unsigned long long ret = 0;
umlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!vm) {
@@ -1680,7 +1680,7 @@ static int umlDomainSetMaxMemory(virDomainPtr dom, unsigned long
newmax) {
int ret = -1;
umlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!vm) {
@@ -1713,7 +1713,7 @@ static int umlDomainSetMemory(virDomainPtr dom, unsigned long
newmem) {
int ret = -1;
umlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!vm) {
@@ -1753,7 +1753,7 @@ static int umlDomainGetInfo(virDomainPtr dom,
int ret = -1;
umlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!vm) {
@@ -1799,7 +1799,7 @@ umlDomainGetState(virDomainPtr dom,
virCheckFlags(0, -1);
umlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!vm) {
@@ -1828,7 +1828,7 @@ static char *umlDomainGetXMLDesc(virDomainPtr dom,
/* Flags checked by virDomainDefFormat */
umlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!vm) {
@@ -1854,7 +1854,7 @@ static int umlListDefinedDomains(virConnectPtr conn,
int n;
umlDriverLock(driver);
- n = virDomainObjListGetInactiveNames(&driver->domains, names, nnames);
+ n = virDomainObjListGetInactiveNames(driver->domains, names, nnames);
umlDriverUnlock(driver);
return n;
@@ -1865,7 +1865,7 @@ static int umlNumDefinedDomains(virConnectPtr conn) {
int n;
umlDriverLock(driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 0);
+ n = virDomainObjListNumOfDomains(driver->domains, 0);
umlDriverUnlock(driver);
return n;
@@ -1881,7 +1881,7 @@ static int umlDomainStartWithFlags(virDomainPtr dom, unsigned int
flags) {
virCheckFlags(VIR_DOMAIN_START_AUTODESTROY, -1);
umlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN, "%s",
@@ -1922,20 +1922,20 @@ static virDomainPtr umlDomainDefine(virConnectPtr conn, const char
*xml) {
VIR_DOMAIN_XML_INACTIVE)))
goto cleanup;
- if (virDomainObjIsDuplicate(&driver->domains, def, 0) < 0)
+ if (virDomainObjListIsDuplicate(driver->domains, def, 0) < 0)
goto cleanup;
- if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains,
- def, false)))
+ if (!(vm = virDomainObjListAdd(driver->domains,
+ driver->caps,
+ def, false)))
goto cleanup;
def = NULL;
vm->persistent = 1;
if (virDomainSaveConfig(driver->configDir,
vm->newDef ? vm->newDef : vm->def) < 0) {
- virDomainRemoveInactive(&driver->domains,
- vm);
+ virDomainObjListRemove(driver->domains,
+ vm);
vm = NULL;
goto cleanup;
}
@@ -1961,7 +1961,7 @@ static int umlDomainUndefineFlags(virDomainPtr dom,
virCheckFlags(0, -1);
umlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid"));
@@ -1980,7 +1980,7 @@ static int umlDomainUndefineFlags(virDomainPtr dom,
if (virDomainObjIsActive(vm)) {
vm->persistent = 0;
} else {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
@@ -2059,7 +2059,7 @@ static int umlDomainAttachDevice(virDomainPtr dom, const char *xml)
umlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -2177,7 +2177,7 @@ static int umlDomainDetachDevice(virDomainPtr dom, const char *xml)
{
int ret = -1;
umlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -2243,7 +2243,7 @@ static int umlDomainGetAutostart(virDomainPtr dom,
int ret = -1;
umlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN, "%s",
@@ -2269,7 +2269,7 @@ static int umlDomainSetAutostart(virDomainPtr dom,
int ret = -1;
umlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN, "%s",
@@ -2343,7 +2343,7 @@ umlDomainBlockPeek(virDomainPtr dom,
virCheckFlags(0, -1);
umlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!vm) {
@@ -2412,7 +2412,7 @@ umlDomainOpenConsole(virDomainPtr dom,
umlDriverLock(driver);
virUUIDFormat(dom->uuid, uuidstr);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"),
uuidstr);
@@ -2557,7 +2557,7 @@ static int umlListAllDomains(virConnectPtr conn,
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
umlDriverLock(driver);
- ret = virDomainList(conn, driver->domains.objs, domains, flags);
+ ret = virDomainObjListExport(driver->domains, conn, domains, flags);
umlDriverUnlock(driver);
return ret;
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index e8a66de..d2afce3 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -43,7 +43,7 @@ vmwareFreeDriver(struct vmware_driver *driver)
return;
virMutexDestroy(&driver->lock);
- virDomainObjListDeinit(&driver->domains);
+ virDomainObjListFree(driver->domains);
virCapabilitiesFree(driver->caps);
VIR_FREE(driver);
}
@@ -177,8 +177,9 @@ vmwareLoadDomains(struct vmware_driver *driver)
goto cleanup;
}
- if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains, vmdef, false)))
+ if (!(vm = virDomainObjListAdd(driver->domains,
+ driver->caps,
+ vmdef, false)))
goto cleanup;
pDomain = vm->privateData;
diff --git a/src/vmware/vmware_conf.h b/src/vmware/vmware_conf.h
index 22d5240..6ab985e 100644
--- a/src/vmware/vmware_conf.h
+++ b/src/vmware/vmware_conf.h
@@ -37,7 +37,7 @@ struct vmware_driver {
virMutex lock;
virCapsPtr caps;
- virDomainObjList domains;
+ virDomainObjListPtr domains;
int version;
int type;
};
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index 5c0e9ca..3b2d1e5 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -128,7 +128,7 @@ vmwareOpen(virConnectPtr conn,
driver->type = STRNEQ(conn->uri->scheme, "vmwareplayer") ?
TYPE_WORKSTATION : TYPE_PLAYER;
- if (virDomainObjListInit(&driver->domains) < 0)
+ if (!(driver->domains = virDomainObjListNew()))
goto cleanup;
if (!(driver->caps = vmwareCapsInit()))
@@ -320,7 +320,7 @@ vmwareDomainDefineXML(virConnectPtr conn, const char *xml)
VIR_DOMAIN_XML_INACTIVE)) == NULL)
goto cleanup;
- if (virDomainObjIsDuplicate(&driver->domains, vmdef, 1) < 0)
+ if (virDomainObjListIsDuplicate(driver->domains, vmdef, 1) < 0)
goto cleanup;
/* generate vmx file */
@@ -339,8 +339,9 @@ vmwareDomainDefineXML(virConnectPtr conn, const char *xml)
}
/* assign def */
- if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains, vmdef, false)))
+ if (!(vm = virDomainObjListAdd(driver->domains,
+ driver->caps,
+ vmdef, false)))
goto cleanup;
pDomain = vm->privateData;
@@ -382,7 +383,7 @@ vmwareDomainShutdownFlags(virDomainPtr dom,
vmwareDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN, "%s",
@@ -403,7 +404,7 @@ vmwareDomainShutdownFlags(virDomainPtr dom,
goto cleanup;
if (!vm->persistent) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
@@ -441,7 +442,7 @@ vmwareDomainSuspend(virDomainPtr dom)
}
vmwareDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
vmwareDriverUnlock(driver);
if (!vm) {
@@ -490,7 +491,7 @@ vmwareDomainResume(virDomainPtr dom)
}
vmwareDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
vmwareDriverUnlock(driver);
if (!vm) {
@@ -534,7 +535,7 @@ vmwareDomainReboot(virDomainPtr dom, unsigned int flags)
virCheckFlags(0, -1);
vmwareDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
vmwareDriverUnlock(driver);
if (!vm) {
@@ -591,7 +592,7 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml,
VIR_DOMAIN_XML_INACTIVE)) == NULL)
goto cleanup;
- if (virDomainObjIsDuplicate(&driver->domains, vmdef, 1) < 0)
+ if (virDomainObjListIsDuplicate(driver->domains, vmdef, 1) < 0)
goto cleanup;
/* generate vmx file */
@@ -610,8 +611,9 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml,
}
/* assign def */
- if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains, vmdef, false)))
+ if (!(vm = virDomainObjListAdd(driver->domains,
+ driver->caps,
+ vmdef, false)))
goto cleanup;
pDomain = vm->privateData;
@@ -621,7 +623,7 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml,
vmdef = NULL;
if (vmwareStartVM(driver, vm) < 0) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
goto cleanup;
}
@@ -651,7 +653,7 @@ vmwareDomainCreateWithFlags(virDomainPtr dom,
virCheckFlags(0, -1);
vmwareDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
@@ -695,7 +697,7 @@ vmwareDomainUndefineFlags(virDomainPtr dom,
virCheckFlags(0, -1);
vmwareDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -718,7 +720,7 @@ vmwareDomainUndefineFlags(virDomainPtr dom,
if (virDomainObjIsActive(vm)) {
vm->persistent = 0;
} else {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
@@ -745,7 +747,7 @@ vmwareDomainLookupByID(virConnectPtr conn, int id)
virDomainPtr dom = NULL;
vmwareDriverLock(driver);
- vm = virDomainFindByID(&driver->domains, id);
+ vm = virDomainObjListFindByID(driver->domains, id);
vmwareDriverUnlock(driver);
if (!vm) {
@@ -771,7 +773,7 @@ vmwareGetOSType(virDomainPtr dom)
char *ret = NULL;
vmwareDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
vmwareDriverUnlock(driver);
if (!vm) {
@@ -797,7 +799,7 @@ vmwareDomainLookupByUUID(virConnectPtr conn, const unsigned char
*uuid)
virDomainPtr dom = NULL;
vmwareDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, uuid);
vmwareDriverUnlock(driver);
if (!vm) {
@@ -823,7 +825,7 @@ vmwareDomainLookupByName(virConnectPtr conn, const char *name)
virDomainPtr dom = NULL;
vmwareDriverLock(driver);
- vm = virDomainFindByName(&driver->domains, name);
+ vm = virDomainObjListFindByName(driver->domains, name);
vmwareDriverUnlock(driver);
if (!vm) {
@@ -849,7 +851,7 @@ vmwareDomainIsActive(virDomainPtr dom)
int ret = -1;
vmwareDriverLock(driver);
- obj = virDomainFindByUUID(&driver->domains, dom->uuid);
+ obj = virDomainObjListFindByUUID(driver->domains, dom->uuid);
vmwareDriverUnlock(driver);
if (!obj) {
virReportError(VIR_ERR_NO_DOMAIN, NULL);
@@ -872,7 +874,7 @@ vmwareDomainIsPersistent(virDomainPtr dom)
int ret = -1;
vmwareDriverLock(driver);
- obj = virDomainFindByUUID(&driver->domains, dom->uuid);
+ obj = virDomainObjListFindByUUID(driver->domains, dom->uuid);
vmwareDriverUnlock(driver);
if (!obj) {
virReportError(VIR_ERR_NO_DOMAIN, NULL);
@@ -897,7 +899,7 @@ vmwareDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
/* Flags checked by virDomainDefFormat */
vmwareDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
vmwareDriverUnlock(driver);
if (!vm) {
@@ -966,8 +968,8 @@ vmwareNumDefinedDomains(virConnectPtr conn)
int n;
vmwareDriverLock(driver);
- vmwareDomainObjListUpdateAll(&driver->domains, driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 0);
+ vmwareDomainObjListUpdateAll(driver->domains, driver);
+ n = virDomainObjListNumOfDomains(driver->domains, 0);
vmwareDriverUnlock(driver);
return n;
@@ -980,8 +982,8 @@ vmwareNumDomains(virConnectPtr conn)
int n;
vmwareDriverLock(driver);
- vmwareDomainObjListUpdateAll(&driver->domains, driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 1);
+ vmwareDomainObjListUpdateAll(driver->domains, driver);
+ n = virDomainObjListNumOfDomains(driver->domains, 1);
vmwareDriverUnlock(driver);
return n;
@@ -995,8 +997,8 @@ vmwareListDomains(virConnectPtr conn, int *ids, int nids)
int n;
vmwareDriverLock(driver);
- vmwareDomainObjListUpdateAll(&driver->domains, driver);
- n = virDomainObjListGetActiveIDs(&driver->domains, ids, nids);
+ vmwareDomainObjListUpdateAll(driver->domains, driver);
+ n = virDomainObjListGetActiveIDs(driver->domains, ids, nids);
vmwareDriverUnlock(driver);
return n;
@@ -1010,8 +1012,8 @@ vmwareListDefinedDomains(virConnectPtr conn,
int n;
vmwareDriverLock(driver);
- vmwareDomainObjListUpdateAll(&driver->domains, driver);
- n = virDomainObjListGetInactiveNames(&driver->domains, names, nnames);
+ vmwareDomainObjListUpdateAll(driver->domains, driver);
+ n = virDomainObjListGetInactiveNames(driver->domains, names, nnames);
vmwareDriverUnlock(driver);
return n;
}
@@ -1024,7 +1026,7 @@ vmwareDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
int ret = -1;
vmwareDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
vmwareDriverUnlock(driver);
if (!vm) {
@@ -1062,7 +1064,7 @@ vmwareDomainGetState(virDomainPtr dom,
virCheckFlags(0, -1);
vmwareDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
vmwareDriverUnlock(driver);
if (!vm) {
@@ -1100,8 +1102,8 @@ vmwareListAllDomains(virConnectPtr conn,
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
vmwareDriverLock(driver);
- vmwareDomainObjListUpdateAll(&driver->domains, driver);
- ret = virDomainList(conn, driver->domains.objs, domains, flags);
+ vmwareDomainObjListUpdateAll(driver->domains, driver);
+ ret = virDomainObjListExport(driver->domains, conn, domains, flags);
vmwareDriverUnlock(driver);
return ret;
}
--
1.8.1