mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-6192: Return failure on StartCommand and PrepareForMigrationCommand
when connectPhysicalDisk fails, rather than continuing on
This commit is contained in:
parent
1f9649bc3b
commit
fb0b2eb267
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue