]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Use VIR_ERR_OPERATION_INVALID when appropriated
authorMatthias Bolte <matthias.bolte@googlemail.com>
Sat, 15 Jan 2011 15:57:33 +0000 (16:57 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Tue, 18 Jan 2011 22:14:37 +0000 (23:14 +0100)
VIR_ERR_OPERATION_INVALID means that the operation is not valid
for the current state of the involved object.

src/esx/esx_driver.c
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
src/vmware/vmware_driver.c

index de3e49f0be537f47bc703eb8110caad60bbf1f1b..26f029ca5dcd09b604577d2bd25b8570737d3f20 100644 (file)
@@ -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;
index c4fe936839b1c31511f00fa5574e615989586fe8..df693ec6822be6158c51b9c4bf3abc4bda24e86b 100644 (file)
@@ -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;
     }
index 3f63afd9f18ce427e30b037084d5fe092510093f..c098ab53e0a762748e413da76826077337752615 100644 (file)
@@ -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;
     }
index b88f44ffb42a4a6e02cae8c33f12456472ede9ca..4febb46b0f81d06592ecde52062e074c215477fc 100644 (file)
@@ -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;
     }
index 7728981a3fc7667962c6194fff658accf924feb8..fc6ae296d37f233539e55993495401033c486341 100644 (file)
@@ -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;
     }
index 824e77602ea51f650d965b907344f4efcac2493f..22dc272aac61e94b8072df59f34d516d4fbbbe6a 100644 (file)
@@ -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;
     }
index 601ecf84b4719f86720f6b56fdfbb93d3b3149ce..7b077803b4b96b28ee1a9c9181578acf854dda5d 100644 (file)
@@ -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;
     }
index c6df0a1de00f6cc4da90f6017b1b40ef6bf4f54b..57f50f6d879a943aec648fc3c1350a3c3605d839 100644 (file)
@@ -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;
     }
index 47314f80835ee4e128292e0c5780a81d9c80e12a..f176c2f4f6207a60b7fd0c5f580c4307921d0955 100644 (file)
@@ -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;
     }