--- src/conf/domain_conf.c | 4 +- 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 | 24 +++++++------- src/network/bridge_driver.c | 20 ++++++------ src/opennebula/one_driver.c | 12 ++++---- src/openvz/openvz_driver.c | 8 ++-- src/qemu/qemu_driver.c | 68 +++++++++++++++++++++--------------------- src/test/test_driver.c | 28 +++++++++--------- src/uml/uml_driver.c | 28 +++++++++--------- 12 files changed, 100 insertions(+), 100 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7d558e8..5da62cb 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -212,7 +212,7 @@ virDomainObjPtr virDomainFindByID(const virDomainObjListPtr doms, for (i = 0 ; i < doms->count ; i++) { virDomainObjLock(doms->objs[i]); - if (virDomainIsActive(doms->objs[i]) && + if (virDomainObjIsActive(doms->objs[i]) && doms->objs[i]->def->id == id) return doms->objs[i]; virDomainObjUnlock(doms->objs[i]); @@ -603,7 +603,7 @@ virDomainObjPtr virDomainAssignDef(virConnectPtr conn, virDomainObjPtr domain; if ((domain = virDomainFindByUUID(doms, def->uuid))) { - if (!virDomainIsActive(domain)) { + if (!virDomainObjIsActive(domain)) { virDomainDefFree(domain->def); domain->def = def; } else { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index ff1b0cf..01aa9f3 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -645,7 +645,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 bb9dce4..92543fc 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 40f5fdd..ca5a1db 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -152,7 +152,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 e983a01..2b399db 100644 --- a/src/conf/network_conf.h +++ b/src/conf/network_conf.h @@ -105,7 +105,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 ef97364..8224376 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -225,7 +225,7 @@ static int lxcListDomains(virConnectPtr conn, int *ids, int nids) { lxcDriverLock(driver); for (i = 0 ; i < driver->domains.count && got < nids ; i++) { virDomainObjLock(driver->domains.objs[i]); - if (virDomainIsActive(driver->domains.objs[i])) + if (virDomainObjIsActive(driver->domains.objs[i])) ids[got++] = driver->domains.objs[i]->def->id; virDomainObjUnlock(driver->domains.objs[i]); } @@ -241,7 +241,7 @@ static int lxcNumDomains(virConnectPtr conn) { lxcDriverLock(driver); for (i = 0 ; i < driver->domains.count ; i++) { virDomainObjLock(driver->domains.objs[i]); - if (virDomainIsActive(driver->domains.objs[i])) + if (virDomainObjIsActive(driver->domains.objs[i])) n++; virDomainObjUnlock(driver->domains.objs[i]); } @@ -258,7 +258,7 @@ static int lxcListDefinedDomains(virConnectPtr conn, lxcDriverLock(driver); for (i = 0 ; i < driver->domains.count && got < nnames ; i++) { virDomainObjLock(driver->domains.objs[i]); - if (!virDomainIsActive(driver->domains.objs[i])) { + if (!virDomainObjIsActive(driver->domains.objs[i])) { if (!(names[got++] = strdup(driver->domains.objs[i]->def->name))) { virReportOOMError(conn); virDomainObjUnlock(driver->domains.objs[i]); @@ -286,7 +286,7 @@ static int lxcNumDefinedDomains(virConnectPtr conn) { lxcDriverLock(driver); for (i = 0 ; i < driver->domains.count ; i++) { virDomainObjLock(driver->domains.objs[i]); - if (!virDomainIsActive(driver->domains.objs[i])) + if (!virDomainObjIsActive(driver->domains.objs[i])) n++; virDomainObjUnlock(driver->domains.objs[i]); } @@ -394,7 +394,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; @@ -448,7 +448,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 { @@ -588,7 +588,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); @@ -1328,7 +1328,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; @@ -1588,7 +1588,7 @@ lxcAutostartConfigs(lxc_driver_t *driver) { virDomainObjPtr vm = driver->domains.objs[i]; virDomainObjLock(vm); if (vm->autostart && - !virDomainIsActive(vm)) { + !virDomainObjIsActive(vm)) { int ret = lxcVmStart(conn, driver, vm); if (ret < 0) { virErrorPtr err = virGetLastError(); @@ -1818,7 +1818,7 @@ lxcActive(void) { lxcDriverLock(lxc_driver); for (i = 0 ; i < lxc_driver->domains.count ; i++) { virDomainObjLock(lxc_driver->domains.objs[i]); - if (virDomainIsActive(lxc_driver->domains.objs[i])) + if (virDomainObjIsActive(lxc_driver->domains.objs[i])) active = 1; virDomainObjUnlock(lxc_driver->domains.objs[i]); } @@ -2180,7 +2180,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; @@ -2245,7 +2245,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 95bc810..3c62636 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -169,7 +169,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 */ } @@ -318,7 +318,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); } @@ -862,7 +862,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; @@ -967,7 +967,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); @@ -1079,7 +1079,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]); } @@ -1095,7 +1095,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); @@ -1123,7 +1123,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]); } @@ -1139,7 +1139,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); @@ -1251,7 +1251,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; @@ -1312,7 +1312,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 9bcd5c3..9c6f120 100644 --- a/src/opennebula/one_driver.c +++ b/src/opennebula/one_driver.c @@ -183,7 +183,7 @@ static int oneListDomains(virConnectPtr conn, int *ids, int nids) oneDriverLock(driver); for (i = 0 ; i < driver->domains.count && got < nids ; i++){ virDomainObjLock(driver->domains.objs[i]); - if (virDomainIsActive(driver->domains.objs[i])) + if (virDomainObjIsActive(driver->domains.objs[i])) ids[got++] = driver->domains.objs[i]->def->id; virDomainObjUnlock(driver->domains.objs[i]); } @@ -200,7 +200,7 @@ static int oneNumDomains(virConnectPtr conn) oneDriverLock(driver); for (i = 0 ; i < driver->domains.count ; i++){ virDomainObjLock(driver->domains.objs[i]); - if (virDomainIsActive(driver->domains.objs[i])) + if (virDomainObjIsActive(driver->domains.objs[i])) n++; virDomainObjUnlock(driver->domains.objs[i]); } @@ -217,7 +217,7 @@ static int oneListDefinedDomains(virConnectPtr conn, oneDriverLock(driver); for (i = 0 ; i < driver->domains.count && got < nnames ; i++) { virDomainObjLock(driver->domains.objs[i]); - if (!virDomainIsActive(driver->domains.objs[i])) { + if (!virDomainObjIsActive(driver->domains.objs[i])) { if (!(names[got++] = strdup(driver->domains.objs[i]->def->name))) { virReportOOMError(conn); virDomainObjUnlock(driver->domains.objs[i]); @@ -246,7 +246,7 @@ static int oneNumDefinedDomains(virConnectPtr conn) oneDriverLock(driver); for (i = 0 ; i < driver->domains.count ; i++){ virDomainObjLock(driver->domains.objs[i]); - if (!virDomainIsActive(driver->domains.objs[i])) + if (!virDomainObjIsActive(driver->domains.objs[i])) n++; virDomainObjUnlock(driver->domains.objs[i]); } @@ -338,7 +338,7 @@ static int oneDomainGetInfo(virDomainPtr dom, return -1; } - if (!virDomainIsActive(vm)) { + if (!virDomainObjIsActive(vm)) { info->cpuTime = 0; } else { char vm_info[257]; @@ -686,7 +686,7 @@ static int oneActive(void){ oneDriverLock(one_driver); for (i = 0 ; i < one_driver->domains.count ; i++) { virDomainObjLock(one_driver->domains.objs[i]); - if (virDomainIsActive(one_driver->domains.objs[i])) + if (virDomainObjIsActive(one_driver->domains.objs[i])) active = 1; virDomainObjUnlock(one_driver->domains.objs[i]); } diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index f64ad1e..57482b8 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -393,7 +393,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) { @@ -949,7 +949,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; } @@ -1252,7 +1252,7 @@ static int openvzNumDomains(virConnectPtr conn) { openvzDriverLock(driver); for (i = 0 ; i < driver->domains.count ; i++) { virDomainObjLock(driver->domains.objs[i]); - if (virDomainIsActive(driver->domains.objs[i])) + if (virDomainObjIsActive(driver->domains.objs[i])) nactive++; virDomainObjUnlock(driver->domains.objs[i]); } @@ -1355,7 +1355,7 @@ static int openvzNumDefinedDomains(virConnectPtr conn) { openvzDriverLock(driver); for (i = 0 ; i < driver->domains.count ; i++) { virDomainObjLock(driver->domains.objs[i]); - if (!virDomainIsActive(driver->domains.objs[i])) + if (!virDomainObjIsActive(driver->domains.objs[i])) ninactive++; virDomainObjUnlock(driver->domains.objs[i]); } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d37b184..03e8457 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -219,7 +219,7 @@ qemudAutostartConfigs(struct qemud_driver *driver) { virDomainObjPtr vm = driver->domains.objs[i]; virDomainObjLock(vm); if (vm->autostart && - !virDomainIsActive(vm)) { + !virDomainObjIsActive(vm)) { int ret; virResetLastError(); @@ -689,7 +689,7 @@ qemudActive(void) { for (i = 0 ; i < qemu_driver->domains.count ; i++) { virDomainObjPtr vm = qemu_driver->domains.objs[i]; virDomainObjLock(vm); - if (virDomainIsActive(vm)) + if (virDomainObjIsActive(vm)) active = 1; virDomainObjUnlock(vm); } @@ -1964,7 +1964,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; @@ -2171,7 +2171,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); @@ -2265,7 +2265,7 @@ qemudDispatchVMEvent(int watch, int fd, int events, void *opaque) { for (i = 0 ; i < driver->domains.count ; i++) { virDomainObjPtr tmpvm = driver->domains.objs[i]; virDomainObjLock(tmpvm); - if (virDomainIsActive(tmpvm) && + if (virDomainObjIsActive(tmpvm) && tmpvm->monitorWatch == watch) { vm = tmpvm; break; @@ -2642,7 +2642,7 @@ static int qemudListDomains(virConnectPtr conn, int *ids, int nids) { qemuDriverLock(driver); for (i = 0 ; i < driver->domains.count && got < nids ; i++) { virDomainObjLock(driver->domains.objs[i]); - if (virDomainIsActive(driver->domains.objs[i])) + if (virDomainObjIsActive(driver->domains.objs[i])) ids[got++] = driver->domains.objs[i]->def->id; virDomainObjUnlock(driver->domains.objs[i]); } @@ -2658,7 +2658,7 @@ static int qemudNumDomains(virConnectPtr conn) { qemuDriverLock(driver); for (i = 0 ; i < driver->domains.count ; i++) { virDomainObjLock(driver->domains.objs[i]); - if (virDomainIsActive(driver->domains.objs[i])) + if (virDomainObjIsActive(driver->domains.objs[i])) n++; virDomainObjUnlock(driver->domains.objs[i]); } @@ -2697,7 +2697,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; @@ -2764,7 +2764,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; @@ -2808,7 +2808,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; @@ -2856,7 +2856,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; @@ -2889,7 +2889,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; @@ -3022,7 +3022,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; @@ -3065,7 +3065,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) { @@ -3076,7 +3076,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; @@ -3176,7 +3176,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; @@ -3292,7 +3292,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; @@ -3349,7 +3349,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; @@ -3410,7 +3410,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; @@ -3479,7 +3479,7 @@ qemudDomainGetVcpus(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; @@ -3624,7 +3624,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, @@ -3756,7 +3756,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; @@ -3879,7 +3879,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; @@ -4064,7 +4064,7 @@ static int qemudListDefinedDomains(virConnectPtr conn, qemuDriverLock(driver); for (i = 0 ; i < driver->domains.count && got < nnames ; i++) { virDomainObjLock(driver->domains.objs[i]); - if (!virDomainIsActive(driver->domains.objs[i])) { + if (!virDomainObjIsActive(driver->domains.objs[i])) { if (!(names[got++] = strdup(driver->domains.objs[i]->def->name))) { virReportOOMError(conn); virDomainObjUnlock(driver->domains.objs[i]); @@ -4090,7 +4090,7 @@ static int qemudNumDefinedDomains(virConnectPtr conn) { qemuDriverLock(driver); for (i = 0 ; i < driver->domains.count ; i++) - if (!virDomainIsActive(driver->domains.objs[i])) + if (!virDomainObjIsActive(driver->domains.objs[i])) n++; qemuDriverUnlock(driver); @@ -4333,7 +4333,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; @@ -4791,7 +4791,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; @@ -5147,7 +5147,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; @@ -5462,7 +5462,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; @@ -5525,7 +5525,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; @@ -5664,7 +5664,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; @@ -6129,7 +6129,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); @@ -6350,7 +6350,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); @@ -6811,7 +6811,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 0541a73..b0f91de 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1040,7 +1040,7 @@ static int testNumOfDomains(virConnectPtr conn) testDriverLock(privconn); for (i = 0 ; i < privconn->domains.count ; i++) - if (virDomainIsActive(privconn->domains.objs[i])) + if (virDomainObjIsActive(privconn->domains.objs[i])) numActive++; testDriverUnlock(privconn); @@ -1178,7 +1178,7 @@ static int testListDomains (virConnectPtr conn, testDriverLock(privconn); for (i = 0 ; i < privconn->domains.count && n < maxids ; i++) { virDomainObjLock(privconn->domains.objs[i]); - if (virDomainIsActive(privconn->domains.objs[i])) + if (virDomainObjIsActive(privconn->domains.objs[i])) ids[n++] = privconn->domains.objs[i]->def->id; virDomainObjUnlock(privconn->domains.objs[i]); } @@ -1857,7 +1857,7 @@ static int testNumOfDefinedDomains(virConnectPtr conn) { testDriverLock(privconn); for (i = 0 ; i < privconn->domains.count ; i++) { virDomainObjLock(privconn->domains.objs[i]); - if (!virDomainIsActive(privconn->domains.objs[i])) + if (!virDomainObjIsActive(privconn->domains.objs[i])) numInactive++; virDomainObjUnlock(privconn->domains.objs[i]); } @@ -1876,7 +1876,7 @@ static int testListDefinedDomains(virConnectPtr conn, memset(names, 0, sizeof(*names)*maxnames); for (i = 0 ; i < privconn->domains.count && n < maxnames ; i++) { virDomainObjLock(privconn->domains.objs[i]); - if (!virDomainIsActive(privconn->domains.objs[i]) && + if (!virDomainObjIsActive(privconn->domains.objs[i]) && !(names[n++] = strdup(privconn->domains.objs[i]->def->name))) { virDomainObjUnlock(privconn->domains.objs[i]); goto no_memory; @@ -2362,7 +2362,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]); } @@ -2379,7 +2379,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; @@ -2405,7 +2405,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]); } @@ -2422,7 +2422,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; @@ -2505,7 +2505,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; @@ -2538,7 +2538,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; @@ -2719,7 +2719,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]); @@ -2737,7 +2737,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; @@ -2765,7 +2765,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]); @@ -2783,7 +2783,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 9a7fe42..6f60592 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -130,7 +130,7 @@ umlAutostartConfigs(struct uml_driver *driver) { for (i = 0 ; i < driver->domains.count ; i++) { if (driver->domains.objs[i]->autostart && - !virDomainIsActive(driver->domains.objs[i]) && + !virDomainObjIsActive(driver->domains.objs[i]) && umlStartVMDaemon(conn, driver, driver->domains.objs[i]) < 0) { virErrorPtr err = virGetLastError(); VIR_ERROR(_("Failed to autostart VM '%s': %s"), @@ -257,7 +257,7 @@ reread: if (e->mask & IN_DELETE) { VIR_DEBUG("Got inotify domain shutdown '%s'", name); - if (!virDomainIsActive(dom)) { + if (!virDomainObjIsActive(dom)) { virDomainObjUnlock(dom); continue; } @@ -265,7 +265,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; } @@ -458,7 +458,7 @@ umlActive(void) { umlDriverLock(uml_driver); for (i = 0 ; i < uml_driver->domains.count ; i++) { virDomainObjLock(uml_driver->domains.objs[i]); - if (virDomainIsActive(uml_driver->domains.objs[i])) + if (virDomainObjIsActive(uml_driver->domains.objs[i])) active = 1; virDomainObjUnlock(uml_driver->domains.objs[i]); } @@ -489,7 +489,7 @@ umlShutdown(void) { for (i = 0 ; i < uml_driver->domains.count ; i++) { virDomainObjPtr dom = uml_driver->domains.objs[i]; virDomainObjLock(dom); - if (virDomainIsActive(dom)) + if (virDomainObjIsActive(dom)) umlShutdownVMDaemon(NULL, uml_driver, dom); virDomainObjUnlock(dom); } @@ -766,7 +766,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; @@ -882,7 +882,7 @@ static void umlShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED, virDomainObjPtr vm) { int ret; - if (!virDomainIsActive(vm)) + if (!virDomainObjIsActive(vm)) return; virKillProcess(vm->pid, SIGTERM); @@ -1150,7 +1150,7 @@ static int umlListDomains(virConnectPtr conn, int *ids, int nids) { umlDriverLock(driver); for (i = 0 ; i < driver->domains.count && got < nids ; i++) { virDomainObjLock(driver->domains.objs[i]); - if (virDomainIsActive(driver->domains.objs[i])) + if (virDomainObjIsActive(driver->domains.objs[i])) ids[got++] = driver->domains.objs[i]->def->id; virDomainObjUnlock(driver->domains.objs[i]); } @@ -1165,7 +1165,7 @@ static int umlNumDomains(virConnectPtr conn) { umlDriverLock(driver); for (i = 0 ; i < driver->domains.count ; i++) { virDomainObjLock(driver->domains.objs[i]); - if (virDomainIsActive(driver->domains.objs[i])) + if (virDomainObjIsActive(driver->domains.objs[i])) n++; virDomainObjUnlock(driver->domains.objs[i]); } @@ -1389,7 +1389,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; @@ -1428,7 +1428,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) { @@ -1486,7 +1486,7 @@ static int umlListDefinedDomains(virConnectPtr conn, umlDriverLock(driver); for (i = 0 ; i < driver->domains.count && got < nnames ; i++) { virDomainObjLock(driver->domains.objs[i]); - if (!virDomainIsActive(driver->domains.objs[i])) { + if (!virDomainObjIsActive(driver->domains.objs[i])) { if (!(names[got++] = strdup(driver->domains.objs[i]->def->name))) { virReportOOMError(conn); virDomainObjUnlock(driver->domains.objs[i]); @@ -1513,7 +1513,7 @@ static int umlNumDefinedDomains(virConnectPtr conn) { umlDriverLock(driver); for (i = 0 ; i < driver->domains.count ; i++) { virDomainObjLock(driver->domains.objs[i]); - if (!virDomainIsActive(driver->domains.objs[i])) + if (!virDomainObjIsActive(driver->domains.objs[i])) n++; virDomainObjUnlock(driver->domains.objs[i]); } @@ -1598,7 +1598,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; -- 1.6.2.5 -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list