From fc8d1991887ee33f60d8b7e927f02ae90c867dc7 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Tue, 20 Oct 2009 15:51:03 +0100 Subject: [PATCH] Rename internal APis Rename virDomainIsActive to virDomainObjIsActive, and virInterfaceIsActive to virInterfaceObjIsActive and finally virNetworkIsActive to virNetworkObjIsActive. * src/conf/domain_conf.c, src/conf/domain_conf.h, src/conf/interface_conf.h, src/conf/network_conf.c, src/conf/network_conf.h, src/lxc/lxc_driver.c, src/network/bridge_driver.c, src/opennebula/one_driver.c, src/openvz/openvz_driver.c, src/qemu/qemu_driver.c, src/test/test_driver.c, src/uml/uml_driver.c: Update for renamed APIs. --- src/conf/domain_conf.c | 12 ++++---- src/conf/domain_conf.h | 2 +- src/conf/interface_conf.h | 2 +- src/conf/network_conf.c | 2 +- src/conf/network_conf.h | 2 +- src/lxc/lxc_driver.c | 14 +++++----- src/network/bridge_driver.c | 20 ++++++------- src/opennebula/one_driver.c | 2 +- src/openvz/openvz_driver.c | 4 +-- src/qemu/qemu_driver.c | 56 ++++++++++++++++++------------------- src/test/test_driver.c | 20 ++++++------- src/uml/uml_driver.c | 18 ++++++------ 12 files changed, 77 insertions(+), 77 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a6d8e07c12..ba6b28da52 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -238,7 +238,7 @@ static int virDomainObjListSearchID(const void *payload, int want = 0; virDomainObjLock(obj); - if (virDomainIsActive(obj) && + if (virDomainObjIsActive(obj) && obj->def->id == *id) want = 1; virDomainObjUnlock(obj); @@ -646,7 +646,7 @@ virDomainObjPtr virDomainAssignDef(virConnectPtr conn, char uuidstr[VIR_UUID_STRING_BUFLEN]; if ((domain = virDomainFindByUUID(doms, def->uuid))) { - if (!virDomainIsActive(domain)) { + if (!virDomainObjIsActive(domain)) { virDomainDefFree(domain->def); domain->def = def; } else { @@ -5031,7 +5031,7 @@ static void virDomainObjListCountActive(void *payload, const char *name ATTRIBUT virDomainObjPtr obj = payload; int *count = data; virDomainObjLock(obj); - if (virDomainIsActive(obj)) + if (virDomainObjIsActive(obj)) (*count)++; virDomainObjUnlock(obj); } @@ -5041,7 +5041,7 @@ static void virDomainObjListCountInactive(void *payload, const char *name ATTRIB virDomainObjPtr obj = payload; int *count = data; virDomainObjLock(obj); - if (!virDomainIsActive(obj)) + if (!virDomainObjIsActive(obj)) (*count)++; virDomainObjUnlock(obj); } @@ -5067,7 +5067,7 @@ static void virDomainObjListCopyActiveIDs(void *payload, const char *name ATTRIB virDomainObjPtr obj = payload; struct virDomainIDData *data = opaque; virDomainObjLock(obj); - if (virDomainIsActive(obj) && data->numids < data->maxids) + if (virDomainObjIsActive(obj) && data->numids < data->maxids) data->ids[data->numids++] = obj->def->id; virDomainObjUnlock(obj); } @@ -5097,7 +5097,7 @@ static void virDomainObjListCopyInactiveNames(void *payload, const char *name AT return; virDomainObjLock(obj); - if (!virDomainIsActive(obj) && data->numnames < data->maxnames) { + if (!virDomainObjIsActive(obj) && data->numnames < data->maxnames) { if (!(data->names[data->numnames] = strdup(obj->def->name))) data->oom = 1; else diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 8a8bfb0f3a..8599ee7a1f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -650,7 +650,7 @@ struct _virDomainObjList { }; static inline int -virDomainIsActive(virDomainObjPtr dom) +virDomainObjIsActive(virDomainObjPtr dom) { return dom->def->id != -1; } diff --git a/src/conf/interface_conf.h b/src/conf/interface_conf.h index bb9dce4196..92543fcafd 100644 --- a/src/conf/interface_conf.h +++ b/src/conf/interface_conf.h @@ -172,7 +172,7 @@ struct _virInterfaceObjList { }; static inline int -virInterfaceIsActive(const virInterfaceObjPtr iface) +virInterfaceObjIsActive(const virInterfaceObjPtr iface) { return iface->active; } diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index fd8efb0b92..9ecfc1d22c 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -153,7 +153,7 @@ virNetworkObjPtr virNetworkAssignDef(virConnectPtr conn, virNetworkObjPtr network; if ((network = virNetworkFindByName(nets, def->name))) { - if (!virNetworkIsActive(network)) { + if (!virNetworkObjIsActive(network)) { virNetworkDefFree(network->def); network->def = def; } else { diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h index 6175b0f65d..d5dfaebec1 100644 --- a/src/conf/network_conf.h +++ b/src/conf/network_conf.h @@ -106,7 +106,7 @@ struct _virNetworkObjList { }; static inline int -virNetworkIsActive(const virNetworkObjPtr net) +virNetworkObjIsActive(const virNetworkObjPtr net) { return net->active; } diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 116f3aef20..47e59f65d4 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -364,7 +364,7 @@ static int lxcDomainUndefine(virDomainPtr dom) goto cleanup; } - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID, "%s", _("cannot delete active domain")); goto cleanup; @@ -418,7 +418,7 @@ static int lxcDomainGetInfo(virDomainPtr dom, info->state = vm->state; - if (!virDomainIsActive(vm) || driver->cgroup == NULL) { + if (!virDomainObjIsActive(vm) || driver->cgroup == NULL) { info->cpuTime = 0; info->memory = vm->def->memory; } else { @@ -558,7 +558,7 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) { goto cleanup; } - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) { lxcError(dom->conn, dom, VIR_ERR_INTERNAL_ERROR, _("Unable to get cgroup for %s\n"), vm->def->name); @@ -1287,7 +1287,7 @@ lxcDomainCreateAndStart(virConnectPtr conn, } /* UUID & name match, but if VM is already active, refuse it */ - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED, _("domain is already active as '%s'"), vm->def->name); goto cleanup; @@ -1545,7 +1545,7 @@ lxcAutostartDomain(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaqu virDomainObjLock(vm); if (vm->autostart && - !virDomainIsActive(vm)) { + !virDomainObjIsActive(vm)) { int ret = lxcVmStart(data->conn, data->driver, vm); if (ret < 0) { virErrorPtr err = virGetLastError(); @@ -2151,7 +2151,7 @@ static int lxcDomainSuspend(virDomainPtr dom) goto cleanup; } - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); goto cleanup; @@ -2216,7 +2216,7 @@ static int lxcDomainResume(virDomainPtr dom) goto cleanup; } - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); goto cleanup; diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 837bd76501..32331016cd 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -173,7 +173,7 @@ networkAutostartConfigs(struct network_driver *driver) { for (i = 0 ; i < driver->networks.count ; i++) { virNetworkObjLock(driver->networks.objs[i]); if (driver->networks.objs[i]->autostart && - !virNetworkIsActive(driver->networks.objs[i]) && + !virNetworkObjIsActive(driver->networks.objs[i]) && networkStartNetworkDaemon(NULL, driver, driver->networks.objs[i]) < 0) { /* failed to start but already logged */ } @@ -322,7 +322,7 @@ networkActive(void) { for (i = 0 ; i < driverState->networks.count ; i++) { virNetworkObjPtr net = driverState->networks.objs[i]; virNetworkObjLock(net); - if (virNetworkIsActive(net)) + if (virNetworkObjIsActive(net)) active = 1; virNetworkObjUnlock(net); } @@ -871,7 +871,7 @@ static int networkStartNetworkDaemon(virConnectPtr conn, virNetworkObjPtr network) { int err; - if (virNetworkIsActive(network)) { + if (virNetworkObjIsActive(network)) { networkReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("network is already active")); return -1; @@ -976,7 +976,7 @@ static int networkShutdownNetworkDaemon(virConnectPtr conn, VIR_INFO(_("Shutting down network '%s'\n"), network->def->name); - if (!virNetworkIsActive(network)) + if (!virNetworkObjIsActive(network)) return 0; stateFile = virNetworkConfigFile(conn, NETWORK_STATE_DIR, network->def->name); @@ -1088,7 +1088,7 @@ static int networkNumNetworks(virConnectPtr conn) { networkDriverLock(driver); for (i = 0 ; i < driver->networks.count ; i++) { virNetworkObjLock(driver->networks.objs[i]); - if (virNetworkIsActive(driver->networks.objs[i])) + if (virNetworkObjIsActive(driver->networks.objs[i])) nactive++; virNetworkObjUnlock(driver->networks.objs[i]); } @@ -1104,7 +1104,7 @@ static int networkListNetworks(virConnectPtr conn, char **const names, int nname networkDriverLock(driver); for (i = 0 ; i < driver->networks.count && got < nnames ; i++) { virNetworkObjLock(driver->networks.objs[i]); - if (virNetworkIsActive(driver->networks.objs[i])) { + if (virNetworkObjIsActive(driver->networks.objs[i])) { if (!(names[got] = strdup(driver->networks.objs[i]->def->name))) { virNetworkObjUnlock(driver->networks.objs[i]); virReportOOMError(conn); @@ -1132,7 +1132,7 @@ static int networkNumDefinedNetworks(virConnectPtr conn) { networkDriverLock(driver); for (i = 0 ; i < driver->networks.count ; i++) { virNetworkObjLock(driver->networks.objs[i]); - if (!virNetworkIsActive(driver->networks.objs[i])) + if (!virNetworkObjIsActive(driver->networks.objs[i])) ninactive++; virNetworkObjUnlock(driver->networks.objs[i]); } @@ -1148,7 +1148,7 @@ static int networkListDefinedNetworks(virConnectPtr conn, char **const names, in networkDriverLock(driver); for (i = 0 ; i < driver->networks.count && got < nnames ; i++) { virNetworkObjLock(driver->networks.objs[i]); - if (!virNetworkIsActive(driver->networks.objs[i])) { + if (!virNetworkObjIsActive(driver->networks.objs[i])) { if (!(names[got] = strdup(driver->networks.objs[i]->def->name))) { virNetworkObjUnlock(driver->networks.objs[i]); virReportOOMError(conn); @@ -1260,7 +1260,7 @@ static int networkUndefine(virNetworkPtr net) { goto cleanup; } - if (virNetworkIsActive(network)) { + if (virNetworkObjIsActive(network)) { networkReportError(net->conn, NULL, net, VIR_ERR_INTERNAL_ERROR, "%s", _("network is still active")); goto cleanup; @@ -1321,7 +1321,7 @@ static int networkDestroy(virNetworkPtr net) { goto cleanup; } - if (!virNetworkIsActive(network)) { + if (!virNetworkObjIsActive(network)) { networkReportError(net->conn, NULL, net, VIR_ERR_INTERNAL_ERROR, "%s", _("network is not active")); goto cleanup; diff --git a/src/opennebula/one_driver.c b/src/opennebula/one_driver.c index beb48ceca2..cffd626cde 100644 --- a/src/opennebula/one_driver.c +++ b/src/opennebula/one_driver.c @@ -307,7 +307,7 @@ static int oneDomainGetInfo(virDomainPtr dom, return -1; } - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { info->cpuTime = 0; } else { char vm_info[257]; diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 545e8bb2d3..53fcaee41e 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -398,7 +398,7 @@ static int openvzDomainGetInfo(virDomainPtr dom, info->state = vm->state; - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { info->cpuTime = 0; } else { if (openvzGetProcessInfo(&(info->cpuTime), dom->id) < 0) { @@ -964,7 +964,7 @@ openvzDomainUndefine(virDomainPtr dom) goto cleanup; } - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR, "%s", _("cannot delete active domain")); goto cleanup; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ddce2baae4..437a1b4c79 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -213,7 +213,7 @@ qemuAutostartDomain(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaq virDomainObjLock(vm); if (vm->autostart && - !virDomainIsActive(vm)) { + !virDomainObjIsActive(vm)) { int ret; virResetLastError(); @@ -1960,7 +1960,7 @@ static int qemudStartVMDaemon(virConnectPtr conn, FD_ZERO(&keepfd); - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_INVALID, "%s", _("VM is already active")); return -1; @@ -2167,7 +2167,7 @@ static void qemudShutdownVMDaemon(virConnectPtr conn, int ret; int retries = 0; - if (!virDomainIsActive(vm)) + if (!virDomainObjIsActive(vm)) return; VIR_DEBUG(_("Shutting down VM '%s'\n"), vm->def->name); @@ -2677,7 +2677,7 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml, } /* UUID & name match, but if VM is already active, refuse it */ - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, _("domain is already active as '%s'"), vm->def->name); goto cleanup; @@ -2745,7 +2745,7 @@ static int qemudDomainSuspend(virDomainPtr dom) { _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); goto cleanup; @@ -2789,7 +2789,7 @@ static int qemudDomainResume(virDomainPtr dom) { _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); goto cleanup; @@ -2837,7 +2837,7 @@ static int qemudDomainShutdown(virDomainPtr dom) { goto cleanup; } - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); goto cleanup; @@ -2870,7 +2870,7 @@ static int qemudDomainDestroy(virDomainPtr dom) { _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); goto cleanup; @@ -3003,7 +3003,7 @@ static int qemudDomainSetMemory(virDomainPtr dom, unsigned long newmem) { goto cleanup; } - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { int r = qemuMonitorSetBalloon(vm, newmem); if (r < 0) goto cleanup; @@ -3046,7 +3046,7 @@ static int qemudDomainGetInfo(virDomainPtr dom, info->state = vm->state; - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { info->cpuTime = 0; } else { if (qemudGetProcessInfo(&(info->cpuTime), NULL, vm->pid, 0) < 0) { @@ -3057,7 +3057,7 @@ static int qemudDomainGetInfo(virDomainPtr dom, info->maxMem = vm->def->maxmem; - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { err = qemuMonitorGetBalloonInfo(vm, &balloon); if (err < 0) goto cleanup; @@ -3157,7 +3157,7 @@ static int qemudDomainSave(virDomainPtr dom, goto cleanup; } - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); goto cleanup; @@ -3273,7 +3273,7 @@ static int qemudDomainCoreDump(virDomainPtr dom, goto cleanup; } - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); goto cleanup; @@ -3330,7 +3330,7 @@ static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) { goto cleanup; } - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s", _("cannot change vcpu count of an active domain")); goto cleanup; @@ -3391,7 +3391,7 @@ qemudDomainPinVcpu(virDomainPtr dom, goto cleanup; } - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s",_("cannot pin vcpus on an inactive domain")); goto cleanup; @@ -3460,7 +3460,7 @@ qemudDomainGetVcpus(virDomainPtr dom, goto cleanup; } - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s", _("cannot list vcpu pinning for an inactive domain")); @@ -3606,7 +3606,7 @@ static int qemudDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr sec * after reading the label, by checking that our FD connecting to the * QEMU monitor hasn't seen SIGHUP/ERR on poll(). */ - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { if (driver->securityDriver && driver->securityDriver->domainGetSecurityLabel) { if (driver->securityDriver->domainGetSecurityLabel(dom->conn, vm, seclabel) == -1) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, @@ -3738,7 +3738,7 @@ static int qemudDomainRestore(virConnectPtr conn, } /* UUID & name match, but if VM is already active, refuse it */ - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_INVALID, _("domain is already active as '%s'"), vm->def->name); goto cleanup; @@ -3862,7 +3862,7 @@ static char *qemudDomainDumpXML(virDomainPtr dom, } /* Refresh current memory based on balloon info */ - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { err = qemuMonitorGetBalloonInfo(vm, &balloon); if (err < 0) goto cleanup; @@ -4298,7 +4298,7 @@ static int qemudDomainUndefine(virDomainPtr dom) { goto cleanup; } - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s", _("cannot delete active domain")); goto cleanup; @@ -4756,7 +4756,7 @@ static int qemudDomainAttachDevice(virDomainPtr dom, goto cleanup; } - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s", _("cannot attach device on inactive domain")); goto cleanup; @@ -5112,7 +5112,7 @@ static int qemudDomainDetachDevice(virDomainPtr dom, goto cleanup; } - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s", _("cannot detach device on inactive domain")); goto cleanup; @@ -5427,7 +5427,7 @@ qemudDomainBlockStats (virDomainPtr dom, _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } - if (!virDomainIsActive (vm)) { + if (!virDomainObjIsActive (vm)) { qemudReportError (dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); goto cleanup; @@ -5490,7 +5490,7 @@ qemudDomainInterfaceStats (virDomainPtr dom, goto cleanup; } - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); goto cleanup; @@ -5629,7 +5629,7 @@ qemudDomainMemoryPeek (virDomainPtr dom, goto cleanup; } - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); goto cleanup; @@ -6094,7 +6094,7 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn, if (!vm) vm = virDomainFindByName(&driver->domains, dname); if (vm) { - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { qemudReportError(dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED, _("domain with the same name or UUID already exists as '%s'"), vm->def->name); @@ -6333,7 +6333,7 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn, if (!vm) vm = virDomainFindByName(&driver->domains, dname); if (vm) { - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { qemudReportError (dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED, _("domain with the same name or UUID already exists as '%s'"), vm->def->name); @@ -6795,7 +6795,7 @@ qemudDomainMigratePerform (virDomainPtr dom, goto cleanup; } - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { qemudReportError (dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); goto cleanup; diff --git a/src/test/test_driver.c b/src/test/test_driver.c index f9919e9019..7e190722c1 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2370,7 +2370,7 @@ static int testNumNetworks(virConnectPtr conn) { testDriverLock(privconn); for (i = 0 ; i < privconn->networks.count ; i++) { virNetworkObjLock(privconn->networks.objs[i]); - if (virNetworkIsActive(privconn->networks.objs[i])) + if (virNetworkObjIsActive(privconn->networks.objs[i])) numActive++; virNetworkObjUnlock(privconn->networks.objs[i]); } @@ -2387,7 +2387,7 @@ static int testListNetworks(virConnectPtr conn, char **const names, int nnames) memset(names, 0, sizeof(*names)*nnames); for (i = 0 ; i < privconn->networks.count && n < nnames ; i++) { virNetworkObjLock(privconn->networks.objs[i]); - if (virNetworkIsActive(privconn->networks.objs[i]) && + if (virNetworkObjIsActive(privconn->networks.objs[i]) && !(names[n++] = strdup(privconn->networks.objs[i]->def->name))) { virNetworkObjUnlock(privconn->networks.objs[i]); goto no_memory; @@ -2413,7 +2413,7 @@ static int testNumDefinedNetworks(virConnectPtr conn) { testDriverLock(privconn); for (i = 0 ; i < privconn->networks.count ; i++) { virNetworkObjLock(privconn->networks.objs[i]); - if (!virNetworkIsActive(privconn->networks.objs[i])) + if (!virNetworkObjIsActive(privconn->networks.objs[i])) numInactive++; virNetworkObjUnlock(privconn->networks.objs[i]); } @@ -2430,7 +2430,7 @@ static int testListDefinedNetworks(virConnectPtr conn, char **const names, int n memset(names, 0, sizeof(*names)*nnames); for (i = 0 ; i < privconn->networks.count && n < nnames ; i++) { virNetworkObjLock(privconn->networks.objs[i]); - if (!virNetworkIsActive(privconn->networks.objs[i]) && + if (!virNetworkObjIsActive(privconn->networks.objs[i]) && !(names[n++] = strdup(privconn->networks.objs[i]->def->name))) { virNetworkObjUnlock(privconn->networks.objs[i]); goto no_memory; @@ -2513,7 +2513,7 @@ static int testNetworkUndefine(virNetworkPtr network) { goto cleanup; } - if (virNetworkIsActive(privnet)) { + if (virNetworkObjIsActive(privnet)) { testError(network->conn, VIR_ERR_INTERNAL_ERROR, _("Network '%s' is still running"), network->name); goto cleanup; @@ -2546,7 +2546,7 @@ static int testNetworkStart(virNetworkPtr network) { goto cleanup; } - if (virNetworkIsActive(privnet)) { + if (virNetworkObjIsActive(privnet)) { testError(network->conn, VIR_ERR_INTERNAL_ERROR, _("Network '%s' is already running"), network->name); goto cleanup; @@ -2727,7 +2727,7 @@ static int testNumOfInterfaces(virConnectPtr conn) testDriverLock(privconn); for (i = 0 ; (i < privconn->ifaces.count); i++) { virInterfaceObjLock(privconn->ifaces.objs[i]); - if (virInterfaceIsActive(privconn->ifaces.objs[i])) { + if (virInterfaceObjIsActive(privconn->ifaces.objs[i])) { count++; } virInterfaceObjUnlock(privconn->ifaces.objs[i]); @@ -2745,7 +2745,7 @@ static int testListInterfaces(virConnectPtr conn, char **const names, int nnames memset(names, 0, sizeof(*names)*nnames); for (i = 0 ; (i < privconn->ifaces.count) && (n < nnames); i++) { virInterfaceObjLock(privconn->ifaces.objs[i]); - if (virInterfaceIsActive(privconn->ifaces.objs[i])) { + if (virInterfaceObjIsActive(privconn->ifaces.objs[i])) { if (!(names[n++] = strdup(privconn->ifaces.objs[i]->def->name))) { virInterfaceObjUnlock(privconn->ifaces.objs[i]); goto no_memory; @@ -2773,7 +2773,7 @@ static int testNumOfDefinedInterfaces(virConnectPtr conn) testDriverLock(privconn); for (i = 0 ; i < privconn->ifaces.count; i++) { virInterfaceObjLock(privconn->ifaces.objs[i]); - if (!virInterfaceIsActive(privconn->ifaces.objs[i])) { + if (!virInterfaceObjIsActive(privconn->ifaces.objs[i])) { count++; } virInterfaceObjUnlock(privconn->ifaces.objs[i]); @@ -2791,7 +2791,7 @@ static int testListDefinedInterfaces(virConnectPtr conn, char **const names, int memset(names, 0, sizeof(*names)*nnames); for (i = 0 ; (i < privconn->ifaces.count) && (n < nnames); i++) { virInterfaceObjLock(privconn->ifaces.objs[i]); - if (!virInterfaceIsActive(privconn->ifaces.objs[i])) { + if (!virInterfaceObjIsActive(privconn->ifaces.objs[i])) { if (!(names[n++] = strdup(privconn->ifaces.objs[i]->def->name))) { virInterfaceObjUnlock(privconn->ifaces.objs[i]); goto no_memory; diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 4fb04d9e18..fac3c4ca37 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -127,7 +127,7 @@ umlAutostartDomain(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaqu virDomainObjLock(vm); if (vm->autostart && - !virDomainIsActive(vm)) { + !virDomainObjIsActive(vm)) { virResetLastError(); if (umlStartVMDaemon(data->conn, data->driver, vm) < 0) { virErrorPtr err = virGetLastError(); @@ -273,7 +273,7 @@ reread: if (e->mask & IN_DELETE) { VIR_DEBUG("Got inotify domain shutdown '%s'", name); - if (!virDomainIsActive(dom)) { + if (!virDomainObjIsActive(dom)) { virDomainObjUnlock(dom); continue; } @@ -281,7 +281,7 @@ reread: umlShutdownVMDaemon(NULL, driver, dom); } else if (e->mask & (IN_CREATE | IN_MODIFY)) { VIR_DEBUG("Got inotify domain startup '%s'", name); - if (virDomainIsActive(dom)) { + if (virDomainObjIsActive(dom)) { virDomainObjUnlock(dom); continue; } @@ -487,7 +487,7 @@ umlShutdownOneVM(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaque) struct uml_driver *driver = opaque; virDomainObjLock(dom); - if (virDomainIsActive(dom)) + if (virDomainObjIsActive(dom)) umlShutdownVMDaemon(NULL, driver, dom); virDomainObjUnlock(dom); } @@ -784,7 +784,7 @@ static int umlStartVMDaemon(virConnectPtr conn, FD_ZERO(&keepfd); - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("VM is already active")); return -1; @@ -900,7 +900,7 @@ static void umlShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED, virDomainObjPtr vm) { int ret; - if (!virDomainIsActive(vm)) + if (!virDomainObjIsActive(vm)) return; virKillProcess(vm->pid, SIGTERM); @@ -1398,7 +1398,7 @@ static int umlDomainSetMemory(virDomainPtr dom, unsigned long newmem) { goto cleanup; } - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { umlReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT, "%s", _("cannot set memory of an active domain")); goto cleanup; @@ -1437,7 +1437,7 @@ static int umlDomainGetInfo(virDomainPtr dom, info->state = vm->state; - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { info->cpuTime = 0; } else { if (umlGetProcessInfo(&(info->cpuTime), vm->pid) < 0) { @@ -1587,7 +1587,7 @@ static int umlDomainUndefine(virDomainPtr dom) { goto cleanup; } - if (virDomainIsActive(vm)) { + if (virDomainObjIsActive(vm)) { umlReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("cannot delete active domain")); goto cleanup;