DaanHoogland commented on code in PR #10720:
URL: https://github.com/apache/cloudstack/pull/10720#discussion_r2046203768


##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -3805,11 +3805,18 @@ public UserVm createAdvancedVirtualMachine(DataCenter 
zone, ServiceOffering serv
     @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = 
"deploying Vm")
     public UserVm finalizeCreateVirtualMachine(long vmId) {
         s_logger.info("Loading UserVm " + vmId + " from DB");
-        UserVm userVm = getUserVm(vmId);
+        UserVmVO userVm = _vmDao.findById(vmId);
         if (userVm == null) {
             s_logger.info("Loaded UserVm " + vmId + " (" + userVm.getUuid() + 
") from DB");
         } else {
             s_logger.warn("UserVm " + vmId + " does not exist in DB");
+            VMTemplateVO template = 
_templateDao.findById(userVm.getTemplateId());
+            if (template != null && template.isEnablePassword()) {
+                String password = _mgr.generateRandomPassword();
+                _vmDao.loadDetails(userVm);
+                userVm.setPassword(password);
+                encryptAndStorePassword(userVm, password);
+            }

Review Comment:
   this probably happens somewhere else as well. make a method?



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