JoaoJandre commented on code in PR #10493:
URL: https://github.com/apache/cloudstack/pull/10493#discussion_r2036013560


##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -3173,6 +3136,35 @@ public UserVm updateVirtualMachine(long id, String 
displayName, String group, Bo
                     .getUuid(), nic.getId(), extraDhcpOptionsMap);
         }
 
+        boolean isVMware = (vm.getHypervisorType() == HypervisorType.VMware);
+
+        if (securityGroupIdList != null && isVMware) {
+            throw new InvalidParameterValueException("Security group feature 
is not supported for vmWare hypervisor");
+        } else if (securityGroupIdList != null){

Review Comment:
   ```suggestion
           } else if (securityGroupIdList != null) {
   ```



##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -3173,6 +3136,35 @@ public UserVm updateVirtualMachine(long id, String 
displayName, String group, Bo
                     .getUuid(), nic.getId(), extraDhcpOptionsMap);
         }
 
+        boolean isVMware = (vm.getHypervisorType() == HypervisorType.VMware);
+
+        if (securityGroupIdList != null && isVMware) {
+            throw new InvalidParameterValueException("Security group feature 
is not supported for vmWare hypervisor");

Review Comment:
   ```suggestion
               throw new InvalidParameterValueException("Security group feature 
is not supported for VMware hypervisor");
   ```



##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -3188,6 +3180,17 @@ public UserVm updateVirtualMachine(long id, String 
displayName, String group, Bo
         return _vmDao.findById(id);
     }
 
+    private void updateSecurityGroup(UserVmVO vm, List<Long> 
securityGroupIdList) {
+        if (vm.getState() == State.Stopped) {
+            // Remove instance from security groups
+            _securityGroupMgr.removeInstanceFromGroups(vm);
+            // Add instance in provided groups
+            _securityGroupMgr.addInstanceToGroups(vm, securityGroupIdList);
+        } else {
+            throw new InvalidParameterValueException("Virtual machine must be 
stopped prior to update security groups ");

Review Comment:
   We could add the UUID of the VM on the exception.



-- 
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