mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
bug 14090: handle the case when command is sent to a different host that is not owner of the VM
This commit is contained in:
parent
eaf9d3d820
commit
8d2a00874b
@ -161,7 +161,6 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
||||
String workerVMName = null;
|
||||
String volumePath = cmd.getVolumePath();
|
||||
ManagedObjectReference morDs = null;
|
||||
String snapshotUUID = null;
|
||||
DatastoreMO dsMo=null;
|
||||
|
||||
// By default assume failure
|
||||
@ -203,16 +202,12 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
||||
// attach volume to worker VM
|
||||
String datastoreVolumePath = String.format("[%s] %s.vmdk", dsMo.getName(), volumePath);
|
||||
vmMo.attachDisk(new String[] { datastoreVolumePath }, morDs);
|
||||
snapshotUUID = UUID.randomUUID().toString();
|
||||
if (!vmMo.createSnapshot(snapshotUUID, "Snapshot taken for " + cmd.getSnapshotName(), false, false)) {
|
||||
throw new Exception("Failed to take snapshot " + cmd.getSnapshotName() + " on vm: " + cmd.getVmName());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!vmMo.createSnapshot(snapshotUuid, "Snapshot taken for " + cmd.getSnapshotName(), false, false)) {
|
||||
throw new Exception("Failed to take snapshot " + cmd.getSnapshotName() + " on vm: " + cmd.getVmName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!vmMo.createSnapshot(snapshotUuid, "Snapshot taken for " + cmd.getSnapshotName(), false, false)) {
|
||||
throw new Exception("Failed to take snapshot " + cmd.getSnapshotName() + " on vm: " + cmd.getVmName());
|
||||
}
|
||||
|
||||
snapshotBackupUuid = backupSnapshotToSecondaryStorage(vmMo, accountId, volumeId, cmd.getVolumePath(), snapshotUuid, secondaryStorageUrl, prevSnapshotUuid, prevBackupUuid,
|
||||
hostService.getWorkerName(context, cmd, 1));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user