mirror of https://github.com/apache/cloudstack.git
Merge e12a3f9c00 into bce3e54a7e
This commit is contained in:
commit
7c97c202ea
|
|
@ -135,6 +135,8 @@ public class VMSnapshotManagerImpl extends MutualExclusiveIdsManagerBase impleme
|
||||||
|
|
||||||
public static final String VM_WORK_JOB_HANDLER = VMSnapshotManagerImpl.class.getSimpleName();
|
public static final String VM_WORK_JOB_HANDLER = VMSnapshotManagerImpl.class.getSimpleName();
|
||||||
|
|
||||||
|
private static final String ERROR_STRATEGY_NOT_FOUND = "Can't find Instance Snapshot strategy for instance snapshot";
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
VMInstanceDao _vmInstanceDao;
|
VMInstanceDao _vmInstanceDao;
|
||||||
@Inject ServiceOfferingDetailsDao _serviceOfferingDetailsDao;
|
@Inject ServiceOfferingDetailsDao _serviceOfferingDetailsDao;
|
||||||
|
|
@ -501,7 +503,7 @@ public class VMSnapshotManagerImpl extends MutualExclusiveIdsManagerBase impleme
|
||||||
VMSnapshotStrategy snapshotStrategy = storageStrategyFactory.getVmSnapshotStrategy(vmSnapshot);
|
VMSnapshotStrategy snapshotStrategy = storageStrategyFactory.getVmSnapshotStrategy(vmSnapshot);
|
||||||
|
|
||||||
if (snapshotStrategy == null) {
|
if (snapshotStrategy == null) {
|
||||||
throw new CloudRuntimeException(String.format("Can't find Instance Snapshot strategy for vmsnapshot: %s", vmSnapshot));
|
throw new CloudRuntimeException(String.format("%s: %s", ERROR_STRATEGY_NOT_FOUND, vmSnapshot));
|
||||||
}
|
}
|
||||||
|
|
||||||
return snapshotStrategy;
|
return snapshotStrategy;
|
||||||
|
|
@ -596,6 +598,13 @@ public class VMSnapshotManagerImpl extends MutualExclusiveIdsManagerBase impleme
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String errMsg = String.format("Failed to create Instance Snapshot: [%s] due to: %s", vmSnapshot, e.getMessage());
|
String errMsg = String.format("Failed to create Instance Snapshot: [%s] due to: %s", vmSnapshot, e.getMessage());
|
||||||
logger.debug(errMsg, e);
|
logger.debug(errMsg, e);
|
||||||
|
if (e instanceof CloudRuntimeException) {
|
||||||
|
CloudRuntimeException cre = (CloudRuntimeException)e;
|
||||||
|
if (cre.getMessage().startsWith(ERROR_STRATEGY_NOT_FOUND) && VMSnapshot.State.Error.equals(vmSnapshot.getState())) {
|
||||||
|
logger.debug("No instance snapshot strategy found for {}, remove it from DB", vmSnapshot);
|
||||||
|
_vmSnapshotDao.remove(vmSnapshot.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
throw new CloudRuntimeException(errMsg, e);
|
throw new CloudRuntimeException(errMsg, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue