提交 e065e1ea 编写于 作者: M Matthias Bolte

Use VIR_ERR_OPERATION_INVALID when appropriated

VIR_ERR_OPERATION_INVALID means that the operation is not valid
for the current state of the involved object.
上级 8c6d6116
......@@ -1660,7 +1660,6 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
goto cleanup;
}
if (esxVI_GetVirtualMachineIdentity(virtualMachine, &id, NULL, uuid) < 0 ||
esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0) {
goto cleanup;
......
......@@ -2491,7 +2491,7 @@ static int lxcDomainSetAutostart(virDomainPtr dom,
}
if (!vm->persistent) {
lxcError(VIR_ERR_INTERNAL_ERROR,
lxcError(VIR_ERR_OPERATION_INVALID,
"%s", _("Cannot set autostart for transient domain"));
goto cleanup;
}
......
......@@ -1537,7 +1537,7 @@ networkStartNetworkDaemon(struct network_driver *driver,
virNetworkIpDefPtr ipdef;
if (virNetworkObjIsActive(network)) {
networkReportError(VIR_ERR_INTERNAL_ERROR,
networkReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("network is already active"));
return -1;
}
......
......@@ -291,7 +291,7 @@ static int oneDomainUndefine(virDomainPtr dom)
}
if (!vm->persistent) {
oneError(VIR_ERR_INTERNAL_ERROR, "%s",
oneError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot undefine transient domain"));
goto return_point;
}
......
......@@ -1079,7 +1079,7 @@ openvzDomainUndefine(virDomainPtr dom)
}
if (virDomainObjIsActive(vm)) {
openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
openvzError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot delete active domain"));
goto cleanup;
}
......
......@@ -6401,7 +6401,7 @@ static int qemudDomainUndefine(virDomainPtr dom) {
}
if (!vm->persistent) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
qemuReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("cannot undefine transient domain"));
goto cleanup;
}
......@@ -6848,7 +6848,7 @@ static int qemudDomainSetAutostart(virDomainPtr dom,
}
if (!vm->persistent) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
qemuReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("cannot set autostart for transient domain"));
goto cleanup;
}
......
......@@ -3061,7 +3061,7 @@ static int testNetworkUndefine(virNetworkPtr network) {
}
if (virNetworkObjIsActive(privnet)) {
testError(VIR_ERR_INTERNAL_ERROR,
testError(VIR_ERR_OPERATION_INVALID,
_("Network '%s' is still running"), network->name);
goto cleanup;
}
......@@ -3094,7 +3094,7 @@ static int testNetworkStart(virNetworkPtr network) {
}
if (virNetworkObjIsActive(privnet)) {
testError(VIR_ERR_INTERNAL_ERROR,
testError(VIR_ERR_OPERATION_INVALID,
_("Network '%s' is already running"), network->name);
goto cleanup;
}
......@@ -3817,7 +3817,7 @@ testStoragePoolStart(virStoragePoolPtr pool,
}
if (virStoragePoolObjIsActive(privpool)) {
testError(VIR_ERR_INTERNAL_ERROR,
testError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is already active"), pool->name);
goto cleanup;
}
......@@ -3982,7 +3982,7 @@ testStoragePoolUndefine(virStoragePoolPtr pool) {
}
if (virStoragePoolObjIsActive(privpool)) {
testError(VIR_ERR_INTERNAL_ERROR,
testError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is already active"), pool->name);
goto cleanup;
}
......@@ -4015,7 +4015,7 @@ testStoragePoolBuild(virStoragePoolPtr pool,
}
if (virStoragePoolObjIsActive(privpool)) {
testError(VIR_ERR_INTERNAL_ERROR,
testError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is already active"), pool->name);
goto cleanup;
}
......@@ -4044,7 +4044,7 @@ testStoragePoolDestroy(virStoragePoolPtr pool) {
}
if (!virStoragePoolObjIsActive(privpool)) {
testError(VIR_ERR_INTERNAL_ERROR,
testError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is not active"), pool->name);
goto cleanup;
}
......@@ -4083,7 +4083,7 @@ testStoragePoolDelete(virStoragePoolPtr pool,
}
if (virStoragePoolObjIsActive(privpool)) {
testError(VIR_ERR_INTERNAL_ERROR,
testError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is already active"), pool->name);
goto cleanup;
}
......@@ -4115,7 +4115,7 @@ testStoragePoolRefresh(virStoragePoolPtr pool,
}
if (!virStoragePoolObjIsActive(privpool)) {
testError(VIR_ERR_INTERNAL_ERROR,
testError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is not active"), pool->name);
goto cleanup;
}
......@@ -4267,7 +4267,7 @@ testStoragePoolNumVolumes(virStoragePoolPtr pool) {
}
if (!virStoragePoolObjIsActive(privpool)) {
testError(VIR_ERR_INTERNAL_ERROR,
testError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is not active"), pool->name);
goto cleanup;
}
......@@ -4302,7 +4302,7 @@ testStoragePoolListVolumes(virStoragePoolPtr pool,
if (!virStoragePoolObjIsActive(privpool)) {
testError(VIR_ERR_INTERNAL_ERROR,
testError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is not active"), pool->name);
goto cleanup;
}
......@@ -4348,7 +4348,7 @@ testStorageVolumeLookupByName(virStoragePoolPtr pool,
if (!virStoragePoolObjIsActive(privpool)) {
testError(VIR_ERR_INTERNAL_ERROR,
testError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is not active"), pool->name);
goto cleanup;
}
......@@ -4459,7 +4459,7 @@ testStorageVolumeCreateXML(virStoragePoolPtr pool,
}
if (!virStoragePoolObjIsActive(privpool)) {
testError(VIR_ERR_INTERNAL_ERROR,
testError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is not active"), pool->name);
goto cleanup;
}
......@@ -4540,7 +4540,7 @@ testStorageVolumeCreateXMLFrom(virStoragePoolPtr pool,
}
if (!virStoragePoolObjIsActive(privpool)) {
testError(VIR_ERR_INTERNAL_ERROR,
testError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is not active"), pool->name);
goto cleanup;
}
......@@ -4640,7 +4640,7 @@ testStorageVolumeDelete(virStorageVolPtr vol,
}
if (!virStoragePoolObjIsActive(privpool)) {
testError(VIR_ERR_INTERNAL_ERROR,
testError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is not active"), vol->pool);
goto cleanup;
}
......@@ -4718,7 +4718,7 @@ testStorageVolumeGetInfo(virStorageVolPtr vol,
}
if (!virStoragePoolObjIsActive(privpool)) {
testError(VIR_ERR_INTERNAL_ERROR,
testError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is not active"), vol->pool);
goto cleanup;
}
......@@ -4763,7 +4763,7 @@ testStorageVolumeGetXMLDesc(virStorageVolPtr vol,
}
if (!virStoragePoolObjIsActive(privpool)) {
testError(VIR_ERR_INTERNAL_ERROR,
testError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is not active"), vol->pool);
goto cleanup;
}
......@@ -4803,7 +4803,7 @@ testStorageVolumeGetPath(virStorageVolPtr vol) {
}
if (!virStoragePoolObjIsActive(privpool)) {
testError(VIR_ERR_INTERNAL_ERROR,
testError(VIR_ERR_OPERATION_INVALID,
_("storage pool '%s' is not active"), vol->pool);
goto cleanup;
}
......
......@@ -819,7 +819,7 @@ static int umlStartVMDaemon(virConnectPtr conn,
virCommandPtr cmd = NULL;
if (virDomainObjIsActive(vm)) {
umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
umlReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("VM is already active"));
return -1;
}
......@@ -1462,7 +1462,7 @@ static int umlDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
}
if (virDomainObjIsActive(vm)) {
umlReportError(VIR_ERR_NO_SUPPORT, "%s",
umlReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot set memory of an active domain"));
goto cleanup;
}
......@@ -1656,13 +1656,13 @@ static int umlDomainUndefine(virDomainPtr dom) {
}
if (virDomainObjIsActive(vm)) {
umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
umlReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot delete active domain"));
goto cleanup;
}
if (!vm->persistent) {
umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
umlReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot undefine transient domain"));
goto cleanup;
}
......@@ -1954,7 +1954,7 @@ static int umlDomainSetAutostart(virDomainPtr dom,
}
if (!vm->persistent) {
umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
umlReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot set autostart for transient domain"));
goto cleanup;
}
......
......@@ -622,7 +622,7 @@ vmwareDomainUndefine(virDomainPtr dom)
}
if (!vm->persistent) {
vmwareError(VIR_ERR_INTERNAL_ERROR,
vmwareError(VIR_ERR_OPERATION_INVALID,
"%s", _("cannot undefine transient domain"));
goto cleanup;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册