DaanHoogland commented on code in PR #7588:
URL: https://github.com/apache/cloudstack/pull/7588#discussion_r1221308312
##########
plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java:
##########
@@ -1243,6 +1237,46 @@ public VmwareDatacenterVO
addVmwareDatacenter(AddVmwareDcCmd cmd) throws Resourc
return vmwareDc;
}
+ VmwareDatacenterVO createOrUpdateDc(String guid, String name, String host,
String user, String password) {
+ VmwareDatacenterVO vmwareDc = new VmwareDatacenterVO(guid, name, host,
user, password);
+ // Add DC to database into vmware_data_center table
+ try {
+ vmwareDc = vmwareDcDao.persist(vmwareDc);
+ } catch (EntityExistsException e) {
+ // if that fails just get the record as is
+ vmwareDc = vmwareDcDao.getVmwareDatacenterByGuid(guid);
+ // we could now update:
+// vmwareDc.setPassword(password);
+// vmwareDc.setUser(user);
+// vmwareDc.setVmwareDatacenterName(name);
+// vmwareDc.setVcenterHost(host);
+// vmwareDcDao.update(vmwareDc.getId(), vmwareDc);
+ // but let's assume user error for now
Review Comment:
my point with this comment is that we could regard the new definition as an
update (of more than just the guid)
btw this is not commented out code , but comment written as code. Not sure
if that is a justification ;)
--
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]