Merge branch '4.15' into main

This commit is contained in:
nicolas 2021-08-28 09:14:39 -03:00
commit 04738d7775
No known key found for this signature in database
GPG Key ID: 656E1BCC8CB54F84
2 changed files with 4 additions and 3 deletions

View File

@ -1416,7 +1416,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
if (!_snapshotMgr.canOperateOnVolume(volume)) {
throw new InvalidParameterValueException("There are snapshot operations in progress on the volume, unable to delete it");
}
if (volume.getInstanceId() != null && volume.getState() != Volume.State.Expunged) {
if (volume.getInstanceId() != null && _vmInstanceDao.findById(volume.getInstanceId()) != null && volume.getState() != Volume.State.Expunged) {
throw new InvalidParameterValueException("Please specify a volume that is not attached to any VM.");
}
if (volume.getState() == Volume.State.UploadOp) {
@ -1581,6 +1581,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
}
try {
_volsDao.detachVolume(volume.getId());
stateTransitTo(volume, Volume.Event.RecoverRequested);
} catch (NoTransitionException e) {
s_logger.debug("Failed to recover volume" + volume.getId(), e);

View File

@ -340,8 +340,8 @@ public class DiagnosticsServiceImpl extends ManagerBase implements PluggableServ
File dataDirectory = new File(dataDirectoryInSecondaryStore);
boolean existsInSecondaryStore = dataDirectory.exists() || dataDirectory.mkdir();
if (existsInSecondaryStore) {
// scp from system VM to mounted sec storage directory
File permKey = new File("/var/cloudstack/management/.ssh/id_rsa");
String homeDir = System.getProperty("user.home");
File permKey = new File(homeDir + "/.ssh/id_rsa");
SshHelper.scpFrom(vmSshIp, 3922, "root", permKey, dataDirectoryInSecondaryStore, diagnosticsFile);
}