SadiJr commented on code in PR #6282:
URL: https://github.com/apache/cloudstack/pull/6282#discussion_r864971542


##########
engine/schema/src/main/java/com/cloud/vm/NicVO.java:
##########
@@ -394,4 +397,14 @@ public String getNsxLogicalSwitchPortUuid() {
     public void setNsxLogicalSwitchPortUuid(String nsxLogicalSwitchPortUuid) {
         this.nsxLogicalSwitchPortUuid = nsxLogicalSwitchPortUuid;
     }
+

Review Comment:
   @weizhouapache 
   
   I'm sorry for the late reply. On line 909 of the VMWareGuru class, the 
remove method of a list object is called, passing a NicVO object as a 
reference. This is done to remove the NIC in question from the list of NICs to 
be removed from the VM (line 919); that is, NICs that are not in the list will 
be kept in the VM. It turns out that the NicVO object doesn't have the equals 
and hashcode methods overridden. Thus, the native method of Java is used, which 
uses the object reference to check if they are the same. With this, even if the 
NICs found in the database are the same discovered in VMware after a restore 
process, ACS will think they are different due to being two different object 
instances (objects of the same class), and will remove them of the VM.
   
   About removed NICs, actually the NIC was not marked as not removed. I fixed 
that and thank you for pointing out this error.
   
   PS: I don't know if I was able to express myself correctly (communication is 
not exactly one of my strong points), let me know if you don't understand 
something.



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