cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mlsoren...@apache.org
Subject [16/17] git commit: updated refs/heads/resize-root to caf9de6
Date Tue, 04 Mar 2014 21:27:51 GMT
CLOUDSTACK-6192: Return failure on StartCommand and PrepareForMigrationCommand
when connectPhysicalDisk fails, rather than continuing on


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/fb0b2eb2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/fb0b2eb2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/fb0b2eb2

Branch: refs/heads/resize-root
Commit: fb0b2eb26731a6db00c65dcd799653a213475387
Parents: 1f9649b
Author: Marcus Sorensen <marcus@betterservers.com>
Authored: Tue Mar 4 14:18:51 2014 -0700
Committer: Marcus Sorensen <marcus@betterservers.com>
Committed: Tue Mar 4 14:18:51 2014 -0700

----------------------------------------------------------------------
 .../kvm/resource/LibvirtComputingResource.java       | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fb0b2eb2/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 3553b5c..1056bcf 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -3063,7 +3063,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements
Serv
 
         NicTO[] nics = vm.getNics();
 
-        boolean success = false;
+        boolean skipDisconnect = false;
 
         try {
             Connect conn = LibvirtConnection.getConnectionByVmName(vm.getName());
@@ -3079,13 +3079,16 @@ public class LibvirtComputingResource extends ServerResourceBase implements
Serv
                 }
             }
 
-            _storagePoolMgr.connectPhysicalDisksViaVmSpec(vm);
+            if (!_storagePoolMgr.connectPhysicalDisksViaVmSpec(vm)) {
+                skipDisconnect = true;
+                return new PrepareForMigrationAnswer(cmd, "failed to connect physical disks
to host");
+            }
 
             synchronized (_vms) {
                 _vms.put(vm.getName(), State.Migrating);
             }
 
-            success = true;
+            skipDisconnect = true;
 
             return new PrepareForMigrationAnswer(cmd);
         } catch (LibvirtException e) {
@@ -3095,7 +3098,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements
Serv
         } catch (URISyntaxException e) {
             return new PrepareForMigrationAnswer(cmd, e.toString());
         } finally {
-            if (!success) {
+            if (!skipDisconnect) {
                 _storagePoolMgr.disconnectPhysicalDisksViaVmSpec(vm);
             }
         }
@@ -3628,7 +3631,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements
Serv
 
             createVbd(conn, vmSpec, vmName, vm);
 
-            _storagePoolMgr.connectPhysicalDisksViaVmSpec(vmSpec);
+            if (!_storagePoolMgr.connectPhysicalDisksViaVmSpec(vmSpec)) {
+                return new StartAnswer(cmd, "Failed to connect physical disks to host");
+            }
 
             createVifs(vmSpec, vm);
 


Mime
View raw message