GutoVeronezi commented on code in PR #6282:
URL: https://github.com/apache/cloudstack/pull/6282#discussion_r870587349
##########
plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/guru/VMwareGuru.java:
##########
@@ -768,7 +768,7 @@ private void syncVMVolumes(VMInstanceVO vmInstanceVO,
List<VirtualDisk> virtualD
volume = createVolume(disk, vmToImport, domainId, zoneId,
accountId, instanceId, poolId, templateId, backup, true);
operation = "created";
}
- s_logger.debug(String.format("VM [id: %s, instanceName: %s] backup
restore operation %s volume [id: %s].", instanceId,
vmInstanceVO.getInstanceName(),
+ s_logger.debug(String.format("Sync volumes to VM [id: %s,
instanceName: %s] in backup restore operation: %s volume [id: %s].",
instanceId, vmInstanceVO.getInstanceName(),
Review Comment:
We could use `ReflectionToStringBuilderUtils` to print the VM info, printing
the UUID and the `hostName`, which is the name defined by the user.
##########
plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/guru/VMwareGuru.java:
##########
@@ -897,12 +902,20 @@ private void syncVMNics(VirtualDevice[] nicDevices,
DatacenterMO dcMo, Map<Strin
String macAddress = pair.first();
String networkName = pair.second();
NetworkVO networkVO = networksMapping.get(networkName);
- NicVO nicVO =
_nicDao.findByNetworkIdAndMacAddress(networkVO.getId(), macAddress);
+ NicVO nicVO =
_nicDao.findByNetworkIdAndMacAddressIncludingRemoved(networkVO.getId(),
macAddress);
if (nicVO != null) {
+ s_logger.warn(String.format("Find NIC in DB with networkId
[%s] and MAC Address [%s], so this NIC will be removed from list of unmapped
NICs of VM [id: %s, name: %s].",
+ networkVO.getId(), macAddress, vm.getUuid(),
vm.getInstanceName()));
allNics.remove(nicVO);
+
+ if (nicVO.getRemoved() != null) {
+ _nicDao.unremove(nicVO.getId());
+ }
}
}
for (final NicVO unMappedNic : allNics) {
+ s_logger.debug(String.format("Removing NIC [id: %s, MAC: %s] from
backup restored VM [id: %s, name: %s].",
+ unMappedNic.getUuid(), unMappedNic.getMacAddress(),
vm.getUuid(), vm.getInstanceName()));
Review Comment:
We could use `ReflectionToStringBuilderUtils` here.
--
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]