[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16561712#comment-16561712
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10380:
---------------------------------------------

fmaximus commented on a change in pull request #2743: CLOUDSTACK-10380: Fix 
startvm giving another pw after pw reset
URL: https://github.com/apache/cloudstack/pull/2743#discussion_r206073665
 
 

 ##########
 File path: server/src/com/cloud/network/element/VirtualRouterElement.java
 ##########
 @@ -703,7 +703,14 @@ public boolean savePassword(final Network network, final 
NicProfile nic, final V
         // save the password in DB
         for (final VirtualRouter router : routers) {
             if (router.getState() == State.Running) {
-                return networkTopology.savePasswordToRouter(network, nic, 
uservm, router);
+                final boolean result = 
networkTopology.savePasswordToRouter(network, nic, uservm, router);
+                if (result) {
+                    // Explicit password reset, while VM hasn't generated a 
password yet.
+                    final UserVmVO userVmVO = _userVmDao.findById(vm.getId());
+                    userVmVO.setUpdateParameters(false);
 
 Review comment:
   Context: Basically `updateParameters` means that a new password needs to be 
generated when the VM starts.
   This is set  to `true` when resetPassword is called, while there is no VR 
running.
   Also the default is `true` for a new VM. When the template was not password 
enabled during VM creation, 
   this stays `true`. So if `resetPassword` is executed after making the 
template password enabled, and VR is running,
   we set if to `false`, as we successfully did a password reset, thus no 
password reset needs to happen during start VM.
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> changing passwordenabled to true while guest vm is running causes unexpected 
> passwordreset again in startvm
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-10380
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10380
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>    Affects Versions: 4.12, 4.11.1.0
>            Reporter: Raf Smeets
>            Assignee: Frank Maximus
>            Priority: Major
>
> changing passwordenabled to true while guest vm is running causes 
> passwordreset again in startvm
> Steps to reproduce:
>  # Template passwordenabled flag is set to false
>  # Start Vm
>  # Set template passwordenabled flag to true
>  # StopVm
>  # ResetPassword for Stopped Vm. Password is PasswordA.
>  # StartVm. Password is PasswordB.  This should not happen!!
>  # SSH into VM only works with PasswordB.
> Next steps are as expected.
>  # StopVm
>  # ResetPassword for Stopped Vm. Password is PasswordC.
>  # 1StartVm. No change in password.
>  # SSH into VM works with PasswordC.
> This was found when 
> test/integration/plugins/nuagevsp/test_nuage_passwordreset.py started to fail 
> after merging of PR2651 [https://github.com/apache/cloudstack/pull/2651].



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to