mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
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.
This commit is contained in:
parent
958c366b21
commit
fc8d199188
@ -238,7 +238,7 @@ static int virDomainObjListSearchID(const void *payload,
|
|||||||
int want = 0;
|
int want = 0;
|
||||||
|
|
||||||
virDomainObjLock(obj);
|
virDomainObjLock(obj);
|
||||||
if (virDomainIsActive(obj) &&
|
if (virDomainObjIsActive(obj) &&
|
||||||
obj->def->id == *id)
|
obj->def->id == *id)
|
||||||
want = 1;
|
want = 1;
|
||||||
virDomainObjUnlock(obj);
|
virDomainObjUnlock(obj);
|
||||||
@ -646,7 +646,7 @@ virDomainObjPtr virDomainAssignDef(virConnectPtr conn,
|
|||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
|
|
||||||
if ((domain = virDomainFindByUUID(doms, def->uuid))) {
|
if ((domain = virDomainFindByUUID(doms, def->uuid))) {
|
||||||
if (!virDomainIsActive(domain)) {
|
if (!virDomainObjIsActive(domain)) {
|
||||||
virDomainDefFree(domain->def);
|
virDomainDefFree(domain->def);
|
||||||
domain->def = def;
|
domain->def = def;
|
||||||
} else {
|
} else {
|
||||||
@ -5031,7 +5031,7 @@ static void virDomainObjListCountActive(void *payload, const char *name ATTRIBUT
|
|||||||
virDomainObjPtr obj = payload;
|
virDomainObjPtr obj = payload;
|
||||||
int *count = data;
|
int *count = data;
|
||||||
virDomainObjLock(obj);
|
virDomainObjLock(obj);
|
||||||
if (virDomainIsActive(obj))
|
if (virDomainObjIsActive(obj))
|
||||||
(*count)++;
|
(*count)++;
|
||||||
virDomainObjUnlock(obj);
|
virDomainObjUnlock(obj);
|
||||||
}
|
}
|
||||||
@ -5041,7 +5041,7 @@ static void virDomainObjListCountInactive(void *payload, const char *name ATTRIB
|
|||||||
virDomainObjPtr obj = payload;
|
virDomainObjPtr obj = payload;
|
||||||
int *count = data;
|
int *count = data;
|
||||||
virDomainObjLock(obj);
|
virDomainObjLock(obj);
|
||||||
if (!virDomainIsActive(obj))
|
if (!virDomainObjIsActive(obj))
|
||||||
(*count)++;
|
(*count)++;
|
||||||
virDomainObjUnlock(obj);
|
virDomainObjUnlock(obj);
|
||||||
}
|
}
|
||||||
@ -5067,7 +5067,7 @@ static void virDomainObjListCopyActiveIDs(void *payload, const char *name ATTRIB
|
|||||||
virDomainObjPtr obj = payload;
|
virDomainObjPtr obj = payload;
|
||||||
struct virDomainIDData *data = opaque;
|
struct virDomainIDData *data = opaque;
|
||||||
virDomainObjLock(obj);
|
virDomainObjLock(obj);
|
||||||
if (virDomainIsActive(obj) && data->numids < data->maxids)
|
if (virDomainObjIsActive(obj) && data->numids < data->maxids)
|
||||||
data->ids[data->numids++] = obj->def->id;
|
data->ids[data->numids++] = obj->def->id;
|
||||||
virDomainObjUnlock(obj);
|
virDomainObjUnlock(obj);
|
||||||
}
|
}
|
||||||
@ -5097,7 +5097,7 @@ static void virDomainObjListCopyInactiveNames(void *payload, const char *name AT
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
virDomainObjLock(obj);
|
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)))
|
if (!(data->names[data->numnames] = strdup(obj->def->name)))
|
||||||
data->oom = 1;
|
data->oom = 1;
|
||||||
else
|
else
|
||||||
|
@ -650,7 +650,7 @@ struct _virDomainObjList {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
virDomainIsActive(virDomainObjPtr dom)
|
virDomainObjIsActive(virDomainObjPtr dom)
|
||||||
{
|
{
|
||||||
return dom->def->id != -1;
|
return dom->def->id != -1;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ struct _virInterfaceObjList {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
virInterfaceIsActive(const virInterfaceObjPtr iface)
|
virInterfaceObjIsActive(const virInterfaceObjPtr iface)
|
||||||
{
|
{
|
||||||
return iface->active;
|
return iface->active;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ virNetworkObjPtr virNetworkAssignDef(virConnectPtr conn,
|
|||||||
virNetworkObjPtr network;
|
virNetworkObjPtr network;
|
||||||
|
|
||||||
if ((network = virNetworkFindByName(nets, def->name))) {
|
if ((network = virNetworkFindByName(nets, def->name))) {
|
||||||
if (!virNetworkIsActive(network)) {
|
if (!virNetworkObjIsActive(network)) {
|
||||||
virNetworkDefFree(network->def);
|
virNetworkDefFree(network->def);
|
||||||
network->def = def;
|
network->def = def;
|
||||||
} else {
|
} else {
|
||||||
|
@ -106,7 +106,7 @@ struct _virNetworkObjList {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
virNetworkIsActive(const virNetworkObjPtr net)
|
virNetworkObjIsActive(const virNetworkObjPtr net)
|
||||||
{
|
{
|
||||||
return net->active;
|
return net->active;
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@ static int lxcDomainUndefine(virDomainPtr dom)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainIsActive(vm)) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
|
lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("cannot delete active domain"));
|
"%s", _("cannot delete active domain"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -418,7 +418,7 @@ static int lxcDomainGetInfo(virDomainPtr dom,
|
|||||||
|
|
||||||
info->state = vm->state;
|
info->state = vm->state;
|
||||||
|
|
||||||
if (!virDomainIsActive(vm) || driver->cgroup == NULL) {
|
if (!virDomainObjIsActive(vm) || driver->cgroup == NULL) {
|
||||||
info->cpuTime = 0;
|
info->cpuTime = 0;
|
||||||
info->memory = vm->def->memory;
|
info->memory = vm->def->memory;
|
||||||
} else {
|
} else {
|
||||||
@ -558,7 +558,7 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainIsActive(vm)) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
|
if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
|
||||||
lxcError(dom->conn, dom, VIR_ERR_INTERNAL_ERROR,
|
lxcError(dom->conn, dom, VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unable to get cgroup for %s\n"), vm->def->name);
|
_("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 */
|
/* UUID & name match, but if VM is already active, refuse it */
|
||||||
if (virDomainIsActive(vm)) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED,
|
lxcError(conn, NULL, VIR_ERR_OPERATION_FAILED,
|
||||||
_("domain is already active as '%s'"), vm->def->name);
|
_("domain is already active as '%s'"), vm->def->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1545,7 +1545,7 @@ lxcAutostartDomain(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaqu
|
|||||||
|
|
||||||
virDomainObjLock(vm);
|
virDomainObjLock(vm);
|
||||||
if (vm->autostart &&
|
if (vm->autostart &&
|
||||||
!virDomainIsActive(vm)) {
|
!virDomainObjIsActive(vm)) {
|
||||||
int ret = lxcVmStart(data->conn, data->driver, vm);
|
int ret = lxcVmStart(data->conn, data->driver, vm);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
virErrorPtr err = virGetLastError();
|
virErrorPtr err = virGetLastError();
|
||||||
@ -2151,7 +2151,7 @@ static int lxcDomainSuspend(virDomainPtr dom)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
|
lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -2216,7 +2216,7 @@ static int lxcDomainResume(virDomainPtr dom)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
|
lxcError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -173,7 +173,7 @@ networkAutostartConfigs(struct network_driver *driver) {
|
|||||||
for (i = 0 ; i < driver->networks.count ; i++) {
|
for (i = 0 ; i < driver->networks.count ; i++) {
|
||||||
virNetworkObjLock(driver->networks.objs[i]);
|
virNetworkObjLock(driver->networks.objs[i]);
|
||||||
if (driver->networks.objs[i]->autostart &&
|
if (driver->networks.objs[i]->autostart &&
|
||||||
!virNetworkIsActive(driver->networks.objs[i]) &&
|
!virNetworkObjIsActive(driver->networks.objs[i]) &&
|
||||||
networkStartNetworkDaemon(NULL, driver, driver->networks.objs[i]) < 0) {
|
networkStartNetworkDaemon(NULL, driver, driver->networks.objs[i]) < 0) {
|
||||||
/* failed to start but already logged */
|
/* failed to start but already logged */
|
||||||
}
|
}
|
||||||
@ -322,7 +322,7 @@ networkActive(void) {
|
|||||||
for (i = 0 ; i < driverState->networks.count ; i++) {
|
for (i = 0 ; i < driverState->networks.count ; i++) {
|
||||||
virNetworkObjPtr net = driverState->networks.objs[i];
|
virNetworkObjPtr net = driverState->networks.objs[i];
|
||||||
virNetworkObjLock(net);
|
virNetworkObjLock(net);
|
||||||
if (virNetworkIsActive(net))
|
if (virNetworkObjIsActive(net))
|
||||||
active = 1;
|
active = 1;
|
||||||
virNetworkObjUnlock(net);
|
virNetworkObjUnlock(net);
|
||||||
}
|
}
|
||||||
@ -871,7 +871,7 @@ static int networkStartNetworkDaemon(virConnectPtr conn,
|
|||||||
virNetworkObjPtr network) {
|
virNetworkObjPtr network) {
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (virNetworkIsActive(network)) {
|
if (virNetworkObjIsActive(network)) {
|
||||||
networkReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
networkReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("network is already active"));
|
"%s", _("network is already active"));
|
||||||
return -1;
|
return -1;
|
||||||
@ -976,7 +976,7 @@ static int networkShutdownNetworkDaemon(virConnectPtr conn,
|
|||||||
|
|
||||||
VIR_INFO(_("Shutting down network '%s'\n"), network->def->name);
|
VIR_INFO(_("Shutting down network '%s'\n"), network->def->name);
|
||||||
|
|
||||||
if (!virNetworkIsActive(network))
|
if (!virNetworkObjIsActive(network))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
stateFile = virNetworkConfigFile(conn, NETWORK_STATE_DIR, network->def->name);
|
stateFile = virNetworkConfigFile(conn, NETWORK_STATE_DIR, network->def->name);
|
||||||
@ -1088,7 +1088,7 @@ static int networkNumNetworks(virConnectPtr conn) {
|
|||||||
networkDriverLock(driver);
|
networkDriverLock(driver);
|
||||||
for (i = 0 ; i < driver->networks.count ; i++) {
|
for (i = 0 ; i < driver->networks.count ; i++) {
|
||||||
virNetworkObjLock(driver->networks.objs[i]);
|
virNetworkObjLock(driver->networks.objs[i]);
|
||||||
if (virNetworkIsActive(driver->networks.objs[i]))
|
if (virNetworkObjIsActive(driver->networks.objs[i]))
|
||||||
nactive++;
|
nactive++;
|
||||||
virNetworkObjUnlock(driver->networks.objs[i]);
|
virNetworkObjUnlock(driver->networks.objs[i]);
|
||||||
}
|
}
|
||||||
@ -1104,7 +1104,7 @@ static int networkListNetworks(virConnectPtr conn, char **const names, int nname
|
|||||||
networkDriverLock(driver);
|
networkDriverLock(driver);
|
||||||
for (i = 0 ; i < driver->networks.count && got < nnames ; i++) {
|
for (i = 0 ; i < driver->networks.count && got < nnames ; i++) {
|
||||||
virNetworkObjLock(driver->networks.objs[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))) {
|
if (!(names[got] = strdup(driver->networks.objs[i]->def->name))) {
|
||||||
virNetworkObjUnlock(driver->networks.objs[i]);
|
virNetworkObjUnlock(driver->networks.objs[i]);
|
||||||
virReportOOMError(conn);
|
virReportOOMError(conn);
|
||||||
@ -1132,7 +1132,7 @@ static int networkNumDefinedNetworks(virConnectPtr conn) {
|
|||||||
networkDriverLock(driver);
|
networkDriverLock(driver);
|
||||||
for (i = 0 ; i < driver->networks.count ; i++) {
|
for (i = 0 ; i < driver->networks.count ; i++) {
|
||||||
virNetworkObjLock(driver->networks.objs[i]);
|
virNetworkObjLock(driver->networks.objs[i]);
|
||||||
if (!virNetworkIsActive(driver->networks.objs[i]))
|
if (!virNetworkObjIsActive(driver->networks.objs[i]))
|
||||||
ninactive++;
|
ninactive++;
|
||||||
virNetworkObjUnlock(driver->networks.objs[i]);
|
virNetworkObjUnlock(driver->networks.objs[i]);
|
||||||
}
|
}
|
||||||
@ -1148,7 +1148,7 @@ static int networkListDefinedNetworks(virConnectPtr conn, char **const names, in
|
|||||||
networkDriverLock(driver);
|
networkDriverLock(driver);
|
||||||
for (i = 0 ; i < driver->networks.count && got < nnames ; i++) {
|
for (i = 0 ; i < driver->networks.count && got < nnames ; i++) {
|
||||||
virNetworkObjLock(driver->networks.objs[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))) {
|
if (!(names[got] = strdup(driver->networks.objs[i]->def->name))) {
|
||||||
virNetworkObjUnlock(driver->networks.objs[i]);
|
virNetworkObjUnlock(driver->networks.objs[i]);
|
||||||
virReportOOMError(conn);
|
virReportOOMError(conn);
|
||||||
@ -1260,7 +1260,7 @@ static int networkUndefine(virNetworkPtr net) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virNetworkIsActive(network)) {
|
if (virNetworkObjIsActive(network)) {
|
||||||
networkReportError(net->conn, NULL, net, VIR_ERR_INTERNAL_ERROR,
|
networkReportError(net->conn, NULL, net, VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("network is still active"));
|
"%s", _("network is still active"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1321,7 +1321,7 @@ static int networkDestroy(virNetworkPtr net) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!virNetworkIsActive(network)) {
|
if (!virNetworkObjIsActive(network)) {
|
||||||
networkReportError(net->conn, NULL, net, VIR_ERR_INTERNAL_ERROR,
|
networkReportError(net->conn, NULL, net, VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("network is not active"));
|
"%s", _("network is not active"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -307,7 +307,7 @@ static int oneDomainGetInfo(virDomainPtr dom,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
info->cpuTime = 0;
|
info->cpuTime = 0;
|
||||||
} else {
|
} else {
|
||||||
char vm_info[257];
|
char vm_info[257];
|
||||||
|
@ -398,7 +398,7 @@ static int openvzDomainGetInfo(virDomainPtr dom,
|
|||||||
|
|
||||||
info->state = vm->state;
|
info->state = vm->state;
|
||||||
|
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
info->cpuTime = 0;
|
info->cpuTime = 0;
|
||||||
} else {
|
} else {
|
||||||
if (openvzGetProcessInfo(&(info->cpuTime), dom->id) < 0) {
|
if (openvzGetProcessInfo(&(info->cpuTime), dom->id) < 0) {
|
||||||
@ -964,7 +964,7 @@ openvzDomainUndefine(virDomainPtr dom)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainIsActive(vm)) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR, "%s", _("cannot delete active domain"));
|
openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR, "%s", _("cannot delete active domain"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ qemuAutostartDomain(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaq
|
|||||||
|
|
||||||
virDomainObjLock(vm);
|
virDomainObjLock(vm);
|
||||||
if (vm->autostart &&
|
if (vm->autostart &&
|
||||||
!virDomainIsActive(vm)) {
|
!virDomainObjIsActive(vm)) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
@ -1960,7 +1960,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
|
|||||||
|
|
||||||
FD_ZERO(&keepfd);
|
FD_ZERO(&keepfd);
|
||||||
|
|
||||||
if (virDomainIsActive(vm)) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_INVALID,
|
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("VM is already active"));
|
"%s", _("VM is already active"));
|
||||||
return -1;
|
return -1;
|
||||||
@ -2167,7 +2167,7 @@ static void qemudShutdownVMDaemon(virConnectPtr conn,
|
|||||||
int ret;
|
int ret;
|
||||||
int retries = 0;
|
int retries = 0;
|
||||||
|
|
||||||
if (!virDomainIsActive(vm))
|
if (!virDomainObjIsActive(vm))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VIR_DEBUG(_("Shutting down VM '%s'\n"), vm->def->name);
|
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 */
|
/* 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,
|
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||||
_("domain is already active as '%s'"), vm->def->name);
|
_("domain is already active as '%s'"), vm->def->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -2745,7 +2745,7 @@ static int qemudDomainSuspend(virDomainPtr dom) {
|
|||||||
_("no domain with matching uuid '%s'"), uuidstr);
|
_("no domain with matching uuid '%s'"), uuidstr);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -2789,7 +2789,7 @@ static int qemudDomainResume(virDomainPtr dom) {
|
|||||||
_("no domain with matching uuid '%s'"), uuidstr);
|
_("no domain with matching uuid '%s'"), uuidstr);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -2837,7 +2837,7 @@ static int qemudDomainShutdown(virDomainPtr dom) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -2870,7 +2870,7 @@ static int qemudDomainDestroy(virDomainPtr dom) {
|
|||||||
_("no domain with matching uuid '%s'"), uuidstr);
|
_("no domain with matching uuid '%s'"), uuidstr);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -3003,7 +3003,7 @@ static int qemudDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainIsActive(vm)) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
int r = qemuMonitorSetBalloon(vm, newmem);
|
int r = qemuMonitorSetBalloon(vm, newmem);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -3046,7 +3046,7 @@ static int qemudDomainGetInfo(virDomainPtr dom,
|
|||||||
|
|
||||||
info->state = vm->state;
|
info->state = vm->state;
|
||||||
|
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
info->cpuTime = 0;
|
info->cpuTime = 0;
|
||||||
} else {
|
} else {
|
||||||
if (qemudGetProcessInfo(&(info->cpuTime), NULL, vm->pid, 0) < 0) {
|
if (qemudGetProcessInfo(&(info->cpuTime), NULL, vm->pid, 0) < 0) {
|
||||||
@ -3057,7 +3057,7 @@ static int qemudDomainGetInfo(virDomainPtr dom,
|
|||||||
|
|
||||||
info->maxMem = vm->def->maxmem;
|
info->maxMem = vm->def->maxmem;
|
||||||
|
|
||||||
if (virDomainIsActive(vm)) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
err = qemuMonitorGetBalloonInfo(vm, &balloon);
|
err = qemuMonitorGetBalloonInfo(vm, &balloon);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -3157,7 +3157,7 @@ static int qemudDomainSave(virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -3273,7 +3273,7 @@ static int qemudDomainCoreDump(virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -3330,7 +3330,7 @@ static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainIsActive(vm)) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s",
|
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
_("cannot change vcpu count of an active domain"));
|
_("cannot change vcpu count of an active domain"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -3391,7 +3391,7 @@ qemudDomainPinVcpu(virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s",_("cannot pin vcpus on an inactive domain"));
|
"%s",_("cannot pin vcpus on an inactive domain"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -3460,7 +3460,7 @@ qemudDomainGetVcpus(virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s",
|
"%s",
|
||||||
_("cannot list vcpu pinning for an inactive domain"));
|
_("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
|
* after reading the label, by checking that our FD connecting to the
|
||||||
* QEMU monitor hasn't seen SIGHUP/ERR on poll().
|
* QEMU monitor hasn't seen SIGHUP/ERR on poll().
|
||||||
*/
|
*/
|
||||||
if (virDomainIsActive(vm)) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
if (driver->securityDriver && driver->securityDriver->domainGetSecurityLabel) {
|
if (driver->securityDriver && driver->securityDriver->domainGetSecurityLabel) {
|
||||||
if (driver->securityDriver->domainGetSecurityLabel(dom->conn, vm, seclabel) == -1) {
|
if (driver->securityDriver->domainGetSecurityLabel(dom->conn, vm, seclabel) == -1) {
|
||||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
|
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 */
|
/* 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,
|
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_INVALID,
|
||||||
_("domain is already active as '%s'"), vm->def->name);
|
_("domain is already active as '%s'"), vm->def->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -3862,7 +3862,7 @@ static char *qemudDomainDumpXML(virDomainPtr dom,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Refresh current memory based on balloon info */
|
/* Refresh current memory based on balloon info */
|
||||||
if (virDomainIsActive(vm)) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
err = qemuMonitorGetBalloonInfo(vm, &balloon);
|
err = qemuMonitorGetBalloonInfo(vm, &balloon);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -4298,7 +4298,7 @@ static int qemudDomainUndefine(virDomainPtr dom) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainIsActive(vm)) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("cannot delete active domain"));
|
"%s", _("cannot delete active domain"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -4756,7 +4756,7 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("cannot attach device on inactive domain"));
|
"%s", _("cannot attach device on inactive domain"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -5112,7 +5112,7 @@ static int qemudDomainDetachDevice(virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("cannot detach device on inactive domain"));
|
"%s", _("cannot detach device on inactive domain"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -5427,7 +5427,7 @@ qemudDomainBlockStats (virDomainPtr dom,
|
|||||||
_("no domain with matching uuid '%s'"), uuidstr);
|
_("no domain with matching uuid '%s'"), uuidstr);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (!virDomainIsActive (vm)) {
|
if (!virDomainObjIsActive (vm)) {
|
||||||
qemudReportError (dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
qemudReportError (dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -5490,7 +5490,7 @@ qemudDomainInterfaceStats (virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -5629,7 +5629,7 @@ qemudDomainMemoryPeek (virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -6094,7 +6094,7 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn,
|
|||||||
|
|
||||||
if (!vm) vm = virDomainFindByName(&driver->domains, dname);
|
if (!vm) vm = virDomainFindByName(&driver->domains, dname);
|
||||||
if (vm) {
|
if (vm) {
|
||||||
if (virDomainIsActive(vm)) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
qemudReportError(dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
qemudReportError(dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||||
_("domain with the same name or UUID already exists as '%s'"),
|
_("domain with the same name or UUID already exists as '%s'"),
|
||||||
vm->def->name);
|
vm->def->name);
|
||||||
@ -6333,7 +6333,7 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
|
|||||||
|
|
||||||
if (!vm) vm = virDomainFindByName(&driver->domains, dname);
|
if (!vm) vm = virDomainFindByName(&driver->domains, dname);
|
||||||
if (vm) {
|
if (vm) {
|
||||||
if (virDomainIsActive(vm)) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
qemudReportError (dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
qemudReportError (dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||||
_("domain with the same name or UUID already exists as '%s'"),
|
_("domain with the same name or UUID already exists as '%s'"),
|
||||||
vm->def->name);
|
vm->def->name);
|
||||||
@ -6795,7 +6795,7 @@ qemudDomainMigratePerform (virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
qemudReportError (dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
qemudReportError (dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
|
||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -2370,7 +2370,7 @@ static int testNumNetworks(virConnectPtr conn) {
|
|||||||
testDriverLock(privconn);
|
testDriverLock(privconn);
|
||||||
for (i = 0 ; i < privconn->networks.count ; i++) {
|
for (i = 0 ; i < privconn->networks.count ; i++) {
|
||||||
virNetworkObjLock(privconn->networks.objs[i]);
|
virNetworkObjLock(privconn->networks.objs[i]);
|
||||||
if (virNetworkIsActive(privconn->networks.objs[i]))
|
if (virNetworkObjIsActive(privconn->networks.objs[i]))
|
||||||
numActive++;
|
numActive++;
|
||||||
virNetworkObjUnlock(privconn->networks.objs[i]);
|
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);
|
memset(names, 0, sizeof(*names)*nnames);
|
||||||
for (i = 0 ; i < privconn->networks.count && n < nnames ; i++) {
|
for (i = 0 ; i < privconn->networks.count && n < nnames ; i++) {
|
||||||
virNetworkObjLock(privconn->networks.objs[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))) {
|
!(names[n++] = strdup(privconn->networks.objs[i]->def->name))) {
|
||||||
virNetworkObjUnlock(privconn->networks.objs[i]);
|
virNetworkObjUnlock(privconn->networks.objs[i]);
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
@ -2413,7 +2413,7 @@ static int testNumDefinedNetworks(virConnectPtr conn) {
|
|||||||
testDriverLock(privconn);
|
testDriverLock(privconn);
|
||||||
for (i = 0 ; i < privconn->networks.count ; i++) {
|
for (i = 0 ; i < privconn->networks.count ; i++) {
|
||||||
virNetworkObjLock(privconn->networks.objs[i]);
|
virNetworkObjLock(privconn->networks.objs[i]);
|
||||||
if (!virNetworkIsActive(privconn->networks.objs[i]))
|
if (!virNetworkObjIsActive(privconn->networks.objs[i]))
|
||||||
numInactive++;
|
numInactive++;
|
||||||
virNetworkObjUnlock(privconn->networks.objs[i]);
|
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);
|
memset(names, 0, sizeof(*names)*nnames);
|
||||||
for (i = 0 ; i < privconn->networks.count && n < nnames ; i++) {
|
for (i = 0 ; i < privconn->networks.count && n < nnames ; i++) {
|
||||||
virNetworkObjLock(privconn->networks.objs[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))) {
|
!(names[n++] = strdup(privconn->networks.objs[i]->def->name))) {
|
||||||
virNetworkObjUnlock(privconn->networks.objs[i]);
|
virNetworkObjUnlock(privconn->networks.objs[i]);
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
@ -2513,7 +2513,7 @@ static int testNetworkUndefine(virNetworkPtr network) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virNetworkIsActive(privnet)) {
|
if (virNetworkObjIsActive(privnet)) {
|
||||||
testError(network->conn, VIR_ERR_INTERNAL_ERROR,
|
testError(network->conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Network '%s' is still running"), network->name);
|
_("Network '%s' is still running"), network->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -2546,7 +2546,7 @@ static int testNetworkStart(virNetworkPtr network) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virNetworkIsActive(privnet)) {
|
if (virNetworkObjIsActive(privnet)) {
|
||||||
testError(network->conn, VIR_ERR_INTERNAL_ERROR,
|
testError(network->conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Network '%s' is already running"), network->name);
|
_("Network '%s' is already running"), network->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -2727,7 +2727,7 @@ static int testNumOfInterfaces(virConnectPtr conn)
|
|||||||
testDriverLock(privconn);
|
testDriverLock(privconn);
|
||||||
for (i = 0 ; (i < privconn->ifaces.count); i++) {
|
for (i = 0 ; (i < privconn->ifaces.count); i++) {
|
||||||
virInterfaceObjLock(privconn->ifaces.objs[i]);
|
virInterfaceObjLock(privconn->ifaces.objs[i]);
|
||||||
if (virInterfaceIsActive(privconn->ifaces.objs[i])) {
|
if (virInterfaceObjIsActive(privconn->ifaces.objs[i])) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
virInterfaceObjUnlock(privconn->ifaces.objs[i]);
|
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);
|
memset(names, 0, sizeof(*names)*nnames);
|
||||||
for (i = 0 ; (i < privconn->ifaces.count) && (n < nnames); i++) {
|
for (i = 0 ; (i < privconn->ifaces.count) && (n < nnames); i++) {
|
||||||
virInterfaceObjLock(privconn->ifaces.objs[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))) {
|
if (!(names[n++] = strdup(privconn->ifaces.objs[i]->def->name))) {
|
||||||
virInterfaceObjUnlock(privconn->ifaces.objs[i]);
|
virInterfaceObjUnlock(privconn->ifaces.objs[i]);
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
@ -2773,7 +2773,7 @@ static int testNumOfDefinedInterfaces(virConnectPtr conn)
|
|||||||
testDriverLock(privconn);
|
testDriverLock(privconn);
|
||||||
for (i = 0 ; i < privconn->ifaces.count; i++) {
|
for (i = 0 ; i < privconn->ifaces.count; i++) {
|
||||||
virInterfaceObjLock(privconn->ifaces.objs[i]);
|
virInterfaceObjLock(privconn->ifaces.objs[i]);
|
||||||
if (!virInterfaceIsActive(privconn->ifaces.objs[i])) {
|
if (!virInterfaceObjIsActive(privconn->ifaces.objs[i])) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
virInterfaceObjUnlock(privconn->ifaces.objs[i]);
|
virInterfaceObjUnlock(privconn->ifaces.objs[i]);
|
||||||
@ -2791,7 +2791,7 @@ static int testListDefinedInterfaces(virConnectPtr conn, char **const names, int
|
|||||||
memset(names, 0, sizeof(*names)*nnames);
|
memset(names, 0, sizeof(*names)*nnames);
|
||||||
for (i = 0 ; (i < privconn->ifaces.count) && (n < nnames); i++) {
|
for (i = 0 ; (i < privconn->ifaces.count) && (n < nnames); i++) {
|
||||||
virInterfaceObjLock(privconn->ifaces.objs[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))) {
|
if (!(names[n++] = strdup(privconn->ifaces.objs[i]->def->name))) {
|
||||||
virInterfaceObjUnlock(privconn->ifaces.objs[i]);
|
virInterfaceObjUnlock(privconn->ifaces.objs[i]);
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
@ -127,7 +127,7 @@ umlAutostartDomain(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaqu
|
|||||||
|
|
||||||
virDomainObjLock(vm);
|
virDomainObjLock(vm);
|
||||||
if (vm->autostart &&
|
if (vm->autostart &&
|
||||||
!virDomainIsActive(vm)) {
|
!virDomainObjIsActive(vm)) {
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
if (umlStartVMDaemon(data->conn, data->driver, vm) < 0) {
|
if (umlStartVMDaemon(data->conn, data->driver, vm) < 0) {
|
||||||
virErrorPtr err = virGetLastError();
|
virErrorPtr err = virGetLastError();
|
||||||
@ -273,7 +273,7 @@ reread:
|
|||||||
|
|
||||||
if (e->mask & IN_DELETE) {
|
if (e->mask & IN_DELETE) {
|
||||||
VIR_DEBUG("Got inotify domain shutdown '%s'", name);
|
VIR_DEBUG("Got inotify domain shutdown '%s'", name);
|
||||||
if (!virDomainIsActive(dom)) {
|
if (!virDomainObjIsActive(dom)) {
|
||||||
virDomainObjUnlock(dom);
|
virDomainObjUnlock(dom);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -281,7 +281,7 @@ reread:
|
|||||||
umlShutdownVMDaemon(NULL, driver, dom);
|
umlShutdownVMDaemon(NULL, driver, dom);
|
||||||
} else if (e->mask & (IN_CREATE | IN_MODIFY)) {
|
} else if (e->mask & (IN_CREATE | IN_MODIFY)) {
|
||||||
VIR_DEBUG("Got inotify domain startup '%s'", name);
|
VIR_DEBUG("Got inotify domain startup '%s'", name);
|
||||||
if (virDomainIsActive(dom)) {
|
if (virDomainObjIsActive(dom)) {
|
||||||
virDomainObjUnlock(dom);
|
virDomainObjUnlock(dom);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -487,7 +487,7 @@ umlShutdownOneVM(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaque)
|
|||||||
struct uml_driver *driver = opaque;
|
struct uml_driver *driver = opaque;
|
||||||
|
|
||||||
virDomainObjLock(dom);
|
virDomainObjLock(dom);
|
||||||
if (virDomainIsActive(dom))
|
if (virDomainObjIsActive(dom))
|
||||||
umlShutdownVMDaemon(NULL, driver, dom);
|
umlShutdownVMDaemon(NULL, driver, dom);
|
||||||
virDomainObjUnlock(dom);
|
virDomainObjUnlock(dom);
|
||||||
}
|
}
|
||||||
@ -784,7 +784,7 @@ static int umlStartVMDaemon(virConnectPtr conn,
|
|||||||
|
|
||||||
FD_ZERO(&keepfd);
|
FD_ZERO(&keepfd);
|
||||||
|
|
||||||
if (virDomainIsActive(vm)) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("VM is already active"));
|
"%s", _("VM is already active"));
|
||||||
return -1;
|
return -1;
|
||||||
@ -900,7 +900,7 @@ static void umlShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
virDomainObjPtr vm)
|
virDomainObjPtr vm)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
if (!virDomainIsActive(vm))
|
if (!virDomainObjIsActive(vm))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
virKillProcess(vm->pid, SIGTERM);
|
virKillProcess(vm->pid, SIGTERM);
|
||||||
@ -1398,7 +1398,7 @@ static int umlDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainIsActive(vm)) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
umlReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
|
umlReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
|
||||||
"%s", _("cannot set memory of an active domain"));
|
"%s", _("cannot set memory of an active domain"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1437,7 +1437,7 @@ static int umlDomainGetInfo(virDomainPtr dom,
|
|||||||
|
|
||||||
info->state = vm->state;
|
info->state = vm->state;
|
||||||
|
|
||||||
if (!virDomainIsActive(vm)) {
|
if (!virDomainObjIsActive(vm)) {
|
||||||
info->cpuTime = 0;
|
info->cpuTime = 0;
|
||||||
} else {
|
} else {
|
||||||
if (umlGetProcessInfo(&(info->cpuTime), vm->pid) < 0) {
|
if (umlGetProcessInfo(&(info->cpuTime), vm->pid) < 0) {
|
||||||
@ -1587,7 +1587,7 @@ static int umlDomainUndefine(virDomainPtr dom) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainIsActive(vm)) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
umlReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
|
umlReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("cannot delete active domain"));
|
"%s", _("cannot delete active domain"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
Reference in New Issue
Block a user