Skip to content

Commit 7ea068c

Browse files
kvm: fix error 'Failed to find passphrase for keystore: cloud.jks' when enable SSL for kvm agent (#7923)
1 parent db6dd52 commit 7ea068c

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

agent/src/main/java/com/cloud/agent/properties/AgentProperties.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
*/
1515
package com.cloud.agent.properties;
1616

17+
import org.apache.cloudstack.utils.security.KeyStoreUtils;
18+
1719
/**
1820
* Class of constant agent's properties available to configure on
1921
* "agent.properties".
@@ -728,6 +730,13 @@ public Property<Integer> getWorkers() {
728730
*/
729731
public static final Property<String> CONTROL_CIDR = new Property<>("control.cidr", "169.254.0.0/16");
730732

733+
/**
734+
* Keystore passphrase
735+
* Data type: String.<br>
736+
* Default value: <code>null</code>
737+
*/
738+
public static final Property<String> KEYSTORE_PASSPHRASE = new Property<>(KeyStoreUtils.KS_PASSPHRASE_PROPERTY, null, String.class);
739+
731740
public static class Property <T>{
732741
private String name;
733742
private T defaultValue;

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ public boolean configure(final String name, final Map<String, Object> params) th
10121012
}
10131013
}
10141014

1015-
enableSSLForKvmAgent(params);
1015+
enableSSLForKvmAgent();
10161016
configureLocalStorage();
10171017

10181018
/* Directory to use for Qemu sockets like for the Qemu Guest Agent */
@@ -1319,13 +1319,13 @@ protected void setupMemoryBalloonStatsPeriod(Connect conn) {
13191319
}
13201320
}
13211321

1322-
private void enableSSLForKvmAgent(final Map<String, Object> params) {
1322+
private void enableSSLForKvmAgent() {
13231323
final File keyStoreFile = PropertiesUtil.findConfigFile(KeyStoreUtils.KS_FILENAME);
13241324
if (keyStoreFile == null) {
13251325
s_logger.info("Failed to find keystore file: " + KeyStoreUtils.KS_FILENAME);
13261326
return;
13271327
}
1328-
String keystorePass = (String)params.get(KeyStoreUtils.KS_PASSPHRASE_PROPERTY);
1328+
String keystorePass = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.KEYSTORE_PASSPHRASE);
13291329
if (StringUtils.isBlank(keystorePass)) {
13301330
s_logger.info("Failed to find passphrase for keystore: " + KeyStoreUtils.KS_FILENAME);
13311331
return;

0 commit comments

Comments
 (0)