Copilot commented on code in PR #13046:
URL: https://github.com/apache/cloudstack/pull/13046#discussion_r3109255830


##########
server/src/test/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImplTest.java:
##########
@@ -57,6 +57,7 @@
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.framework.config.ConfigKey;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.reservation.dao.ReservationDao;

Review Comment:
   Unused import `org.apache.cloudstack.reservation.dao.ReservationDao` will 
cause compilation to fail. Remove the import, or add the missing `@Mock private 
ReservationDao reservationDao;` (and ensure it’s injected/used) if it was 
intended to be part of the test setup.
   ```suggestion
   
   ```



##########
server/src/main/java/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java:
##########
@@ -764,6 +764,13 @@ public UserVm revertToSnapshot(Long vmSnapshotId) throws 
InsufficientCapacityExc
                             "In order to revert to a Snapshot without memory 
you need to first stop the Instance.");
         }
 
+        if (userVm.getState() == VirtualMachine.State.Running && 
vmSnapshotVo.getType() == VMSnapshot.Type.Disk) {
+            throw new InvalidParameterValueException(
+                    "Reverting to the Instance Snapshot is not allowed for 
running Instances as this would result in an 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.");
+        }
+

Review Comment:
   This condition block is duplicated immediately above (same `Running` state + 
`Disk` snapshot type check and same exception message). Remove the duplicate 
block to avoid redundant/unreachable code and reduce merge-conflict artifacts.
   ```suggestion
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to