vishesh92 commented on code in PR #8624:
URL: https://github.com/apache/cloudstack/pull/8624#discussion_r1609613379


##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -1566,7 +1566,7 @@ public UserVm 
removeNicFromVirtualMachine(RemoveNicFromVMCmd cmd) throws Invalid
         }
 
         // check to see if nic is attached to VM
-        if (nic.getInstanceId() != vmId) {
+        if (nic.getInstanceId() == null || !nic.getInstanceId().equals(vmId)) {

Review Comment:
   ```suggestion
           if (nic.getInstanceId() == null || 
!vmId.equals(nic.getInstanceId())) {
   ```



##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -1637,7 +1637,7 @@ public UserVm 
updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd) th
         Network existingdefaultnet = 
_networkModel.getDefaultNetworkForVm(vmId);
 
         //check to see if nic is attached to VM
-        if (nic.getInstanceId() != vmId) {
+        if (nic.getInstanceId() == null || !nic.getInstanceId().equals(vmId)) {

Review Comment:
   ```suggestion
           if (nic.getInstanceId() == null || 
!vmId.equals(nic.getInstanceId())) {
   ```



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