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 | 168 +++++++++++++++++-----------------
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 | 186 +++++++++++++++++++-------------------
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, 664 insertions(+), 631 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0b9ba13..408584c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -778,18 +778,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);
}
@@ -809,8 +821,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);
@@ -820,8 +832,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;
@@ -848,8 +860,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);
@@ -1844,15 +1856,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;
}
@@ -1984,8 +1996,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);
@@ -14758,14 +14770,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;
@@ -14788,7 +14801,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) &&
@@ -14803,7 +14816,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;
@@ -14822,13 +14835,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;
@@ -14867,14 +14881,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;
@@ -14903,22 +14917,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)
@@ -15029,7 +15043,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
@@ -15039,16 +15053,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)) {
@@ -15073,7 +15087,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);
@@ -15941,10 +15955,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;
@@ -15952,13 +15966,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;
@@ -15974,7 +15988,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 ce36003..97acbe1 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1906,15 +1906,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);
@@ -1974,10 +1974,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);
@@ -1999,8 +1999,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,
@@ -2137,14 +2137,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,
@@ -2162,9 +2162,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);
@@ -2361,8 +2361,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 fc23adc..9441f48 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -283,7 +283,6 @@ virBlkioDeviceWeightArrayClear;
virDiskNameToBusDeviceIndex;
virDiskNameToIndex;
virDomainActualNetDefFree;
-virDomainAssignDef;
virDomainBlockedReasonTypeFromString;
virDomainBlockedReasonTypeToString;
virDomainBootMenuTypeFromString;
@@ -374,9 +373,6 @@ virDomainEmulatorPinAdd;
virDomainEmulatorPinDel;
virDomainFeatureStateTypeFromString;
virDomainFeatureStateTypeToString;
-virDomainFindByID;
-virDomainFindByName;
-virDomainFindByUUID;
virDomainFSDefFree;
virDomainFSIndexByName;
virDomainFSTypeFromString;
@@ -441,9 +437,7 @@ virDomainLifecycleCrashTypeFromString;
virDomainLifecycleCrashTypeToString;
virDomainLifecycleTypeFromString;
virDomainLifecycleTypeToString;
-virDomainList;
virDomainLiveConfigHelperMethod;
-virDomainLoadAllConfigs;
virDomainLockFailureTypeFromString;
virDomainLockFailureTypeToString;
virDomainLookupVcpuPin;
@@ -475,12 +469,19 @@ virDomainObjAssignDef;
virDomainObjCopyPersistentDef;
virDomainObjGetPersistentDef;
virDomainObjGetState;
-virDomainObjIsDuplicate;
-virDomainObjListDeinit;
+virDomainObjListAdd;
+virDomainObjListExport;
+virDomainObjListFindByID;
+virDomainObjListFindByName;
+virDomainObjListFindByUUID;
+virDomainObjListFree;
virDomainObjListGetActiveIDs;
virDomainObjListGetInactiveNames;
-virDomainObjListInit;
+virDomainObjListIsDuplicate;
+virDomainObjListLoadAllConfigs;
+virDomainObjListNew;
virDomainObjListNumOfDomains;
+virDomainObjListRemove;
virDomainObjNew;
virDomainObjSetDefTransient;
virDomainObjSetState;
@@ -493,7 +494,6 @@ virDomainPMStateTypeFromString;
virDomainPMStateTypeToString;
virDomainRedirdevBusTypeFromString;
virDomainRedirdevBusTypeToString;
-virDomainRemoveInactive;
virDomainRunningReasonTypeFromString;
virDomainRunningReasonTypeToString;
virDomainSaveConfig;
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index a3cce08..1d6e80e 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -66,7 +66,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 a8c4cae..4afd106 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -559,7 +559,7 @@ libxlEventHandler(void *data, const libxl_event *event)
}
libxlVmReap(driver, vm, reason);
if (!vm->persistent) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
break;
@@ -908,7 +908,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);
}
@@ -916,7 +916,7 @@ out:
static void
libxlReconnectDomains(libxlDriverPrivatePtr driver)
{
- virHashForEach(driver->domains.objs, libxlReconnectDomain, driver);
+ virHashForEach(driver->domains->objs, libxlReconnectDomain, driver);
}
static int
@@ -927,7 +927,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)
@@ -994,8 +994,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)
@@ -1089,29 +1089,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);
@@ -1137,14 +1137,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);
@@ -1265,7 +1265,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;
@@ -1278,7 +1278,7 @@ libxlNumDomains(virConnectPtr conn)
int n;
libxlDriverLock(driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 1);
+ n = virDomainObjListNumOfDomains(driver->domains, 1);
libxlDriverUnlock(driver);
return n;
@@ -1301,17 +1301,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;
}
@@ -1336,7 +1337,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) {
@@ -1362,7 +1363,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) {
@@ -1388,7 +1389,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) {
@@ -1416,7 +1417,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) {
@@ -1474,7 +1475,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) {
@@ -1534,7 +1535,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);
@@ -1587,7 +1588,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);
@@ -1630,7 +1631,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);
@@ -1655,7 +1656,7 @@ libxlDomainDestroyFlags(virDomainPtr dom,
}
if (!vm->persistent) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
@@ -1684,7 +1685,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];
@@ -1711,7 +1712,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) {
@@ -1742,7 +1743,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) {
@@ -1861,7 +1862,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) {
@@ -1908,7 +1909,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) {
@@ -1994,7 +1995,7 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
vm->hasManagedSave = true;
if (!vm->persistent) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
@@ -2025,7 +2026,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];
@@ -2079,17 +2080,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;
}
@@ -2122,7 +2125,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) {
@@ -2173,7 +2176,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;
}
@@ -2214,7 +2217,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);
@@ -2280,7 +2283,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);
@@ -2309,7 +2312,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);
@@ -2368,7 +2371,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) {
@@ -2487,7 +2490,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) {
@@ -2544,7 +2547,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) {
@@ -2611,7 +2614,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) {
@@ -2674,7 +2677,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) {
@@ -2790,7 +2793,7 @@ libxlListDefinedDomains(virConnectPtr conn,
int n;
libxlDriverLock(driver);
- n = virDomainObjListGetInactiveNames(&driver->domains, names, nnames);
+ n = virDomainObjListGetInactiveNames(driver->domains, names, nnames);
libxlDriverUnlock(driver);
return n;
}
@@ -2802,7 +2805,7 @@ libxlNumDefinedDomains(virConnectPtr conn)
int n;
libxlDriverLock(driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 0);
+ n = virDomainObjListNumOfDomains(driver->domains, 0);
libxlDriverUnlock(driver);
return n;
@@ -2819,7 +2822,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);
@@ -2865,18 +2868,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;
}
@@ -2913,7 +2917,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];
@@ -2960,7 +2964,7 @@ libxlDomainUndefineFlags(virDomainPtr dom,
if (virDomainObjIsActive(vm)) {
vm->persistent = 0;
} else {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
@@ -3352,7 +3356,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"));
@@ -3553,7 +3557,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) {
@@ -3582,7 +3586,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];
@@ -3652,7 +3656,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) {
@@ -3717,7 +3721,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) {
@@ -3800,7 +3804,7 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom,
return -1;
libxlDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
@@ -3870,7 +3874,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);
@@ -3892,7 +3896,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);
@@ -3914,7 +3918,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);
@@ -3981,7 +3985,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 3268e22..9cd2fd8 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];
@@ -949,7 +950,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) {
@@ -989,7 +990,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);
@@ -1076,7 +1077,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)) {
@@ -1086,8 +1087,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;
@@ -1095,7 +1097,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;
}
@@ -1127,7 +1129,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));
@@ -1314,7 +1316,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);
@@ -1337,7 +1339,7 @@ lxcDomainDestroyFlags(virDomainPtr dom,
priv->doneStopEvent = true;
virDomainAuditStop(vm, "destroyed");
if (!vm->persistent) {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
@@ -1441,7 +1443,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();
@@ -1477,23 +1479,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);
@@ -1535,12 +1537,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;
@@ -1553,7 +1555,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);
@@ -1773,7 +1775,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,
@@ -1915,7 +1917,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,
@@ -2028,7 +2030,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,
@@ -2126,7 +2128,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,
@@ -2225,7 +2227,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) {
@@ -2280,7 +2282,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) {
@@ -2308,7 +2310,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];
@@ -2476,7 +2478,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];
@@ -2541,7 +2543,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];
@@ -2601,7 +2603,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);
@@ -2679,7 +2681,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,
@@ -2744,7 +2746,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;
@@ -2766,7 +2768,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) {
@@ -2855,7 +2857,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) {
@@ -4298,7 +4300,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];
@@ -4482,7 +4484,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 4ad7ba0..f0aae40 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);
@@ -574,7 +574,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 {
@@ -588,7 +588,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;
}
}
@@ -1288,7 +1288,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 ea193af..e472df8 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) {
@@ -2326,13 +2327,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))
@@ -2347,7 +2348,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"),
@@ -2362,8 +2363,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 9419b59..26011c7 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -671,7 +671,7 @@ qemuDriverCloseCallbackRun(void *payload,
return;
}
- 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 c528a02..98d9501 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();
@@ -864,42 +864,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);
@@ -960,12 +960,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;
@@ -1055,7 +1055,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);
@@ -1380,7 +1380,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) {
@@ -1405,7 +1405,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) {
@@ -1432,7 +1432,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) {
@@ -1522,7 +1522,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;
@@ -1533,7 +1533,7 @@ static int qemuNumDomains(virConnectPtr conn) {
int n;
qemuDriverLock(driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 1);
+ n = virDomainObjListNumOfDomains(driver->domains, 1);
qemuDriverUnlock(driver);
return n;
@@ -1590,7 +1590,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)))
@@ -1602,9 +1602,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;
@@ -1671,7 +1671,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];
@@ -1754,7 +1754,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];
@@ -2049,7 +2049,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);
@@ -2276,7 +2276,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);
@@ -2353,7 +2353,7 @@ static int qemuDomainSendKey(virDomainPtr domain,
}
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);
@@ -3039,7 +3039,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);
@@ -3349,7 +3349,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];
@@ -4533,7 +4533,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));
@@ -4593,7 +4593,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];
@@ -4991,13 +4991,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;
@@ -5204,7 +5204,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];
@@ -5438,7 +5438,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;
}
@@ -5448,7 +5448,7 @@ static int qemuNumDefinedDomains(virConnectPtr conn) {
int n;
qemuDriverLock(driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 0);
+ n = virDomainObjListNumOfDomains(driver->domains, 0);
qemuDriverUnlock(driver);
return n;
@@ -5545,7 +5545,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];
@@ -5607,7 +5607,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)))
@@ -5622,9 +5622,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;
@@ -5633,9 +5633,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;
}
}
@@ -5708,7 +5708,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];
@@ -6434,7 +6434,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);
@@ -6635,7 +6635,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];
@@ -6916,7 +6916,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);
@@ -7071,7 +7071,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,
@@ -7267,7 +7267,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,
@@ -7427,7 +7427,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,
@@ -7590,7 +7590,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,
@@ -7742,7 +7742,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,
@@ -7948,7 +7948,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,
@@ -8234,7 +8234,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,
@@ -8765,7 +8765,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,
@@ -8931,7 +8931,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,
@@ -9595,7 +9595,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);
@@ -9643,7 +9643,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);
@@ -9685,7 +9685,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);
@@ -9872,7 +9872,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);
@@ -9911,7 +9911,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);
@@ -9944,7 +9944,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);
@@ -11340,7 +11340,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);
@@ -12033,7 +12033,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);
@@ -12400,7 +12400,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);
@@ -12590,7 +12590,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)
@@ -12599,9 +12599,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;
@@ -13002,7 +13002,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);
@@ -13560,7 +13560,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);
@@ -13656,7 +13656,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);
@@ -13814,7 +13814,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);
@@ -14391,7 +14391,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);
@@ -14588,7 +14588,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 439cdfa..dad6e25 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3431,7 +3431,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 a10a377..78b73b3 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;
@@ -537,7 +537,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));
@@ -564,8 +564,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;
@@ -627,7 +628,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);
@@ -777,7 +778,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)))
@@ -908,8 +909,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;
}
@@ -1095,7 +1097,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);
@@ -1164,7 +1166,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);
@@ -1235,7 +1237,7 @@ static int testNumOfDomains(virConnectPtr conn)
int count;
testDriverLock(privconn);
- count = virDomainObjListNumOfDomains(&privconn->domains, 1);
+ count = virDomainObjListNumOfDomains(privconn->domains, 1);
testDriverUnlock(privconn);
return count;
@@ -1248,7 +1250,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);
@@ -1269,7 +1271,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);
@@ -1306,13 +1308,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;
@@ -1346,7 +1349,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) {
@@ -1372,7 +1375,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) {
@@ -1398,7 +1401,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) {
@@ -1424,7 +1427,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;
@@ -1438,8 +1441,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__);
@@ -1452,8 +1455,8 @@ static int testDestroyDomain(virDomainPtr domain)
VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
if (!privdom->persistent) {
- virDomainRemoveInactive(&privconn->domains,
- privdom);
+ virDomainObjListRemove(privconn->domains,
+ privdom);
privdom = NULL;
}
@@ -1475,8 +1478,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) {
@@ -1517,8 +1520,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) {
@@ -1562,8 +1565,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__);
@@ -1582,8 +1585,8 @@ static int testShutdownDomainFlags(virDomainPtr domain,
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
if (!privdom->persistent) {
- virDomainRemoveInactive(&privconn->domains,
- privdom);
+ virDomainObjListRemove(privconn->domains,
+ privdom);
privdom = NULL;
}
@@ -1612,8 +1615,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__);
@@ -1657,8 +1660,8 @@ static int testRebootDomain(virDomainPtr domain,
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
if (!privdom->persistent) {
- virDomainRemoveInactive(&privconn->domains,
- privdom);
+ virDomainObjListRemove(privconn->domains,
+ privdom);
privdom = NULL;
}
}
@@ -1682,8 +1685,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) {
@@ -1723,8 +1726,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) {
@@ -1763,8 +1766,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__);
@@ -1821,8 +1824,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;
}
@@ -1922,13 +1925,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;
@@ -1972,8 +1976,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__);
@@ -2005,8 +2009,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;
}
}
@@ -2035,8 +2039,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) {
@@ -2060,8 +2064,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) {
@@ -2087,8 +2091,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) {
@@ -2123,7 +2127,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) {
@@ -2184,7 +2188,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) {
@@ -2267,7 +2271,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) {
@@ -2353,7 +2357,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) {
@@ -2407,8 +2411,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) {
@@ -2433,7 +2437,7 @@ static int testNumOfDefinedDomains(virConnectPtr conn) {
int count;
testDriverLock(privconn);
- count = virDomainObjListNumOfDomains(&privconn->domains, 0);
+ count = virDomainObjListNumOfDomains(privconn->domains, 0);
testDriverUnlock(privconn);
return count;
@@ -2448,7 +2452,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;
@@ -2469,13 +2473,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;
@@ -2536,8 +2541,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__);
@@ -2584,8 +2589,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__);
@@ -2598,8 +2603,8 @@ static int testDomainUndefineFlags(virDomainPtr domain,
if (virDomainObjIsActive(privdom)) {
privdom->persistent = 0;
} else {
- virDomainRemoveInactive(&privconn->domains,
- privdom);
+ virDomainObjListRemove(privconn->domains,
+ privdom);
privdom = NULL;
}
@@ -2627,8 +2632,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) {
@@ -2654,8 +2659,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) {
@@ -2700,8 +2705,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) {
@@ -2750,8 +2755,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) {
@@ -2793,8 +2798,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) {
@@ -2840,8 +2845,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) {
@@ -5692,7 +5697,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 c6fef69..613973c 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;
}
}
@@ -448,7 +448,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();
@@ -533,12 +533,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);
@@ -588,12 +588,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;
@@ -633,9 +633,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);
@@ -688,8 +688,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;
}
@@ -702,7 +702,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);
@@ -1307,7 +1307,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) {
@@ -1331,7 +1331,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) {
@@ -1355,7 +1355,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) {
@@ -1380,7 +1380,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);
@@ -1402,7 +1402,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);
@@ -1423,7 +1423,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);
@@ -1467,7 +1467,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;
@@ -1477,7 +1477,7 @@ static int umlNumDomains(virConnectPtr conn) {
int n;
umlDriverLock(driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 1);
+ n = virDomainObjListNumOfDomains(driver->domains, 1);
umlDriverUnlock(driver);
return n;
@@ -1498,20 +1498,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;
}
@@ -1544,7 +1544,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,
@@ -1586,7 +1586,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);
@@ -1599,8 +1599,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;
@@ -1627,7 +1627,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",
@@ -1653,7 +1653,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) {
@@ -1678,7 +1678,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) {
@@ -1711,7 +1711,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) {
@@ -1751,7 +1751,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) {
@@ -1797,7 +1797,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) {
@@ -1826,7 +1826,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) {
@@ -1852,7 +1852,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;
@@ -1863,7 +1863,7 @@ static int umlNumDefinedDomains(virConnectPtr conn) {
int n;
umlDriverLock(driver);
- n = virDomainObjListNumOfDomains(&driver->domains, 0);
+ n = virDomainObjListNumOfDomains(driver->domains, 0);
umlDriverUnlock(driver);
return n;
@@ -1879,7 +1879,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",
@@ -1920,20 +1920,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;
}
@@ -1959,7 +1959,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"));
@@ -1978,7 +1978,7 @@ static int umlDomainUndefineFlags(virDomainPtr dom,
if (virDomainObjIsActive(vm)) {
vm->persistent = 0;
} else {
- virDomainRemoveInactive(&driver->domains, vm);
+ virDomainObjListRemove(driver->domains, vm);
vm = NULL;
}
@@ -2057,7 +2057,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);
@@ -2175,7 +2175,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);
@@ -2241,7 +2241,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",
@@ -2267,7 +2267,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",
@@ -2341,7 +2341,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) {
@@ -2410,7 +2410,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);
@@ -2555,7 +2555,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.0.2