Convert virDomainObj, qemuAgent, qemuMonitor, lxcMonitor to virObjectLockable

The  virDomainObj, qemuAgent, qemuMonitor, lxcMonitor classes
all require a mutex, so can be switched to use virObjectLockable

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2013-01-09 21:00:32 +00:00
parent 79611c5968
commit 325b02b5a3
28 changed files with 486 additions and 583 deletions

View File

@ -62,7 +62,6 @@ src/lxc/lxc_container.c
src/lxc/lxc_conf.c
src/lxc/lxc_controller.c
src/lxc/lxc_driver.c
src/lxc/lxc_monitor.c
src/lxc/lxc_process.c
src/libxl/libxl_driver.c
src/libxl/libxl_conf.c

View File

@ -700,7 +700,7 @@ static void virDomainObjDispose(void *obj);
static int virDomainObjOnceInit(void)
{
if (!(virDomainObjClass = virClassNew(virClassForObject(),
if (!(virDomainObjClass = virClassNew(virClassForObjectLockable(),
"virDomainObj",
sizeof(virDomainObj),
virDomainObjDispose)))
@ -801,11 +801,11 @@ static int virDomainObjListSearchID(const void *payload,
const int *id = data;
int want = 0;
virDomainObjLock(obj);
virObjectLock(obj);
if (virDomainObjIsActive(obj) &&
obj->def->id == *id)
want = 1;
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return want;
}
@ -815,7 +815,7 @@ virDomainObjPtr virDomainFindByID(const virDomainObjListPtr doms,
virDomainObjPtr obj;
obj = virHashSearch(doms->objs, virDomainObjListSearchID, &id);
if (obj)
virDomainObjLock(obj);
virObjectLock(obj);
return obj;
}
@ -830,7 +830,7 @@ virDomainObjPtr virDomainFindByUUID(const virDomainObjListPtr doms,
obj = virHashLookup(doms->objs, uuidstr);
if (obj)
virDomainObjLock(obj);
virObjectLock(obj);
return obj;
}
@ -841,10 +841,10 @@ static int virDomainObjListSearchName(const void *payload,
virDomainObjPtr obj = (virDomainObjPtr)payload;
int want = 0;
virDomainObjLock(obj);
virObjectLock(obj);
if (STREQ(obj->def->name, (const char *)data))
want = 1;
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return want;
}
@ -854,7 +854,7 @@ virDomainObjPtr virDomainFindByName(const virDomainObjListPtr doms,
virDomainObjPtr obj;
obj = virHashSearch(doms->objs, virDomainObjListSearchName, name);
if (obj)
virDomainObjLock(obj);
virObjectLock(obj);
return obj;
}
@ -1786,8 +1786,6 @@ static void virDomainObjDispose(void *obj)
if (dom->privateDataFreeFunc)
(dom->privateDataFreeFunc)(dom->privateData);
virMutexDestroy(&dom->lock);
virDomainSnapshotObjListFree(dom->snapshots);
}
@ -1799,16 +1797,9 @@ virDomainObjPtr virDomainObjNew(virCapsPtr caps)
if (virDomainObjInitialize() < 0)
return NULL;
if (!(domain = virObjectNew(virDomainObjClass)))
if (!(domain = virObjectLockableNew(virDomainObjClass)))
return NULL;
if (virMutexInit(&domain->lock) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot initialize mutex"));
VIR_FREE(domain);
return NULL;
}
if (caps &&
caps->privateDataAllocFunc) {
if (!(domain->privateData = (caps->privateDataAllocFunc)())) {
@ -1821,7 +1812,7 @@ virDomainObjPtr virDomainObjNew(virCapsPtr caps)
if (!(domain->snapshots = virDomainSnapshotObjListNew()))
goto error;
virDomainObjLock(domain);
virObjectLock(domain);
virDomainObjSetState(domain, VIR_DOMAIN_SHUTOFF,
VIR_DOMAIN_SHUTOFF_UNKNOWN);
@ -1999,7 +1990,7 @@ void virDomainRemoveInactive(virDomainObjListPtr doms,
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->def->uuid, uuidstr);
virDomainObjUnlock(dom);
virObjectUnlock(dom);
virHashRemoveEntry(doms->objs, uuidstr);
}
@ -14930,7 +14921,7 @@ int virDomainLoadAllConfigs(virCapsPtr caps,
notify,
opaque);
if (dom) {
virDomainObjUnlock(dom);
virObjectUnlock(dom);
if (!liveStatus)
dom->persistent = 1;
}
@ -15097,40 +15088,29 @@ virDomainObjIsDuplicate(virDomainObjListPtr doms,
ret = dupVM;
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
void virDomainObjLock(virDomainObjPtr obj)
{
virMutexLock(&obj->lock);
}
void virDomainObjUnlock(virDomainObjPtr obj)
{
virMutexUnlock(&obj->lock);
}
static void virDomainObjListCountActive(void *payload, const void *name ATTRIBUTE_UNUSED, void *data)
{
virDomainObjPtr obj = payload;
int *count = data;
virDomainObjLock(obj);
virObjectLock(obj);
if (virDomainObjIsActive(obj))
(*count)++;
virDomainObjUnlock(obj);
virObjectUnlock(obj);
}
static void virDomainObjListCountInactive(void *payload, const void *name ATTRIBUTE_UNUSED, void *data)
{
virDomainObjPtr obj = payload;
int *count = data;
virDomainObjLock(obj);
virObjectLock(obj);
if (!virDomainObjIsActive(obj))
(*count)++;
virDomainObjUnlock(obj);
virObjectUnlock(obj);
}
int virDomainObjListNumOfDomains(virDomainObjListPtr doms, int active)
@ -15153,10 +15133,10 @@ static void virDomainObjListCopyActiveIDs(void *payload, const void *name ATTRIB
{
virDomainObjPtr obj = payload;
struct virDomainIDData *data = opaque;
virDomainObjLock(obj);
virObjectLock(obj);
if (virDomainObjIsActive(obj) && data->numids < data->maxids)
data->ids[data->numids++] = obj->def->id;
virDomainObjUnlock(obj);
virObjectUnlock(obj);
}
int virDomainObjListGetActiveIDs(virDomainObjListPtr doms,
@ -15183,14 +15163,14 @@ static void virDomainObjListCopyInactiveNames(void *payload, const void *name AT
if (data->oom)
return;
virDomainObjLock(obj);
virObjectLock(obj);
if (!virDomainObjIsActive(obj) && data->numnames < data->maxnames) {
if (!(data->names[data->numnames] = strdup(obj->def->name)))
data->oom = 1;
else
data->numnames++;
}
virDomainObjUnlock(obj);
virObjectUnlock(obj);
}
@ -15883,7 +15863,7 @@ virDomainListPopulate(void *payload,
if (data->error)
return;
virDomainObjLock(vm);
virObjectLock(vm);
/* check if the domain matches the filter */
/* filter by active state */
@ -15956,7 +15936,7 @@ virDomainListPopulate(void *payload,
data->domains[data->ndomains++] = dom;
cleanup:
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return;
}
#undef MATCH

View File

@ -1867,9 +1867,7 @@ struct _virDomainStateReason {
typedef struct _virDomainObj virDomainObj;
typedef virDomainObj *virDomainObjPtr;
struct _virDomainObj {
virObject object;
virMutex lock;
virObjectLockable parent;
pid_t pid;
virDomainStateReason state;
@ -2168,9 +2166,6 @@ int virDomainObjIsDuplicate(virDomainObjListPtr doms,
virDomainDefPtr def,
unsigned int check_active);
void virDomainObjLock(virDomainObjPtr obj);
void virDomainObjUnlock(virDomainObjPtr obj);
int virDomainObjListNumOfDomains(virDomainObjListPtr doms, int active);
int virDomainObjListGetActiveIDs(virDomainObjListPtr doms,

View File

@ -481,12 +481,10 @@ virDomainObjListGetActiveIDs;
virDomainObjListGetInactiveNames;
virDomainObjListInit;
virDomainObjListNumOfDomains;
virDomainObjLock;
virDomainObjNew;
virDomainObjSetDefTransient;
virDomainObjSetState;
virDomainObjTaint;
virDomainObjUnlock;
virDomainPausedReasonTypeFromString;
virDomainPausedReasonTypeToString;
virDomainPciRombarModeTypeFromString;

View File

@ -299,7 +299,7 @@ libxlAutostartDomain(void *payload, const void *name ATTRIBUTE_UNUSED,
virDomainObjPtr vm = payload;
virErrorPtr err;
virDomainObjLock(vm);
virObjectLock(vm);
virResetLastError();
if (vm->autostart && !virDomainObjIsActive(vm) &&
@ -311,7 +311,7 @@ libxlAutostartDomain(void *payload, const void *name ATTRIBUTE_UNUSED,
}
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
}
static int
@ -528,7 +528,7 @@ static void libxlEventHandler(void *data, const libxl_event *event)
virDomainEventPtr dom_event = NULL;
libxlDriverLock(driver);
virDomainObjLock(vm);
virObjectLock(vm);
libxlDriverUnlock(driver);
if (event->type == LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN) {
@ -566,7 +566,7 @@ static void libxlEventHandler(void *data, const libxl_event *event)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (dom_event) {
libxlDriverLock(driver);
libxlDomainEventQueue(driver, dom_event);
@ -863,7 +863,7 @@ libxlReconnectDomain(void *payload,
int len;
uint8_t *data = NULL;
virDomainObjLock(vm);
virObjectLock(vm);
/* Does domain still exist? */
rc = libxl_domain_info(driver->ctx, &d_info, vm->def->id);
@ -892,7 +892,7 @@ libxlReconnectDomain(void *payload,
/* Recreate domain death et. al. events */
libxlCreateDomEvents(vm);
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return;
out:
@ -900,7 +900,7 @@ out:
if (!vm->persistent)
virDomainRemoveInactive(&driver->domains, vm);
else
virDomainObjUnlock(vm);
virObjectUnlock(vm);
}
static void
@ -1312,7 +1312,7 @@ libxlDomainCreateXML(virConnectPtr conn, const char *xml,
cleanup:
virDomainDefFree(def);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
libxlDriverUnlock(driver);
return dom;
}
@ -1339,7 +1339,7 @@ libxlDomainLookupByID(virConnectPtr conn, int id)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -1365,7 +1365,7 @@ libxlDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -1391,7 +1391,7 @@ libxlDomainLookupByName(virConnectPtr conn, const char *name)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -1443,7 +1443,7 @@ libxlDomainSuspend(virDomainPtr dom)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event) {
libxlDriverLock(driver);
libxlDomainEventQueue(driver, event);
@ -1503,7 +1503,7 @@ libxlDomainResume(virDomainPtr dom)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event) {
libxlDriverLock(driver);
libxlDomainEventQueue(driver, event);
@ -1553,7 +1553,7 @@ libxlDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
libxlDriverUnlock(driver);
return ret;
}
@ -1602,7 +1602,7 @@ libxlDomainReboot(virDomainPtr dom, unsigned int flags)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
libxlDriverUnlock(driver);
return ret;
}
@ -1652,7 +1652,7 @@ libxlDomainDestroyFlags(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
libxlDomainEventQueue(driver, event);
libxlDriverUnlock(driver);
@ -1688,7 +1688,7 @@ libxlDomainGetOSType(virDomainPtr dom)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return type;
}
@ -1711,7 +1711,7 @@ libxlDomainGetMaxMemory(virDomainPtr dom)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -1825,7 +1825,7 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -1880,7 +1880,7 @@ libxlDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -1911,7 +1911,7 @@ libxlDomainGetState(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2033,7 +2033,7 @@ libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
libxlDriverUnlock(driver);
return ret;
}
@ -2087,7 +2087,7 @@ cleanup:
virReportSystemError(errno, "%s", _("cannot close file"));
virDomainDefFree(def);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
libxlDriverUnlock(driver);
return ret;
}
@ -2183,7 +2183,7 @@ cleanup_unpause:
}
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event) {
libxlDriverLock(driver);
libxlDomainEventQueue(driver, event);
@ -2232,7 +2232,7 @@ libxlDomainManagedSave(virDomainPtr dom, unsigned int flags)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
libxlDriverUnlock(driver);
VIR_FREE(name);
return ret;
@ -2247,7 +2247,7 @@ libxlDomainManagedSaveLoad(void *payload,
libxlDriverPrivatePtr driver = opaque;
char *name;
virDomainObjLock(vm);
virObjectLock(vm);
if (!(name = libxlDomainManagedSavePath(driver, vm)))
goto cleanup;
@ -2255,7 +2255,7 @@ libxlDomainManagedSaveLoad(void *payload,
vm->hasManagedSave = virFileExists(name);
cleanup:
virDomainObjUnlock(vm);
virObjectUnlock(vm);
VIR_FREE(name);
}
@ -2282,7 +2282,7 @@ libxlDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
libxlDriverUnlock(driver);
return ret;
}
@ -2317,7 +2317,7 @@ libxlDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
cleanup:
VIR_FREE(name);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
libxlDriverUnlock(driver);
return ret;
}
@ -2452,7 +2452,7 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
cleanup:
VIR_FREE(bitmask);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2518,7 +2518,7 @@ libxlDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2581,7 +2581,7 @@ libxlDomainPinVcpu(virDomainPtr dom, unsigned int vcpu, unsigned char *cpumap,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2649,7 +2649,7 @@ libxlDomainGetVcpus(virDomainPtr dom, virVcpuInfoPtr info, int maxinfo,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2676,7 +2676,7 @@ libxlDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2827,7 +2827,7 @@ libxlDomainCreateWithFlags(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
libxlDriverUnlock(driver);
return ret;
}
@ -2882,7 +2882,7 @@ libxlDomainDefineXML(virConnectPtr conn, const char *xml)
cleanup:
virDomainDefFree(def);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
libxlDomainEventQueue(driver, event);
libxlDriverUnlock(driver);
@ -2958,7 +2958,7 @@ libxlDomainUndefineFlags(virDomainPtr dom,
cleanup:
VIR_FREE(name);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
libxlDomainEventQueue(driver, event);
libxlDriverUnlock(driver);
@ -3438,7 +3438,7 @@ cleanup:
virDomainDefFree(vmdef);
virDomainDeviceDefFree(dev);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
libxlDriverUnlock(driver);
return ret;
}
@ -3558,7 +3558,7 @@ libxlDomainGetAutostart(virDomainPtr dom, int *autostart)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -3626,7 +3626,7 @@ cleanup:
VIR_FREE(configFile);
VIR_FREE(autostartLink);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
libxlDriverUnlock(driver);
return ret;
}
@ -3686,7 +3686,7 @@ libxlDomainGetSchedulerType(virDomainPtr dom, int *nparams)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -3754,7 +3754,7 @@ libxlDomainGetSchedulerParametersFlags(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -3840,7 +3840,7 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -3869,7 +3869,7 @@ libxlDomainIsActive(virDomainPtr dom)
cleanup:
if (obj)
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return ret;
}
@ -3891,7 +3891,7 @@ libxlDomainIsPersistent(virDomainPtr dom)
cleanup:
if (obj)
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return ret;
}
@ -3913,7 +3913,7 @@ libxlDomainIsUpdated(virDomainPtr dom)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}

View File

@ -223,7 +223,7 @@ static virDomainPtr lxcDomainLookupByID(virConnectPtr conn,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -252,7 +252,7 @@ static virDomainPtr lxcDomainLookupByUUID(virConnectPtr conn,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -278,7 +278,7 @@ static virDomainPtr lxcDomainLookupByName(virConnectPtr conn,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -303,7 +303,7 @@ static int lxcDomainIsActive(virDomainPtr dom)
cleanup:
if (obj)
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return ret;
}
@ -328,7 +328,7 @@ static int lxcDomainIsPersistent(virDomainPtr dom)
cleanup:
if (obj)
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return ret;
}
@ -352,7 +352,7 @@ static int lxcDomainIsUpdated(virDomainPtr dom)
cleanup:
if (obj)
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return ret;
}
@ -457,7 +457,7 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const char *xml)
cleanup:
virDomainDefFree(def);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
virDomainEventStateQueue(driver->domainEventState, event);
lxcDriverUnlock(driver);
@ -510,7 +510,7 @@ static int lxcDomainUndefineFlags(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
virDomainEventStateQueue(driver->domainEventState, event);
lxcDriverUnlock(driver);
@ -579,7 +579,7 @@ cleanup:
if (cgroup)
virCgroupFree(&cgroup);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -612,7 +612,7 @@ lxcDomainGetState(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -641,7 +641,7 @@ static char *lxcGetOSType(virDomainPtr dom)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -669,7 +669,7 @@ lxcDomainGetMaxMemory(virDomainPtr dom)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -701,7 +701,7 @@ static int lxcDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) {
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -756,7 +756,7 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (cgroup)
virCgroupFree(&cgroup);
return ret;
@ -835,7 +835,7 @@ cleanup:
if (cgroup)
virCgroupFree(&cgroup);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
lxcDriverUnlock(driver);
return ret;
}
@ -934,7 +934,7 @@ cleanup:
if (cgroup)
virCgroupFree(&cgroup);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
lxcDriverUnlock(driver);
return ret;
}
@ -966,7 +966,7 @@ static char *lxcDomainGetXMLDesc(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -1025,7 +1025,7 @@ static int lxcDomainStartWithFlags(virDomainPtr dom, unsigned int flags)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
virDomainEventStateQueue(driver->domainEventState, event);
lxcDriverUnlock(driver);
@ -1112,7 +1112,7 @@ lxcDomainCreateAndStart(virConnectPtr conn,
cleanup:
virDomainDefFree(def);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
virDomainEventStateQueue(driver->domainEventState, event);
lxcDriverUnlock(driver);
@ -1173,7 +1173,7 @@ static int lxcDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr secla
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
lxcDriverUnlock(driver);
return ret;
}
@ -1343,7 +1343,7 @@ lxcDomainDestroyFlags(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
virDomainEventStateQueue(driver->domainEventState, event);
lxcDriverUnlock(driver);
@ -1872,7 +1872,7 @@ cleanup:
virDomainDefFree(vmdef);
virCgroupFree(&group);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
lxcDriverUnlock(driver);
return ret;
}
@ -1991,7 +1991,7 @@ out:
cleanup:
virCgroupFree(&group);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
lxcDriverUnlock(driver);
return ret;
}
@ -2100,7 +2100,7 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
cleanup:
virCgroupFree(&group);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
lxcDriverUnlock(driver);
return ret;
}
@ -2207,7 +2207,7 @@ cleanup:
if (group)
virCgroupFree(&group);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
lxcDriverUnlock(driver);
return ret;
}
@ -2259,7 +2259,7 @@ lxcDomainInterfaceStats(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
#else
@ -2296,7 +2296,7 @@ static int lxcDomainGetAutostart(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2370,7 +2370,7 @@ cleanup:
VIR_FREE(configFile);
VIR_FREE(autostartLink);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
lxcDriverUnlock(driver);
return ret;
}
@ -2513,7 +2513,7 @@ cleanup:
if (event)
virDomainEventStateQueue(driver->domainEventState, event);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
lxcDriverUnlock(driver);
return ret;
}
@ -2579,7 +2579,7 @@ cleanup:
if (event)
virDomainEventStateQueue(driver->domainEventState, event);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
lxcDriverUnlock(driver);
return ret;
}
@ -2649,7 +2649,7 @@ lxcDomainOpenConsole(virDomainPtr dom,
ret = 0;
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
lxcDriverUnlock(driver);
return ret;
}
@ -2728,7 +2728,7 @@ lxcDomainSendProcessSignal(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2830,7 +2830,7 @@ lxcDomainShutdownFlags(virDomainPtr dom,
cleanup:
VIR_FREE(vroot);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2919,7 +2919,7 @@ lxcDomainReboot(virDomainPtr dom,
cleanup:
VIR_FREE(vroot);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -4419,7 +4419,7 @@ cleanup:
virDomainDeviceDefFree(dev_copy);
virDomainDeviceDefFree(dev);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
lxcDriverUnlock(driver);
return ret;
}
@ -4510,7 +4510,7 @@ static int lxcDomainOpenNamespace(virDomainPtr dom,
ret = nfds;
cleanup:
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}

View File

@ -34,9 +34,7 @@
#define VIR_FROM_THIS VIR_FROM_LXC
struct _virLXCMonitor {
virObject parent;
virMutex lock;
virObjectLockable parent;
virDomainObjPtr vm;
virLXCMonitorCallbacks cb;
@ -50,7 +48,7 @@ static void virLXCMonitorDispose(void *obj);
static int virLXCMonitorOnceInit(void)
{
if (!(virLXCMonitorClass = virClassNew(virClassForObject(),
if (!(virLXCMonitorClass = virClassNew(virClassForObjectLockable(),
"virLXCMonitor",
sizeof(virLXCMonitor),
virLXCMonitorDispose)))
@ -120,10 +118,10 @@ static void virLXCMonitorEOFNotify(virNetClientPtr client ATTRIBUTE_UNUSED,
virDomainObjPtr vm;
VIR_DEBUG("EOF notify mon=%p", mon);
virLXCMonitorLock(mon);
virObjectLock(mon);
eofNotify = mon->cb.eofNotify;
vm = mon->vm;
virLXCMonitorUnlock(mon);
virObjectUnlock(mon);
if (eofNotify) {
VIR_DEBUG("EOF callback mon=%p vm=%p", mon, vm);
@ -151,16 +149,9 @@ virLXCMonitorPtr virLXCMonitorNew(virDomainObjPtr vm,
if (virLXCMonitorInitialize() < 0)
return NULL;
if (!(mon = virObjectNew(virLXCMonitorClass)))
if (!(mon = virObjectLockableNew(virLXCMonitorClass)))
return NULL;
if (virMutexInit(&mon->lock) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot initialize monitor mutex"));
VIR_FREE(mon);
return NULL;
}
if (virAsprintf(&sockpath, "%s/%s.sock",
socketdir, vm->def->name) < 0)
goto no_memory;
@ -209,7 +200,6 @@ static void virLXCMonitorDispose(void *opaque)
VIR_DEBUG("mon=%p", mon);
if (mon->cb.destroy)
(mon->cb.destroy)(mon, mon->vm);
virMutexDestroy(&mon->lock);
virObjectUnref(mon->program);
}
@ -229,15 +219,3 @@ void virLXCMonitorClose(virLXCMonitorPtr mon)
mon->client = NULL;
}
}
void virLXCMonitorLock(virLXCMonitorPtr mon)
{
virMutexLock(&mon->lock);
}
void virLXCMonitorUnlock(virLXCMonitorPtr mon)
{
virMutexUnlock(&mon->lock);
}

View File

@ -104,7 +104,7 @@ static void virLXCProcessAutoDestroyDom(void *payload,
virDomainRemoveInactive(&data->driver->domains, dom);
if (dom)
virDomainObjUnlock(dom);
virObjectUnlock(dom);
if (event)
virDomainEventStateQueue(data->driver->domainEventState, event);
virHashRemoveEntry(data->driver->autodestroy, uuidstr);
@ -558,7 +558,7 @@ static void virLXCProcessMonitorEOFNotify(virLXCMonitorPtr mon,
VIR_DEBUG("mon=%p vm=%p", mon, vm);
lxcDriverLock(driver);
virDomainObjLock(vm);
virObjectLock(vm);
lxcDriverUnlock(driver);
priv = vm->privateData;
@ -595,7 +595,7 @@ static void virLXCProcessMonitorEOFNotify(virLXCMonitorPtr mon,
}
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event) {
lxcDriverLock(driver);
virDomainEventStateQueue(driver->domainEventState, event);
@ -1250,7 +1250,7 @@ virLXCProcessAutostartDomain(void *payload, const void *name ATTRIBUTE_UNUSED, v
virDomainObjPtr vm = payload;
const struct virLXCProcessAutostartData *data = opaque;
virDomainObjLock(vm);
virObjectLock(vm);
if (vm->autostart &&
!virDomainObjIsActive(vm)) {
int ret = virLXCProcessStart(data->conn, data->driver, vm, false,
@ -1270,7 +1270,7 @@ virLXCProcessAutostartDomain(void *payload, const void *name ATTRIBUTE_UNUSED, v
virDomainEventStateQueue(data->driver->domainEventState, event);
}
}
virDomainObjUnlock(vm);
virObjectUnlock(vm);
}
@ -1302,7 +1302,7 @@ virLXCProcessReconnectDomain(void *payload, const void *name ATTRIBUTE_UNUSED, v
virLXCDriverPtr driver = opaque;
virLXCDomainObjPrivatePtr priv;
virDomainObjLock(vm);
virObjectLock(vm);
VIR_DEBUG("Reconnect id=%d pid=%d state=%d", vm->def->id, vm->pid, vm->state.state);
priv = vm->privateData;
@ -1345,7 +1345,7 @@ virLXCProcessReconnectDomain(void *payload, const void *name ATTRIBUTE_UNUSED, v
}
cleanup:
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return;
error:

View File

@ -1161,7 +1161,7 @@ virNWFilterDomainFWUpdateCB(void *payload,
int i, err;
bool skipIface;
virDomainObjLock(obj);
virObjectLock(obj);
if (virDomainObjIsActive(obj)) {
for (i = 0; i < vm->nnets; i++) {
@ -1209,5 +1209,5 @@ virNWFilterDomainFWUpdateCB(void *payload,
}
}
virDomainObjUnlock(obj);
virObjectUnlock(obj);
}

View File

@ -669,7 +669,7 @@ int openvzLoadDomains(struct openvz_driver *driver) {
goto cleanup;
}
virDomainObjUnlock(dom);
virObjectUnlock(dom);
dom = NULL;
}

View File

@ -264,7 +264,7 @@ openvzDomainGetHostname(virDomainPtr dom, unsigned int flags)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return hostname;
error:
@ -294,7 +294,7 @@ static virDomainPtr openvzDomainLookupByID(virConnectPtr conn,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -326,7 +326,7 @@ static char *openvzGetOSType(virDomainPtr dom)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -352,7 +352,7 @@ static virDomainPtr openvzDomainLookupByUUID(virConnectPtr conn,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -377,7 +377,7 @@ static virDomainPtr openvzDomainLookupByName(virConnectPtr conn,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -419,7 +419,7 @@ static int openvzDomainGetInfo(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -450,7 +450,7 @@ openvzDomainGetState(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -472,7 +472,7 @@ static int openvzDomainIsActive(virDomainPtr dom)
cleanup:
if (obj)
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return ret;
}
@ -494,7 +494,7 @@ static int openvzDomainIsPersistent(virDomainPtr dom)
cleanup:
if (obj)
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return ret;
}
@ -524,7 +524,7 @@ static char *openvzDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -582,7 +582,7 @@ static int openvzDomainSuspend(virDomainPtr dom) {
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -620,7 +620,7 @@ static int openvzDomainResume(virDomainPtr dom) {
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -665,7 +665,7 @@ openvzDomainShutdownFlags(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -714,7 +714,7 @@ static int openvzDomainReboot(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -1024,7 +1024,7 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
cleanup:
virDomainDefFree(vmdef);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
openvzDriverUnlock(driver);
return dom;
}
@ -1109,7 +1109,7 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
cleanup:
virDomainDefFree(vmdef);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
openvzDriverUnlock(driver);
return dom;
}
@ -1157,7 +1157,7 @@ openvzDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -1206,7 +1206,7 @@ openvzDomainUndefineFlags(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
openvzDriverUnlock(driver);
return ret;
}
@ -1244,7 +1244,7 @@ openvzDomainSetAutostart(virDomainPtr dom, int autostart)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -1281,7 +1281,7 @@ cleanup:
VIR_FREE(value);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -1372,7 +1372,7 @@ static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -1985,7 +1985,7 @@ openvzDomainInterfaceStats(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2090,7 +2090,7 @@ cleanup:
openvzDriverUnlock(driver);
virDomainDeviceDefFree(dev);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}

View File

@ -851,7 +851,7 @@ parallelsLoadDomain(parallelsConnPtr privconn, virJSONValuePtr jobj)
else
dom->autostart = 0;
virDomainObjUnlock(dom);
virObjectUnlock(dom);
return dom;
@ -1134,7 +1134,7 @@ parallelsLookupDomainByID(virConnectPtr conn, int id)
cleanup:
if (dom)
virDomainObjUnlock(dom);
virObjectUnlock(dom);
return ret;
}
@ -1163,7 +1163,7 @@ parallelsLookupDomainByUUID(virConnectPtr conn, const unsigned char *uuid)
cleanup:
if (dom)
virDomainObjUnlock(dom);
virObjectUnlock(dom);
return ret;
}
@ -1190,7 +1190,7 @@ parallelsLookupDomainByName(virConnectPtr conn, const char *name)
cleanup:
if (dom)
virDomainObjUnlock(dom);
virObjectUnlock(dom);
return ret;
}
@ -1219,7 +1219,7 @@ parallelsGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info)
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -1243,7 +1243,7 @@ parallelsGetOSType(virDomainPtr domain)
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
parallelsDriverUnlock(privconn);
return ret;
}
@ -1266,7 +1266,7 @@ parallelsDomainIsPersistent(virDomainPtr domain)
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
parallelsDriverUnlock(privconn);
return ret;
}
@ -1294,7 +1294,7 @@ parallelsDomainGetState(virDomainPtr domain,
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -1324,7 +1324,7 @@ parallelsDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -1349,7 +1349,7 @@ parallelsDomainGetAutostart(virDomainPtr domain, int *autostart)
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -1392,7 +1392,7 @@ parallelsDomainChangeState(virDomainPtr domain,
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -2357,10 +2357,10 @@ parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
}
if (parallelsApplyChanges(conn, olddom, def) < 0) {
virDomainObjUnlock(olddom);
virObjectUnlock(olddom);
goto cleanup;
}
virDomainObjUnlock(olddom);
virObjectUnlock(olddom);
if (!(dom = virDomainAssignDef(privconn->caps,
&privconn->domains, def, false))) {
@ -2378,7 +2378,7 @@ parallelsDomainDefineXML(virConnectPtr conn, const char *xml)
cleanup:
virDomainDefFree(def);
if (dom)
virDomainObjUnlock(dom);
virObjectUnlock(dom);
parallelsDriverUnlock(privconn);
return ret;
}

View File

@ -125,10 +125,10 @@ To lock the driver
To lock the virDomainObjPtr
virDomainObjLock()
virObjectLock()
- Acquires the virDomainObjPtr lock
virDomainObjUnlock()
virObjectUnlock()
- Releases the virDomainObjPtr lock
@ -419,9 +419,9 @@ Design patterns
...monitor job progress...
qemuDomainObjExitMonitorWithDriver(driver, obj);
virDomainObjUnlock(obj);
virObjectUnlock(obj);
sleep(aWhile);
virDomainObjLock(obj);
virObjectLock(obj);
}
...do final work...

View File

@ -82,9 +82,8 @@ struct _qemuAgentMessage {
struct _qemuAgent {
virObject object;
virObjectLockable parent;
virMutex lock; /* also used to protect fd */
virCond notify;
int fd;
@ -121,7 +120,7 @@ static void qemuAgentDispose(void *obj);
static int qemuAgentOnceInit(void)
{
if (!(qemuAgentClass = virClassNew(virClassForObject(),
if (!(qemuAgentClass = virClassNew(virClassForObjectLockable(),
"qemuAgent",
sizeof(qemuAgent),
qemuAgentDispose)))
@ -153,17 +152,6 @@ qemuAgentEscapeNonPrintable(const char *text)
}
#endif
void qemuAgentLock(qemuAgentPtr mon)
{
virMutexLock(&mon->lock);
}
void qemuAgentUnlock(qemuAgentPtr mon)
{
virMutexUnlock(&mon->lock);
}
static void qemuAgentDispose(void *obj)
{
@ -172,7 +160,6 @@ static void qemuAgentDispose(void *obj)
if (mon->cb && mon->cb->destroy)
(mon->cb->destroy)(mon, mon->vm);
ignore_value(virCondDestroy(&mon->notify));
virMutexDestroy(&mon->lock);
VIR_FREE(mon->buffer);
}
@ -592,7 +579,7 @@ qemuAgentIO(int watch, int fd, int events, void *opaque) {
virObjectRef(mon);
/* lock access to the monitor and protect fd */
qemuAgentLock(mon);
virObjectLock(mon);
#if DEBUG_IO
VIR_DEBUG("Agent %p I/O on watch %d fd %d events %d", mon, watch, fd, events);
#endif
@ -695,7 +682,7 @@ qemuAgentIO(int watch, int fd, int events, void *opaque) {
/* Make sure anyone waiting wakes up now */
virCondSignal(&mon->notify);
qemuAgentUnlock(mon);
virObjectUnlock(mon);
virObjectUnref(mon);
VIR_DEBUG("Triggering EOF callback");
(eofNotify)(mon, vm);
@ -706,12 +693,12 @@ qemuAgentIO(int watch, int fd, int events, void *opaque) {
/* Make sure anyone waiting wakes up now */
virCondSignal(&mon->notify);
qemuAgentUnlock(mon);
virObjectUnlock(mon);
virObjectUnref(mon);
VIR_DEBUG("Triggering error callback");
(errorNotify)(mon, vm);
} else {
qemuAgentUnlock(mon);
virObjectUnlock(mon);
virObjectUnref(mon);
}
}
@ -733,26 +720,18 @@ qemuAgentOpen(virDomainObjPtr vm,
if (qemuAgentInitialize() < 0)
return NULL;
if (!(mon = virObjectNew(qemuAgentClass)))
if (!(mon = virObjectLockableNew(qemuAgentClass)))
return NULL;
if (virMutexInit(&mon->lock) < 0) {
virReportSystemError(errno, "%s",
_("cannot initialize monitor mutex"));
VIR_FREE(mon);
return NULL;
}
mon->fd = -1;
if (virCondInit(&mon->notify) < 0) {
virReportSystemError(errno, "%s",
_("cannot initialize monitor condition"));
virMutexDestroy(&mon->lock);
VIR_FREE(mon);
virObjectUnref(mon);
return NULL;
}
mon->fd = -1;
mon->vm = vm;
mon->cb = cb;
qemuAgentLock(mon);
switch (config->type) {
case VIR_DOMAIN_CHR_TYPE_UNIX:
@ -774,6 +753,7 @@ qemuAgentOpen(virDomainObjPtr vm,
if (mon->fd == -1)
goto cleanup;
virObjectRef(mon);
if ((mon->watch = virEventAddHandle(mon->fd,
VIR_EVENT_HANDLE_HANGUP |
VIR_EVENT_HANDLE_ERROR |
@ -784,14 +764,13 @@ qemuAgentOpen(virDomainObjPtr vm,
qemuAgentIO,
mon,
virObjectFreeCallback)) < 0) {
virObjectUnref(mon);
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("unable to register monitor events"));
goto cleanup;
}
virObjectRef(mon);
VIR_DEBUG("New mon %p fd =%d watch=%d", mon, mon->fd, mon->watch);
qemuAgentUnlock(mon);
return mon;
@ -802,7 +781,6 @@ cleanup:
* so kill the callbacks now.
*/
mon->cb = NULL;
qemuAgentUnlock(mon);
qemuAgentClose(mon);
return NULL;
}
@ -815,7 +793,7 @@ void qemuAgentClose(qemuAgentPtr mon)
VIR_DEBUG("mon=%p", mon);
qemuAgentLock(mon);
virObjectLock(mon);
if (mon->fd >= 0) {
if (mon->watch)
@ -829,7 +807,7 @@ void qemuAgentClose(qemuAgentPtr mon)
mon->msg->finished = 1;
virCondSignal(&mon->notify);
}
qemuAgentUnlock(mon);
virObjectUnlock(mon);
virObjectUnref(mon);
}
@ -883,8 +861,8 @@ static int qemuAgentSend(qemuAgentPtr mon,
qemuAgentUpdateWatch(mon);
while (!mon->msg->finished) {
if ((then && virCondWaitUntil(&mon->notify, &mon->lock, then) < 0) ||
(!then && virCondWait(&mon->notify, &mon->lock) < 0)) {
if ((then && virCondWaitUntil(&mon->notify, &mon->parent.lock, then) < 0) ||
(!then && virCondWait(&mon->notify, &mon->parent.lock) < 0)) {
if (errno == ETIMEDOUT) {
virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s",
_("Guest agent not available for now"));

View File

@ -47,9 +47,6 @@ qemuAgentPtr qemuAgentOpen(virDomainObjPtr vm,
virDomainChrSourceDefPtr config,
qemuAgentCallbacksPtr cb);
void qemuAgentLock(qemuAgentPtr mon);
void qemuAgentUnlock(qemuAgentPtr mon);
void qemuAgentClose(qemuAgentPtr mon);
typedef enum {

View File

@ -2385,7 +2385,7 @@ qemuCapsInitQMP(qemuCapsPtr caps,
goto cleanup;
}
qemuMonitorLock(mon);
virObjectLock(mon);
if (qemuMonitorSetCapabilities(mon) < 0) {
virErrorPtr err = virGetLastError();
@ -2458,7 +2458,7 @@ qemuCapsInitQMP(qemuCapsPtr caps,
cleanup:
if (mon)
qemuMonitorUnlock(mon);
virObjectUnlock(mon);
qemuMonitorClose(mon);
virCommandAbort(cmd);
virCommandFree(cmd);

View File

@ -536,7 +536,7 @@ qemuDriverCloseCallbackRun(void *payload,
dom = closeDef->cb(data->driver, dom, data->conn);
if (dom)
virDomainObjUnlock(dom);
virObjectUnlock(dom);
virHashRemoveEntry(data->driver->closeCallbacks, uuidstr);
}

View File

@ -786,12 +786,12 @@ retry:
}
while (!nested && !qemuDomainNestedJobAllowed(priv, job)) {
if (virCondWaitUntil(&priv->job.asyncCond, &obj->lock, then) < 0)
if (virCondWaitUntil(&priv->job.asyncCond, &obj->parent.lock, then) < 0)
goto error;
}
while (priv->job.active) {
if (virCondWaitUntil(&priv->job.cond, &obj->lock, then) < 0)
if (virCondWaitUntil(&priv->job.cond, &obj->parent.lock, then) < 0)
goto error;
}
@ -818,9 +818,9 @@ retry:
}
if (driver_locked) {
virDomainObjUnlock(obj);
virObjectUnlock(obj);
qemuDriverLock(driver);
virDomainObjLock(obj);
virObjectLock(obj);
}
if (qemuDomainTrackJob(job))
@ -851,9 +851,9 @@ error:
"%s", _("cannot acquire job mutex"));
priv->jobs_queued--;
if (driver_locked) {
virDomainObjUnlock(obj);
virObjectUnlock(obj);
qemuDriverLock(driver);
virDomainObjLock(obj);
virObjectLock(obj);
}
virObjectUnref(obj);
return -1;
@ -1004,10 +1004,10 @@ qemuDomainObjEnterMonitorInternal(virQEMUDriverPtr driver,
" monitor without asking for a nested job is dangerous");
}
qemuMonitorLock(priv->mon);
virObjectLock(priv->mon);
virObjectRef(priv->mon);
ignore_value(virTimeMillisNow(&priv->monStart));
virDomainObjUnlock(obj);
virObjectUnlock(obj);
if (driver_locked)
qemuDriverUnlock(driver);
@ -1025,11 +1025,11 @@ qemuDomainObjExitMonitorInternal(virQEMUDriverPtr driver,
hasRefs = virObjectUnref(priv->mon);
if (hasRefs)
qemuMonitorUnlock(priv->mon);
virObjectUnlock(priv->mon);
if (driver_locked)
qemuDriverLock(driver);
virDomainObjLock(obj);
virObjectLock(obj);
priv->monStart = 0;
if (!hasRefs)
@ -1127,10 +1127,10 @@ qemuDomainObjEnterAgentInternal(virQEMUDriverPtr driver,
{
qemuDomainObjPrivatePtr priv = obj->privateData;
qemuAgentLock(priv->agent);
virObjectLock(priv->agent);
virObjectRef(priv->agent);
ignore_value(virTimeMillisNow(&priv->agentStart));
virDomainObjUnlock(obj);
virObjectUnlock(obj);
if (driver_locked)
qemuDriverUnlock(driver);
@ -1148,11 +1148,11 @@ qemuDomainObjExitAgentInternal(virQEMUDriverPtr driver,
hasRefs = virObjectUnref(priv->agent);
if (hasRefs)
qemuAgentUnlock(priv->agent);
virObjectUnlock(priv->agent);
if (driver_locked)
qemuDriverLock(driver);
virDomainObjLock(obj);
virObjectLock(obj);
priv->agentStart = 0;
if (!hasRefs)
@ -1214,7 +1214,7 @@ void qemuDomainObjEnterRemoteWithDriver(virQEMUDriverPtr driver,
virDomainObjPtr obj)
{
virObjectRef(obj);
virDomainObjUnlock(obj);
virObjectUnlock(obj);
qemuDriverUnlock(driver);
}
@ -1222,7 +1222,7 @@ void qemuDomainObjExitRemoteWithDriver(virQEMUDriverPtr driver,
virDomainObjPtr obj)
{
qemuDriverLock(driver);
virDomainObjLock(obj);
virObjectLock(obj);
virObjectUnref(obj);
}

View File

@ -290,7 +290,7 @@ qemuAutostartDomain(void *payload, const void *name ATTRIBUTE_UNUSED,
if (data->driver->autoStartBypassCache)
flags |= VIR_DOMAIN_START_BYPASS_CACHE;
virDomainObjLock(vm);
virObjectLock(vm);
virResetLastError();
if (vm->autostart &&
!virDomainObjIsActive(vm)) {
@ -316,7 +316,7 @@ qemuAutostartDomain(void *payload, const void *name ATTRIBUTE_UNUSED,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
}
@ -501,7 +501,7 @@ qemuDomainSnapshotLoad(void *payload,
VIR_DOMAIN_SNAPSHOT_PARSE_DISKS |
VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL);
virDomainObjLock(vm);
virObjectLock(vm);
if (virAsprintf(&snapDir, "%s/%s", baseDir, vm->def->name) < 0) {
VIR_ERROR(_("Failed to allocate memory for snapshot directory for domain %s"),
vm->def->name);
@ -591,7 +591,7 @@ cleanup:
if (dir)
closedir(dir);
VIR_FREE(snapDir);
virDomainObjUnlock(vm);
virObjectUnlock(vm);
}
@ -604,7 +604,7 @@ qemuDomainNetsRestart(void *payload,
virDomainObjPtr vm = (virDomainObjPtr)payload;
virDomainDefPtr def = vm->def;
virDomainObjLock(vm);
virObjectLock(vm);
for (i = 0; i < def->nnets; i++) {
virDomainNetDefPtr net = def->nets[i];
@ -621,7 +621,7 @@ qemuDomainNetsRestart(void *payload,
}
}
virDomainObjUnlock(vm);
virObjectUnlock(vm);
}
@ -1459,7 +1459,7 @@ static virDomainPtr qemuDomainLookupByID(virConnectPtr conn,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -1486,7 +1486,7 @@ static virDomainPtr qemuDomainLookupByUUID(virConnectPtr conn,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -1511,7 +1511,7 @@ static virDomainPtr qemuDomainLookupByName(virConnectPtr conn,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -1528,7 +1528,7 @@ static int qemuDomainIsActive(virDomainPtr dom)
cleanup:
if (obj)
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return ret;
}
@ -1544,7 +1544,7 @@ static int qemuDomainIsPersistent(virDomainPtr dom)
cleanup:
if (obj)
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return ret;
}
@ -1560,7 +1560,7 @@ static int qemuDomainIsUpdated(virDomainPtr dom)
cleanup:
if (obj)
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return ret;
}
@ -1712,7 +1712,7 @@ static virDomainPtr qemuDomainCreate(virConnectPtr conn, const char *xml,
cleanup:
virDomainDefFree(def);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event) {
qemuDomainEventQueue(driver, event);
if (event2)
@ -1798,7 +1798,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
qemuDomainEventQueue(driver, event);
@ -1862,7 +1862,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
qemuDomainEventQueue(driver, event);
qemuDriverUnlock(driver);
@ -1938,7 +1938,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2036,7 +2036,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2076,7 +2076,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2169,7 +2169,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
qemuDomainEventQueue(driver, event);
qemuDriverUnlock(driver);
@ -2194,7 +2194,7 @@ static char *qemuDomainGetOSType(virDomainPtr dom) {
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return type;
}
@ -2212,7 +2212,7 @@ qemuDomainGetMaxMemory(virDomainPtr dom)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2301,7 +2301,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2363,7 +2363,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -2432,7 +2432,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2509,7 +2509,7 @@ static int qemuDomainGetInfo(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2532,7 +2532,7 @@ qemuDomainGetState(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2582,7 +2582,7 @@ qemuDomainGetControlInfo(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -3032,7 +3032,7 @@ cleanup:
if (event)
qemuDomainEventQueue(driver, event);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -3106,7 +3106,7 @@ qemuDomainSaveFlags(virDomainPtr dom, const char *path, const char *dxml,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
@ -3172,7 +3172,7 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
VIR_FREE(name);
@ -3188,7 +3188,7 @@ qemuDomainManagedSaveLoad(void *payload,
virQEMUDriverPtr driver = opaque;
char *name;
virDomainObjLock(vm);
virObjectLock(vm);
if (!(name = qemuDomainManagedSavePath(driver, vm)))
goto cleanup;
@ -3196,7 +3196,7 @@ qemuDomainManagedSaveLoad(void *payload,
vm->hasManagedSave = virFileExists(name);
cleanup:
virDomainObjUnlock(vm);
virObjectUnlock(vm);
VIR_FREE(name);
}
@ -3212,7 +3212,7 @@ qemuDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags)
return -1;
ret = vm->hasManagedSave;
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -3244,7 +3244,7 @@ qemuDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
cleanup:
VIR_FREE(name);
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -3474,7 +3474,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
qemuDomainEventQueue(driver, event);
qemuDriverUnlock(driver);
@ -3564,7 +3564,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -3575,7 +3575,7 @@ static void processWatchdogEvent(void *data, void *opaque)
virQEMUDriverPtr driver = opaque;
qemuDriverLock(driver);
virDomainObjLock(wdEvent->vm);
virObjectLock(wdEvent->vm);
switch (wdEvent->action) {
case VIR_DOMAIN_WATCHDOG_ACTION_DUMP:
@ -3633,7 +3633,7 @@ endjob:
ignore_value(qemuDomainObjEndAsyncJob(driver, wdEvent->vm));
unlock:
virDomainObjUnlock(wdEvent->vm);
virObjectUnlock(wdEvent->vm);
virObjectUnref(wdEvent->vm);
qemuDriverUnlock(driver);
VIR_FREE(wdEvent);
@ -3933,7 +3933,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -4105,7 +4105,7 @@ cleanup:
if (cgroup_dom)
virCgroupFree(&cgroup_dom);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
virBitmapFree(pcpumap);
return ret;
}
@ -4195,7 +4195,7 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -4348,7 +4348,7 @@ cleanup:
virBitmapFree(pcpumap);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -4415,7 +4415,7 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -4504,7 +4504,7 @@ qemuDomainGetVcpus(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -4535,7 +4535,7 @@ qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -4599,7 +4599,7 @@ static int qemuDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr secl
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -4672,7 +4672,7 @@ static int qemuDomainGetSecurityLabelList(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -5041,7 +5041,7 @@ cleanup:
VIR_FORCE_CLOSE(fd);
virFileWrapperFdFree(wrapperFd);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -5276,7 +5276,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -5591,7 +5591,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -5696,7 +5696,7 @@ static virDomainPtr qemuDomainDefine(virConnectPtr conn, const char *xml) {
cleanup:
virDomainDefFree(def);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
qemuDomainEventQueue(driver, event);
virObjectUnref(caps);
@ -5793,7 +5793,7 @@ qemuDomainUndefineFlags(virDomainPtr dom,
cleanup:
VIR_FREE(name);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
qemuDomainEventQueue(driver, event);
qemuDriverUnlock(driver);
@ -6579,7 +6579,7 @@ cleanup:
virDomainDeviceDefFree(dev_copy);
virDomainDeviceDefFree(dev);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -6629,7 +6629,7 @@ static int qemuDomainGetAutostart(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -6696,7 +6696,7 @@ cleanup:
VIR_FREE(configFile);
VIR_FREE(autostartLink);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -7044,7 +7044,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
cleanup:
virCgroupFree(&group);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -7230,7 +7230,7 @@ cleanup:
if (group)
virCgroupFree(&group);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -7399,7 +7399,7 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
cleanup:
virCgroupFree(&group);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -7559,7 +7559,7 @@ cleanup:
if (group)
virCgroupFree(&group);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -7708,7 +7708,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
cleanup:
virCgroupFree(&group);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -7821,7 +7821,7 @@ cleanup:
VIR_FREE(nodeset);
virCgroupFree(&group);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -8072,7 +8072,7 @@ cleanup:
virDomainDefFree(vmdef);
virCgroupFree(&group);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -8331,7 +8331,7 @@ out:
cleanup:
virCgroupFree(&group);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -8426,7 +8426,7 @@ endjob:
cleanup:
VIR_FREE(device);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -8497,7 +8497,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -8667,7 +8667,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -8707,7 +8707,7 @@ qemuDomainInterfaceStats(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
#else
@ -8891,7 +8891,7 @@ cleanup:
virNetDevBandwidthFree(newBandwidth);
virCgroupFree(&group);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -9013,7 +9013,7 @@ cleanup:
if (group)
virCgroupFree(&group);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -9064,7 +9064,7 @@ qemuDomainMemoryStats(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -9122,7 +9122,7 @@ qemuDomainBlockPeek(virDomainPtr dom,
cleanup:
VIR_FORCE_CLOSE(fd);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -9207,7 +9207,7 @@ cleanup:
unlink(tmp);
VIR_FREE(tmp);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -9352,7 +9352,7 @@ cleanup:
virStorageFileFreeMetadata(meta);
VIR_FORCE_CLOSE(fd);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -9724,7 +9724,7 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return xml;
@ -9959,7 +9959,7 @@ qemuDomainMigrateConfirm3(virDomainPtr domain,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -10196,7 +10196,7 @@ static int qemuDomainGetJobInfo(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -10244,7 +10244,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -10292,7 +10292,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -10340,7 +10340,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -10364,7 +10364,7 @@ qemuDomainMigrateGetMaxSpeed(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -11608,7 +11608,7 @@ cleanup:
} else if (snap) {
virDomainSnapshotObjListRemove(vm->snapshots, snap);
}
virDomainObjUnlock(vm);
virObjectUnlock(vm);
}
virDomainSnapshotDefFree(def);
VIR_FREE(xml);
@ -11634,7 +11634,7 @@ static int qemuDomainSnapshotListNames(virDomainPtr domain, char **names,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return n;
}
@ -11654,7 +11654,7 @@ static int qemuDomainSnapshotNum(virDomainPtr domain,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return n;
}
@ -11675,7 +11675,7 @@ qemuDomainListAllSnapshots(virDomainPtr domain, virDomainSnapshotPtr **snaps,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return n;
}
@ -11703,7 +11703,7 @@ qemuDomainSnapshotListChildrenNames(virDomainSnapshotPtr snapshot,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return n;
}
@ -11728,7 +11728,7 @@ qemuDomainSnapshotNumChildren(virDomainSnapshotPtr snapshot,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return n;
}
@ -11755,7 +11755,7 @@ qemuDomainSnapshotListAllChildren(virDomainSnapshotPtr snapshot,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return n;
}
@ -11779,7 +11779,7 @@ static virDomainSnapshotPtr qemuDomainSnapshotLookupByName(virDomainPtr domain,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return snapshot;
}
@ -11798,7 +11798,7 @@ static int qemuDomainHasCurrentSnapshot(virDomainPtr domain,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -11829,7 +11829,7 @@ qemuDomainSnapshotGetParent(virDomainSnapshotPtr snapshot,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return parent;
}
@ -11854,7 +11854,7 @@ static virDomainSnapshotPtr qemuDomainSnapshotCurrent(virDomainPtr domain,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return snapshot;
}
@ -11880,7 +11880,7 @@ static char *qemuDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return xml;
}
@ -11905,7 +11905,7 @@ qemuDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -11933,7 +11933,7 @@ qemuDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -12276,7 +12276,7 @@ cleanup:
qemuDomainEventQueue(driver, event2);
}
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
@ -12431,7 +12431,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -12482,7 +12482,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -12573,7 +12573,7 @@ cleanup:
virObjectUnref(caps);
virDomainChrSourceDefFree(monConfig);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
VIR_FREE(pidfile);
return dom;
@ -12655,7 +12655,7 @@ qemuDomainOpenConsole(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -12727,7 +12727,7 @@ qemuDomainOpenChannel(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -13060,13 +13060,13 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base,
if (ret <= 0)
break;
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
nanosleep(&ts, NULL);
qemuDriverLock(driver);
virDomainObjLock(vm);
virObjectLock(vm);
if (!virDomainObjIsActive(vm)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
@ -13087,7 +13087,7 @@ endjob:
cleanup:
VIR_FREE(device);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
qemuDomainEventQueue(driver, event);
qemuDriverUnlock(driver);
@ -13299,7 +13299,7 @@ cleanup:
virCgroupFree(&cgroup);
VIR_FREE(device);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -13477,7 +13477,7 @@ endjob:
cleanup:
VIR_FREE(device);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -13545,7 +13545,7 @@ qemuDomainOpenGraphics(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -13717,7 +13717,7 @@ endjob:
cleanup:
VIR_FREE(device);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -13853,7 +13853,7 @@ endjob:
cleanup:
VIR_FREE(device);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -13925,7 +13925,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
virHashFree(table);
if (ret < 0) {
for (i = 0; i < n; i++)
@ -14019,7 +14019,7 @@ qemuDomainSetMetadata(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
no_memory:
virReportOOMError();
@ -14084,7 +14084,7 @@ qemuDomainGetMetadata(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -14355,7 +14355,7 @@ qemuDomainGetCPUStats(virDomainPtr domain,
cleanup:
virCgroupFree(&group);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
return ret;
}
@ -14457,7 +14457,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -14503,7 +14503,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -14587,7 +14587,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return result;
}
@ -14654,7 +14654,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}

View File

@ -1267,13 +1267,13 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver, virDomainObjPtr vm,
goto cleanup;
}
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
nanosleep(&ts, NULL);
qemuDriverLock(driver);
virDomainObjLock(vm);
virObjectLock(vm);
}
cleanup:
@ -1751,7 +1751,7 @@ cleanup:
VIR_FORCE_CLOSE(dataFD[1]);
if (vm) {
if (ret >= 0 || vm->persistent)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
else
qemuDomainRemoveInactive(driver, vm);
}
@ -3096,7 +3096,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
qemuDomainEventQueue(driver, event);
return ret;
@ -3180,7 +3180,7 @@ endjob:
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
qemuDomainEventQueue(driver, event);
return ret;
@ -3493,7 +3493,7 @@ endjob:
cleanup:
if (vm) {
VIR_FREE(priv->origname);
virDomainObjUnlock(vm);
virObjectUnlock(vm);
}
if (event)
qemuDomainEventQueue(driver, event);

View File

@ -48,9 +48,8 @@
#define DEBUG_RAW_IO 0
struct _qemuMonitor {
virObject object;
virObjectLockable parent;
virMutex lock; /* also used to protect fd */
virCond notify;
int fd;
@ -86,7 +85,7 @@ static void qemuMonitorDispose(void *obj);
static int qemuMonitorOnceInit(void)
{
if (!(qemuMonitorClass = virClassNew(virClassForObject(),
if (!(qemuMonitorClass = virClassNew(virClassForObjectLockable(),
"qemuMonitor",
sizeof(qemuMonitor),
qemuMonitorDispose)))
@ -230,17 +229,6 @@ static char * qemuMonitorEscapeNonPrintable(const char *text)
}
#endif
void qemuMonitorLock(qemuMonitorPtr mon)
{
virMutexLock(&mon->lock);
}
void qemuMonitorUnlock(qemuMonitorPtr mon)
{
virMutexUnlock(&mon->lock);
}
static void qemuMonitorDispose(void *obj)
{
qemuMonitorPtr mon = obj;
@ -250,7 +238,6 @@ static void qemuMonitorDispose(void *obj)
(mon->cb->destroy)(mon, mon->vm);
if (virCondDestroy(&mon->notify) < 0)
{}
virMutexDestroy(&mon->lock);
VIR_FREE(mon->buffer);
}
@ -563,12 +550,12 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) {
virObjectRef(mon);
/* lock access to the monitor and protect fd */
qemuMonitorLock(mon);
virObjectLock(mon);
#if DEBUG_IO
VIR_DEBUG("Monitor %p I/O on watch %d fd %d events %d", mon, watch, fd, events);
#endif
if (mon->fd == -1 || mon->watch == 0) {
qemuMonitorUnlock(mon);
virObjectUnlock(mon);
virObjectUnref(mon);
return;
}
@ -666,7 +653,7 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) {
/* Make sure anyone waiting wakes up now */
virCondSignal(&mon->notify);
qemuMonitorUnlock(mon);
virObjectUnlock(mon);
virObjectUnref(mon);
VIR_DEBUG("Triggering EOF callback");
(eofNotify)(mon, vm);
@ -677,12 +664,12 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) {
/* Make sure anyone waiting wakes up now */
virCondSignal(&mon->notify);
qemuMonitorUnlock(mon);
virObjectUnlock(mon);
virObjectUnref(mon);
VIR_DEBUG("Triggering error callback");
(errorNotify)(mon, vm);
} else {
qemuMonitorUnlock(mon);
virObjectUnlock(mon);
virObjectUnref(mon);
}
}
@ -711,21 +698,14 @@ qemuMonitorOpenInternal(virDomainObjPtr vm,
if (qemuMonitorInitialize() < 0)
return NULL;
if (!(mon = virObjectNew(qemuMonitorClass)))
if (!(mon = virObjectLockableNew(qemuMonitorClass)))
return NULL;
if (virMutexInit(&mon->lock) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot initialize monitor mutex"));
VIR_FREE(mon);
return NULL;
}
mon->fd = -1;
if (virCondInit(&mon->notify) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot initialize monitor condition"));
virMutexDestroy(&mon->lock);
VIR_FREE(mon);
return NULL;
goto cleanup;
}
mon->fd = fd;
mon->hasSendFD = hasSendFD;
@ -734,7 +714,7 @@ qemuMonitorOpenInternal(virDomainObjPtr vm,
if (json)
mon->wait_greeting = 1;
mon->cb = cb;
qemuMonitorLock(mon);
virObjectLock(mon);
if (virSetCloseExec(mon->fd) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@ -748,6 +728,7 @@ qemuMonitorOpenInternal(virDomainObjPtr vm,
}
virObjectRef(mon);
if ((mon->watch = virEventAddHandle(mon->fd,
VIR_EVENT_HANDLE_HANGUP |
VIR_EVENT_HANDLE_ERROR |
@ -755,16 +736,16 @@ qemuMonitorOpenInternal(virDomainObjPtr vm,
qemuMonitorIO,
mon,
virObjectFreeCallback)) < 0) {
virObjectUnref(mon);
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("unable to register monitor events"));
goto cleanup;
}
virObjectRef(mon);
PROBE(QEMU_MONITOR_NEW,
"mon=%p refs=%d fd=%d",
mon, mon->object.refs, mon->fd);
qemuMonitorUnlock(mon);
mon, mon->parent.parent.refs, mon->fd);
virObjectUnlock(mon);
return mon;
@ -775,7 +756,7 @@ cleanup:
* so kill the callbacks now.
*/
mon->cb = NULL;
qemuMonitorUnlock(mon);
virObjectUnlock(mon);
/* The caller owns 'fd' on failure */
mon->fd = -1;
if (mon->watch)
@ -834,9 +815,9 @@ void qemuMonitorClose(qemuMonitorPtr mon)
if (!mon)
return;
qemuMonitorLock(mon);
virObjectLock(mon);
PROBE(QEMU_MONITOR_CLOSE,
"mon=%p refs=%d", mon, mon->object.refs);
"mon=%p refs=%d", mon, mon->parent.parent.refs);
if (mon->fd >= 0) {
if (mon->watch) {
@ -867,7 +848,7 @@ void qemuMonitorClose(qemuMonitorPtr mon)
virCondSignal(&mon->notify);
}
qemuMonitorUnlock(mon);
virObjectUnlock(mon);
virObjectUnref(mon);
}
@ -905,7 +886,7 @@ int qemuMonitorSend(qemuMonitorPtr mon,
mon, mon->msg->txBuffer, mon->msg->txFD);
while (!mon->msg->finished) {
if (virCondWait(&mon->notify, &mon->lock) < 0) {
if (virCondWait(&mon->notify, &mon->parent.lock) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unable to wait on monitor condition"));
goto cleanup;
@ -960,10 +941,10 @@ cleanup:
#define QEMU_MONITOR_CALLBACK(mon, ret, callback, ...) \
do { \
virObjectRef(mon); \
qemuMonitorUnlock(mon); \
virObjectUnlock(mon); \
if ((mon)->cb && (mon)->cb->callback) \
(ret) = ((mon)->cb->callback)(mon, __VA_ARGS__); \
qemuMonitorLock(mon); \
virObjectLock(mon); \
virObjectUnref(mon); \
} while (0)

View File

@ -160,9 +160,6 @@ void qemuMonitorClose(qemuMonitorPtr mon);
int qemuMonitorSetCapabilities(qemuMonitorPtr mon);
void qemuMonitorLock(qemuMonitorPtr mon);
void qemuMonitorUnlock(qemuMonitorPtr mon);
int qemuMonitorSetLink(qemuMonitorPtr mon,
const char *name,
enum virDomainNetInterfaceLinkState state) ;

View File

@ -130,14 +130,14 @@ qemuProcessHandleAgentEOF(qemuAgentPtr agent,
VIR_DEBUG("Received EOF from agent on %p '%s'", vm, vm->def->name);
qemuDriverLock(driver);
virDomainObjLock(vm);
virObjectLock(vm);
priv = vm->privateData;
if (priv->agent == agent &&
!virObjectUnref(priv->agent))
priv->agent = NULL;
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
qemuAgentClose(agent);
@ -160,13 +160,13 @@ qemuProcessHandleAgentError(qemuAgentPtr agent ATTRIBUTE_UNUSED,
VIR_DEBUG("Received error from agent on %p '%s'", vm, vm->def->name);
qemuDriverLock(driver);
virDomainObjLock(vm);
virObjectLock(vm);
priv = vm->privateData;
priv->agentError = true;
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
}
@ -229,7 +229,7 @@ qemuConnectAgent(virQEMUDriverPtr driver, virDomainObjPtr vm)
virObjectRef(vm);
ignore_value(virTimeMillisNow(&priv->agentStart));
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
agent = qemuAgentOpen(vm,
@ -237,7 +237,7 @@ qemuConnectAgent(virQEMUDriverPtr driver, virDomainObjPtr vm)
&agentCallbacks);
qemuDriverLock(driver);
virDomainObjLock(vm);
virObjectLock(vm);
priv->agentStart = 0;
if (virSecurityManagerClearSocketLabel(driver->securityManager,
@ -288,7 +288,7 @@ qemuProcessHandleMonitorEOF(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
VIR_DEBUG("Received EOF on %p '%s'", vm, vm->def->name);
qemuDriverLock(driver);
virDomainObjLock(vm);
virObjectLock(vm);
priv = vm->privateData;
@ -322,7 +322,7 @@ qemuProcessHandleMonitorEOF(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
unlock:
virDomainObjUnlock(vm);
virObjectUnlock(vm);
cleanup:
if (event)
@ -347,14 +347,14 @@ qemuProcessHandleMonitorError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
VIR_DEBUG("Received error on %p '%s'", vm, vm->def->name);
qemuDriverLock(driver);
virDomainObjLock(vm);
virObjectLock(vm);
((qemuDomainObjPrivatePtr) vm->privateData)->monError = true;
event = virDomainEventControlErrorNewFromObj(vm);
if (event)
qemuDomainEventQueue(driver, event);
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
}
@ -492,7 +492,7 @@ qemuProcessFindVolumeQcowPassphrase(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virDomainDiskDefPtr disk;
int ret = -1;
virDomainObjLock(vm);
virObjectLock(vm);
disk = qemuProcessFindDomainDiskByPath(vm, path);
if (!disk)
@ -501,7 +501,7 @@ qemuProcessFindVolumeQcowPassphrase(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
ret = qemuProcessGetVolumeQcowPassphrase(conn, disk, secretRet, secretLen);
cleanup:
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -514,14 +514,14 @@ qemuProcessHandleReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virDomainEventPtr event;
qemuDomainObjPrivatePtr priv;
virDomainObjLock(vm);
virObjectLock(vm);
event = virDomainEventRebootNewFromObj(vm);
priv = vm->privateData;
if (priv->agent)
qemuAgentNotifyEvent(priv->agent, QEMU_AGENT_EVENT_RESET);
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event) {
qemuDriverLock(driver);
@ -551,7 +551,7 @@ qemuProcessFakeReboot(void *opaque)
int ret = -1;
VIR_DEBUG("vm=%p", vm);
qemuDriverLock(driver);
virDomainObjLock(vm);
virObjectLock(vm);
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup;
@ -600,7 +600,7 @@ cleanup:
VIR_QEMU_PROCESS_KILL_FORCE));
}
if (virObjectUnref(vm))
virDomainObjUnlock(vm);
virObjectUnlock(vm);
}
if (event)
qemuDomainEventQueue(driver, event);
@ -642,7 +642,7 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
VIR_DEBUG("vm=%p", vm);
virDomainObjLock(vm);
virObjectLock(vm);
priv = vm->privateData;
if (priv->gotShutdown) {
@ -676,7 +676,7 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
qemuProcessShutdownOrReboot(driver, vm);
unlock:
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event) {
qemuDriverLock(driver);
@ -695,7 +695,7 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virQEMUDriverPtr driver = qemu_driver;
virDomainEventPtr event = NULL;
virDomainObjLock(vm);
virObjectLock(vm);
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
qemuDomainObjPrivatePtr priv = vm->privateData;
@ -724,7 +724,7 @@ qemuProcessHandleStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
unlock:
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event) {
qemuDriverLock(driver);
@ -743,7 +743,7 @@ qemuProcessHandleResume(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virQEMUDriverPtr driver = qemu_driver;
virDomainEventPtr event = NULL;
virDomainObjLock(vm);
virObjectLock(vm);
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
qemuDomainObjPrivatePtr priv = vm->privateData;
@ -779,7 +779,7 @@ qemuProcessHandleResume(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
unlock:
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event) {
qemuDriverLock(driver);
@ -799,7 +799,7 @@ qemuProcessHandleRTCChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virQEMUDriverPtr driver = qemu_driver;
virDomainEventPtr event;
virDomainObjLock(vm);
virObjectLock(vm);
event = virDomainEventRTCChangeNewFromObj(vm, offset);
if (vm->def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_VARIABLE)
@ -808,7 +808,7 @@ qemuProcessHandleRTCChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
VIR_WARN("unable to save domain status with RTC change");
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event) {
qemuDriverLock(driver);
@ -829,7 +829,7 @@ qemuProcessHandleWatchdog(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virDomainEventPtr watchdogEvent = NULL;
virDomainEventPtr lifecycleEvent = NULL;
virDomainObjLock(vm);
virObjectLock(vm);
watchdogEvent = virDomainEventWatchdogNewFromObj(vm, action);
if (action == VIR_DOMAIN_EVENT_WATCHDOG_PAUSE &&
@ -873,7 +873,7 @@ qemuProcessHandleWatchdog(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (watchdogEvent || lifecycleEvent) {
qemuDriverLock(driver);
@ -903,7 +903,7 @@ qemuProcessHandleIOError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
const char *devAlias;
virDomainDiskDefPtr disk;
virDomainObjLock(vm);
virObjectLock(vm);
disk = qemuProcessFindDomainDiskByAlias(vm, diskAlias);
if (disk) {
@ -935,7 +935,7 @@ qemuProcessHandleIOError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
VIR_WARN("Unable to save status on vm %s after IO error", vm->def->name);
}
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (ioErrorEvent || ioErrorEvent2 || lifecycleEvent) {
qemuDriverLock(driver);
@ -963,7 +963,7 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
const char *path;
virDomainDiskDefPtr disk;
virDomainObjLock(vm);
virObjectLock(vm);
disk = qemuProcessFindDomainDiskByAlias(vm, diskAlias);
if (disk) {
@ -985,7 +985,7 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
disk->mirroring = true;
}
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event) {
qemuDriverLock(driver);
@ -1050,9 +1050,9 @@ qemuProcessHandleGraphics(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
goto no_memory;
}
virDomainObjLock(vm);
virObjectLock(vm);
event = virDomainEventGraphicsNewFromObj(vm, phase, localAddr, remoteAddr, authScheme, subject);
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event) {
qemuDriverLock(driver);
@ -1103,7 +1103,7 @@ qemuProcessHandleTrayChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virDomainEventPtr event = NULL;
virDomainDiskDefPtr disk;
virDomainObjLock(vm);
virObjectLock(vm);
disk = qemuProcessFindDomainDiskByAlias(vm, devAlias);
if (disk) {
@ -1122,7 +1122,7 @@ qemuProcessHandleTrayChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
}
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event) {
qemuDriverLock(driver);
@ -1141,7 +1141,7 @@ qemuProcessHandlePMWakeup(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virDomainEventPtr event = NULL;
virDomainEventPtr lifecycleEvent = NULL;
virDomainObjLock(vm);
virObjectLock(vm);
event = virDomainEventPMWakeupNewFromObj(vm);
/* Don't set domain status back to running if it wasn't paused
@ -1163,7 +1163,7 @@ qemuProcessHandlePMWakeup(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
}
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event || lifecycleEvent) {
qemuDriverLock(driver);
@ -1185,7 +1185,7 @@ qemuProcessHandlePMSuspend(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virDomainEventPtr event = NULL;
virDomainEventPtr lifecycleEvent = NULL;
virDomainObjLock(vm);
virObjectLock(vm);
event = virDomainEventPMSuspendNewFromObj(vm);
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
@ -1209,7 +1209,7 @@ qemuProcessHandlePMSuspend(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
qemuAgentNotifyEvent(priv->agent, QEMU_AGENT_EVENT_SUSPEND);
}
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event || lifecycleEvent) {
qemuDriverLock(driver);
@ -1231,7 +1231,7 @@ qemuProcessHandleBalloonChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virQEMUDriverPtr driver = qemu_driver;
virDomainEventPtr event;
virDomainObjLock(vm);
virObjectLock(vm);
event = virDomainEventBalloonChangeNewFromObj(vm, actual);
VIR_DEBUG("Updating balloon from %lld to %lld kb",
@ -1241,7 +1241,7 @@ qemuProcessHandleBalloonChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
VIR_WARN("unable to save domain status with balloon change");
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event) {
qemuDriverLock(driver);
@ -1260,7 +1260,7 @@ qemuProcessHandlePMSuspendDisk(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virDomainEventPtr event = NULL;
virDomainEventPtr lifecycleEvent = NULL;
virDomainObjLock(vm);
virObjectLock(vm);
event = virDomainEventPMSuspendDiskNewFromObj(vm);
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
@ -1284,7 +1284,7 @@ qemuProcessHandlePMSuspendDisk(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
qemuAgentNotifyEvent(priv->agent, QEMU_AGENT_EVENT_SUSPEND);
}
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event || lifecycleEvent) {
qemuDriverLock(driver);
@ -1339,7 +1339,7 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm)
virObjectRef(vm);
ignore_value(virTimeMillisNow(&priv->monStart));
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverUnlock(driver);
mon = qemuMonitorOpen(vm,
@ -1348,7 +1348,7 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm)
&monitorCallbacks);
qemuDriverLock(driver);
virDomainObjLock(vm);
virObjectLock(vm);
priv->monStart = 0;
if (mon == NULL) {
@ -3210,7 +3210,7 @@ qemuProcessReconnect(void *opaque)
VIR_FREE(data);
qemuDriverLock(driver);
virDomainObjLock(obj);
virObjectLock(obj);
VIR_DEBUG("Reconnect monitor to %p '%s'", obj, obj->def->name);
@ -3323,7 +3323,7 @@ endjob:
obj = NULL;
if (obj && virObjectUnref(obj))
virDomainObjUnlock(obj);
virObjectUnlock(obj);
qemuDriverUnlock(driver);
@ -3338,7 +3338,7 @@ error:
if (obj) {
if (!virDomainObjIsActive(obj)) {
if (virObjectUnref(obj))
virDomainObjUnlock(obj);
virObjectUnlock(obj);
qemuDriverUnlock(driver);
return;
}
@ -3362,7 +3362,7 @@ error:
if (!obj->persistent)
qemuDomainRemoveInactive(driver, obj);
else
virDomainObjUnlock(obj);
virObjectUnlock(obj);
}
}
qemuDriverUnlock(driver);
@ -3411,7 +3411,7 @@ qemuProcessReconnectHelper(void *payload,
* this early phase.
*/
virDomainObjLock(obj);
virObjectLock(obj);
qemuDomainObjRestoreJob(obj, &data->oldjob);
@ -3440,12 +3440,12 @@ qemuProcessReconnectHelper(void *payload,
if (!obj->persistent)
qemuDomainRemoveInactive(src->driver, obj);
else
virDomainObjUnlock(obj);
virObjectUnlock(obj);
}
goto error;
}
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return;
@ -4160,9 +4160,9 @@ qemuProcessKill(virQEMUDriverPtr driver,
if (driver) {
virObjectRef(vm);
virDomainObjUnlock(vm);
virObjectUnlock(vm);
qemuDriverLock(driver);
virDomainObjLock(vm);
virObjectLock(vm);
virObjectUnref(vm);
}

View File

@ -571,11 +571,11 @@ static int testOpenDefault(virConnectPtr conn) {
domobj->persistent = 1;
if (testDomainStartState(conn, domobj, VIR_DOMAIN_RUNNING_BOOTED) < 0) {
virDomainObjUnlock(domobj);
virObjectUnlock(domobj);
goto error;
}
virDomainObjUnlock(domobj);
virObjectUnlock(domobj);
if (!(netdef = virNetworkDefParseString(defaultNetworkXML)))
goto error;
@ -916,11 +916,11 @@ static int testOpenFromFile(virConnectPtr conn,
dom->persistent = 1;
if (testDomainStartState(conn, dom, VIR_DOMAIN_RUNNING_BOOTED) < 0) {
virDomainObjUnlock(dom);
virObjectUnlock(dom);
goto error;
}
virDomainObjUnlock(dom);
virObjectUnlock(dom);
}
VIR_FREE(domains);
@ -1258,7 +1258,7 @@ static int testDomainIsActive(virDomainPtr dom)
cleanup:
if (obj)
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return ret;
}
@ -1279,7 +1279,7 @@ static int testDomainIsPersistent(virDomainPtr dom)
cleanup:
if (obj)
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return ret;
}
@ -1329,7 +1329,7 @@ testDomainCreateXML(virConnectPtr conn, const char *xml,
cleanup:
if (dom)
virDomainObjUnlock(dom);
virObjectUnlock(dom);
if (event)
testDomainEventQueue(privconn, event);
virDomainDefFree(def);
@ -1360,7 +1360,7 @@ static virDomainPtr testLookupDomainByID(virConnectPtr conn,
cleanup:
if (dom)
virDomainObjUnlock(dom);
virObjectUnlock(dom);
return ret;
}
@ -1386,7 +1386,7 @@ static virDomainPtr testLookupDomainByUUID(virConnectPtr conn,
cleanup:
if (dom)
virDomainObjUnlock(dom);
virObjectUnlock(dom);
return ret;
}
@ -1412,7 +1412,7 @@ static virDomainPtr testLookupDomainByName(virConnectPtr conn,
cleanup:
if (dom)
virDomainObjUnlock(dom);
virObjectUnlock(dom);
return ret;
}
@ -1460,7 +1460,7 @@ static int testDestroyDomain(virDomainPtr domain)
ret = 0;
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
if (event)
testDomainEventQueue(privconn, event);
testDriverUnlock(privconn);
@ -1499,7 +1499,7 @@ static int testResumeDomain(virDomainPtr domain)
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
if (event) {
testDriverLock(privconn);
testDomainEventQueue(privconn, event);
@ -1541,7 +1541,7 @@ static int testPauseDomain(virDomainPtr domain)
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
if (event) {
testDriverLock(privconn);
@ -1590,7 +1590,7 @@ static int testShutdownDomainFlags(virDomainPtr domain,
ret = 0;
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
if (event)
testDomainEventQueue(privconn, event);
testDriverUnlock(privconn);
@ -1666,7 +1666,7 @@ static int testRebootDomain(virDomainPtr domain,
ret = 0;
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
if (event)
testDomainEventQueue(privconn, event);
testDriverUnlock(privconn);
@ -1706,7 +1706,7 @@ static int testGetDomainInfo(virDomainPtr domain,
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -1737,7 +1737,7 @@ testDomainGetState(virDomainPtr domain,
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -1838,7 +1838,7 @@ cleanup:
unlink(path);
}
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
if (event)
testDomainEventQueue(privconn, event);
testDriverUnlock(privconn);
@ -1945,7 +1945,7 @@ cleanup:
VIR_FREE(xml);
VIR_FORCE_CLOSE(fd);
if (dom)
virDomainObjUnlock(dom);
virObjectUnlock(dom);
if (event)
testDomainEventQueue(privconn, event);
testDriverUnlock(privconn);
@ -2015,7 +2015,7 @@ static int testDomainCoreDump(virDomainPtr domain,
cleanup:
VIR_FORCE_CLOSE(fd);
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
if (event)
testDomainEventQueue(privconn, event);
testDriverUnlock(privconn);
@ -2048,7 +2048,7 @@ static unsigned long long testGetMaxMemory(virDomainPtr domain) {
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -2075,7 +2075,7 @@ static int testSetMaxMemory(virDomainPtr domain,
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -2106,7 +2106,7 @@ static int testSetMemory(virDomainPtr domain,
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -2144,7 +2144,7 @@ testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2242,7 +2242,7 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -2336,7 +2336,7 @@ static int testDomainGetVcpus(virDomainPtr domain,
ret = maxinfo;
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -2393,7 +2393,7 @@ static int testDomainPinVcpu(virDomainPtr domain,
ret = 0;
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -2424,7 +2424,7 @@ static char *testDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -2493,7 +2493,7 @@ static virDomainPtr testDomainDefineXML(virConnectPtr conn,
cleanup:
virDomainDefFree(def);
if (dom)
virDomainObjUnlock(dom);
virObjectUnlock(dom);
if (event)
testDomainEventQueue(privconn, event);
testDriverUnlock(privconn);
@ -2562,7 +2562,7 @@ static int testDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) {
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
if (event)
testDomainEventQueue(privconn, event);
testDriverUnlock(privconn);
@ -2607,7 +2607,7 @@ static int testDomainUndefineFlags(virDomainPtr domain,
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
if (event)
testDomainEventQueue(privconn, event);
testDriverUnlock(privconn);
@ -2641,7 +2641,7 @@ static int testDomainGetAutostart(virDomainPtr domain,
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -2668,7 +2668,7 @@ static int testDomainSetAutostart(virDomainPtr domain,
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -2720,7 +2720,7 @@ testDomainGetSchedulerParamsFlags(virDomainPtr domain,
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -2770,7 +2770,7 @@ testDomainSetSchedulerParamsFlags(virDomainPtr domain,
cleanup:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -2825,7 +2825,7 @@ static int testDomainBlockStats(virDomainPtr domain,
ret = 0;
error:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}
@ -2883,7 +2883,7 @@ static int testDomainInterfaceStats(virDomainPtr domain,
ret = 0;
error:
if (privdom)
virDomainObjUnlock(privdom);
virObjectUnlock(privdom);
return ret;
}

View File

@ -185,7 +185,7 @@ umlAutostartDomain(void *payload, const void *name ATTRIBUTE_UNUSED, void *opaqu
virDomainObjPtr vm = payload;
const struct umlAutostartData *data = opaque;
virDomainObjLock(vm);
virObjectLock(vm);
if (vm->autostart &&
!virDomainObjIsActive(vm)) {
int ret;
@ -205,7 +205,7 @@ umlAutostartDomain(void *payload, const void *name ATTRIBUTE_UNUSED, void *opaqu
umlDomainEventQueue(data->driver, event);
}
}
virDomainObjUnlock(vm);
virObjectUnlock(vm);
}
static void
@ -345,7 +345,7 @@ reread:
if (e->mask & IN_DELETE) {
VIR_DEBUG("Got inotify domain shutdown '%s'", name);
if (!virDomainObjIsActive(dom)) {
virDomainObjUnlock(dom);
virObjectUnlock(dom);
continue;
}
@ -362,12 +362,12 @@ reread:
} else if (e->mask & (IN_CREATE | IN_MODIFY)) {
VIR_DEBUG("Got inotify domain startup '%s'", name);
if (virDomainObjIsActive(dom)) {
virDomainObjUnlock(dom);
virObjectUnlock(dom);
continue;
}
if (umlReadPidFile(driver, dom) < 0) {
virDomainObjUnlock(dom);
virObjectUnlock(dom);
continue;
}
@ -409,7 +409,7 @@ reread:
}
}
if (dom)
virDomainObjUnlock(dom);
virObjectUnlock(dom);
}
cleanup:
@ -606,12 +606,12 @@ umlShutdownOneVM(void *payload, const void *name ATTRIBUTE_UNUSED, void *opaque)
virDomainObjPtr dom = payload;
struct uml_driver *driver = opaque;
virDomainObjLock(dom);
virObjectLock(dom);
if (virDomainObjIsActive(dom)) {
umlShutdownVMDaemon(driver, dom, VIR_DOMAIN_SHUTOFF_SHUTDOWN);
virDomainAuditStop(dom, "shutdown");
}
virDomainObjUnlock(dom);
virObjectUnlock(dom);
}
/**
@ -705,7 +705,7 @@ static void umlProcessAutoDestroyDom(void *payload,
virDomainRemoveInactive(&data->driver->domains, dom);
if (dom)
virDomainObjUnlock(dom);
virObjectUnlock(dom);
if (event)
umlDomainEventQueue(data->driver, event);
virHashRemoveEntry(data->driver->autodestroy, uuidstr);
@ -1320,7 +1320,7 @@ static virDomainPtr umlDomainLookupByID(virConnectPtr conn,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -1344,7 +1344,7 @@ static virDomainPtr umlDomainLookupByUUID(virConnectPtr conn,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -1368,7 +1368,7 @@ static virDomainPtr umlDomainLookupByName(virConnectPtr conn,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -1390,7 +1390,7 @@ static int umlDomainIsActive(virDomainPtr dom)
cleanup:
if (obj)
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return ret;
}
@ -1412,7 +1412,7 @@ static int umlDomainIsPersistent(virDomainPtr dom)
cleanup:
if (obj)
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return ret;
}
@ -1433,7 +1433,7 @@ static int umlDomainIsUpdated(virDomainPtr dom)
cleanup:
if (obj)
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return ret;
}
@ -1526,7 +1526,7 @@ static virDomainPtr umlDomainCreate(virConnectPtr conn, const char *xml,
cleanup:
virDomainDefFree(def);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
umlDomainEventQueue(driver, event);
umlDriverUnlock(driver);
@ -1564,7 +1564,7 @@ static int umlDomainShutdownFlags(virDomainPtr dom,
cleanup:
VIR_FREE(info);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -1607,7 +1607,7 @@ umlDomainDestroyFlags(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
umlDomainEventQueue(driver, event);
umlDriverUnlock(driver);
@ -1640,7 +1640,7 @@ static char *umlDomainGetOSType(virDomainPtr dom) {
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return type;
}
@ -1668,7 +1668,7 @@ umlDomainGetMaxMemory(virDomainPtr dom)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -1701,7 +1701,7 @@ static int umlDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) {
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -1740,7 +1740,7 @@ static int umlDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -1779,7 +1779,7 @@ static int umlDomainGetInfo(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -1811,7 +1811,7 @@ umlDomainGetState(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -1841,7 +1841,7 @@ static char *umlDomainGetXMLDesc(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -1897,7 +1897,7 @@ static int umlDomainStartWithFlags(virDomainPtr dom, unsigned int flags) {
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
if (event)
umlDomainEventQueue(driver, event);
umlDriverUnlock(driver);
@ -1944,7 +1944,7 @@ static virDomainPtr umlDomainDefine(virConnectPtr conn, const char *xml) {
cleanup:
virDomainDefFree(def);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
umlDriverUnlock(driver);
return dom;
}
@ -1986,7 +1986,7 @@ static int umlDomainUndefineFlags(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
umlDriverUnlock(driver);
return ret;
}
@ -2099,7 +2099,7 @@ cleanup:
virDomainDeviceDefFree(dev);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
umlDriverUnlock(driver);
return ret;
}
@ -2211,7 +2211,7 @@ static int umlDomainDetachDevice(virDomainPtr dom, const char *xml) {
cleanup:
virDomainDeviceDefFree(dev);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
umlDriverUnlock(driver);
return ret;
}
@ -2254,7 +2254,7 @@ static int umlDomainGetAutostart(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
umlDriverUnlock(driver);
return ret;
}
@ -2320,7 +2320,7 @@ cleanup:
VIR_FREE(configFile);
VIR_FREE(autostartLink);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
umlDriverUnlock(driver);
return ret;
}
@ -2388,7 +2388,7 @@ umlDomainBlockPeek(virDomainPtr dom,
cleanup:
VIR_FORCE_CLOSE(fd);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -2458,7 +2458,7 @@ umlDomainOpenConsole(virDomainPtr dom,
ret = 0;
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
umlDriverUnlock(driver);
return ret;
}

View File

@ -198,7 +198,7 @@ vmwareLoadDomains(struct vmware_driver *driver)
VIR_DOMAIN_RUNNING_UNKNOWN);
vm->persistent = 1;
virDomainObjUnlock(vm);
virObjectUnlock(vm);
vmdef = NULL;
vm = NULL;

View File

@ -365,7 +365,7 @@ vmwareDomainDefineXML(virConnectPtr conn, const char *xml)
VIR_FREE(fileName);
VIR_FREE(vmxPath);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
vmwareDriverUnlock(driver);
return dom;
}
@ -410,7 +410,7 @@ vmwareDomainShutdownFlags(virDomainPtr dom,
ret = 0;
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
vmwareDriverUnlock(driver);
return ret;
}
@ -466,7 +466,7 @@ vmwareDomainSuspend(virDomainPtr dom)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -515,7 +515,7 @@ vmwareDomainResume(virDomainPtr dom)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -563,7 +563,7 @@ vmwareDomainReboot(virDomainPtr dom, unsigned int flags)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -635,7 +635,7 @@ cleanup:
VIR_FREE(vmx);
VIR_FREE(vmxPath);
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
vmwareDriverUnlock(driver);
return dom;
}
@ -673,7 +673,7 @@ vmwareDomainCreateWithFlags(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
vmwareDriverUnlock(driver);
return ret;
}
@ -726,7 +726,7 @@ vmwareDomainUndefineFlags(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
vmwareDriverUnlock(driver);
return ret;
}
@ -759,7 +759,7 @@ vmwareDomainLookupByID(virConnectPtr conn, int id)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -784,7 +784,7 @@ vmwareGetOSType(virDomainPtr dom)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -811,7 +811,7 @@ vmwareDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -837,7 +837,7 @@ vmwareDomainLookupByName(virConnectPtr conn, const char *name)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return dom;
}
@ -859,7 +859,7 @@ vmwareDomainIsActive(virDomainPtr dom)
cleanup:
if (obj)
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return ret;
}
@ -882,7 +882,7 @@ vmwareDomainIsPersistent(virDomainPtr dom)
cleanup:
if (obj)
virDomainObjUnlock(obj);
virObjectUnlock(obj);
return ret;
}
@ -910,7 +910,7 @@ vmwareDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -948,9 +948,9 @@ static void vmwareDomainObjListUpdateDomain(void *payload, const void *name ATTR
{
struct vmware_driver *driver = data;
virDomainObjPtr vm = payload;
virDomainObjLock(vm);
virObjectLock(vm);
ignore_value(vmwareUpdateVMStatus(driver, vm));
virDomainObjUnlock(vm);
virObjectUnlock(vm);
}
static void
@ -1045,7 +1045,7 @@ vmwareDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}
@ -1079,7 +1079,7 @@ vmwareDomainGetState(virDomainPtr dom,
cleanup:
if (vm)
virDomainObjUnlock(vm);
virObjectUnlock(vm);
return ret;
}

View File

@ -364,7 +364,7 @@ void qemuMonitorTestFree(qemuMonitorTestPtr test)
virObjectUnref(test->server);
if (test->mon) {
qemuMonitorUnlock(test->mon);
virObjectUnlock(test->mon);
qemuMonitorClose(test->mon);
}
@ -496,7 +496,7 @@ qemuMonitorTestPtr qemuMonitorTestNew(bool json, virCapsPtr caps)
json ? 1 : 0,
&qemuCallbacks)))
goto error;
qemuMonitorLock(test->mon);
virObjectLock(test->mon);
if (virNetSocketAccept(test->server, &test->client) < 0)
goto error;