You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (userVm.getState() == VirtualMachine.State.Running && vmSnapshotVo.getType() == VMSnapshot.Type.Disk) {
759
758
thrownewInvalidParameterValueException(
760
-
"Reverting to the Instance Snapshot is not allowed for running Instances as this would result in a Instance state change. For running Instances only Snapshots with memory can be reverted. In order to revert to a Snapshot without memory you need to first stop the Instance."
761
-
+ " Snapshot");
759
+
"Reverting to the Instance Snapshot is not allowed for running Instances as this would result in an Instance state change. " +
760
+
"For running Instances only Snapshots with memory can be reverted. " +
761
+
"In order to revert to a Snapshot without memory you need to first stop the Instance.");
762
+
}
763
+
764
+
if ( userVm.getState() == VirtualMachine.State.Stopped && vmSnapshotVo.getType() == VMSnapshot.Type.DiskAndMemory) {
765
+
thrownewInvalidParameterValueException(
766
+
"Reverting to the Instance Snapshot is not allowed for stopped Instances if the Snapshot contains memory. " +
767
+
"In order to revert to a Snapshot with memory you need to first start the Instance.");
762
768
}
763
769
764
770
// if snapshot is not created, error out
@@ -811,20 +817,36 @@ else if (jobResult instanceof Throwable)
811
817
}
812
818
813
819
/**
814
-
* If snapshot was taken with a different service offering than actual used in vm, should change it back to it.
815
-
* We also call <code>changeUserVmServiceOffering</code> in case the service offering is dynamic in order to
816
-
* perform resource limit validation, as the amount of CPUs or memory may have been changed.
817
-
* @param vmSnapshotVo vm snapshot
820
+
* Check if service offering change is needed for user vm when reverting to vm snapshot.
821
+
* Service offering change is needed when snapshot was taken with a different service offering than actual used in vm.
822
+
* Service offering change is also needed when service offering is dynamic and the amount of cpu, memory or cpu speed
823
+
* has been changed since snapshot was taken.
824
+
* @param userVm
825
+
* @param vmSnapshotVo
826
+
* @return true if service offering change is needed; false otherwise
0 commit comments