weizhouapache opened a new pull request, #7090:
URL: https://github.com/apache/cloudstack/pull/7090

   
   ### Description
   
   This PR fixes #6716
   
   If a KVM host has been added to cloudstack environment before, then we reset 
agent.properties to original file (./agent/conf/agent.properties), and add the 
host to cloudstack again, we will face the following error:
   
   2023-01-11 20:54:03,734 DEBUG [c.c.h.k.d.LibvirtServerDiscoverer] 
(qtp1647766367-13:ctx-17f9aff7 ctx-47c881cb) (logid:49819f17)  can't setup 
agent, due to com.cloud.utils.exception.CloudRuntimeException: Failed to setup 
keystore on the KVM host: 10.0.32.229 - Failed to setup keystore on the KVM 
host: 10.0.32.229 com.cloud.utils.exception.CloudRuntimeException: Failed to 
setup keystore on the KVM host: 10.0.32.229
           at 
com.cloud.hypervisor.kvm.discoverer.LibvirtServerDiscoverer.setupAgentSecurity(LibvirtServerDiscoverer.java:178)
           at 
com.cloud.hypervisor.kvm.discoverer.LibvirtServerDiscoverer.find(LibvirtServerDiscoverer.java:320)
   
   This is because the libvirtd has been configured to listen on LTS port when 
the host was added to cloudstack before. When try to add host again, cloudstack 
will generate a new keystore passphrase which is not same as before, and wrong 
password for existing keystore.
   
   The issue can be fixed by
   (1) revert libvirtd config to not use TLS
   (2) remove all existing keystore/certificate
   (3) generate new keystore/certificate
   (4) setup agent, etc
   
   <!--- Describe your changes in DETAIL - And how has behaviour functionally 
changed. -->
   
   <!-- For new features, provide link to FS, dev ML discussion etc. -->
   <!-- In case of bug fix, the expected and actual behaviours, steps to 
reproduce. -->
   
   <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be 
closed when this PR gets merged -->
   <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
   <!-- Fixes: # -->
   
   <!--- 
*********************************************************************************
 -->
   <!--- NOTE: AUTOMATATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE 
DOCUMENTATION. -->
   <!--- PLEASE PUT AN 'X' in only **ONE** box -->
   <!--- 
*********************************************************************************
 -->
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [x] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [ ] Minor
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [ ] Trivial
   
   
   ### Screenshots (if appropriate):
   
   
   ### How Has This Been Tested?
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to 
-->
   <!-- see how your change affects other areas of the code, etc. -->
   
   
   <!-- Please read the 
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) 
document -->
   
   - add a host to cloudstack
   - remove it (after put into maintenance, or force remove it)
   - download 
https://github.com/apache/cloudstack/blob/main/agent/conf/agent.properties and 
copy to /etc/cloudstack/agent/agent.properties
   - add host again
   
   prior to this change, it fails with `Failed to setup keystore on the KVM 
host`
   with this change, it succeeds
   


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