mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-4458: Volume attach/detach command needs to sent to hypervisor resource even when target VM is in Stopped state
(cherry picked from commit 995e193be2)
Signed-off-by: animesh <animesh@apache.org>
This commit is contained in:
parent
2b12088eab
commit
34ee6f90bb
|
|
@ -247,7 +247,6 @@ public class SnapshotServiceImpl implements SnapshotService {
|
|||
AsyncCallFuture<SnapshotResult> future = new AsyncCallFuture<SnapshotResult>();
|
||||
SnapshotResult result = new SnapshotResult(snapshot, null);
|
||||
try {
|
||||
|
||||
snapObj.processEvent(Snapshot.Event.BackupToSecondary);
|
||||
|
||||
DataStore imageStore = this.findSnapshotImageStore(snapshot);
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!needDelegation) {
|
||||
return new Pair<Boolean, Long>(Boolean.FALSE, new Long(hostId));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -969,7 +969,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
|||
throw new Exception("unable to prepare snapshot backup directory");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VirtualMachineMO clonedVm = null;
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -2026,6 +2026,16 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
|
|||
String errorMsg = "Failed to detach volume: " + volume.getName()
|
||||
+ " from VM: " + vm.getHostName();
|
||||
boolean sendCommand = (vm.getState() == State.Running);
|
||||
Long hostId = vm.getHostId();
|
||||
if (hostId == null) {
|
||||
hostId = vm.getLastHostId();
|
||||
HostVO host = _hostDao.findById(hostId);
|
||||
if (host != null
|
||||
&& host.getHypervisorType() == HypervisorType.VMware) {
|
||||
sendCommand = true;
|
||||
}
|
||||
}
|
||||
|
||||
Answer answer = null;
|
||||
|
||||
if (sendCommand) {
|
||||
|
|
@ -2044,7 +2054,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
|
|||
cmd.set_iScsiName(volume.get_iScsiName());
|
||||
|
||||
try {
|
||||
answer = _agentMgr.send(vm.getHostId(), cmd);
|
||||
answer = _agentMgr.send(hostId, cmd);
|
||||
} catch (Exception e) {
|
||||
throw new CloudRuntimeException(errorMsg + " due to: "
|
||||
+ e.getMessage());
|
||||
|
|
|
|||
|
|
@ -1055,8 +1055,7 @@ public class VirtualMachineMO extends BaseMO {
|
|||
// VirtualDisk, we only perform prefix matching
|
||||
Pair<VirtualDisk, String> deviceInfo = getDiskDevice(vmdkDatastorePath, false);
|
||||
if(deviceInfo == null) {
|
||||
if(s_logger.isTraceEnabled())
|
||||
s_logger.trace("vCenter API trace - detachDisk() done (failed)");
|
||||
s_logger.warn("vCenter API trace - detachDisk() done (failed)");
|
||||
throw new Exception("No such disk device: " + vmdkDatastorePath);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue