Skip to content

Commit b2d76ba

Browse files
committed
agent: enable ssl only for kvm agent (not in system vms)
1 parent c1691a9 commit b2d76ba

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

agent/src/main/java/com/cloud/agent/AgentShell.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ public class AgentShell implements IAgentShell, Daemon {
7676
private String connectedHost;
7777
private Long preferredHostCheckInterval;
7878

79+
static final String LIBVIRT_COMPUTING_RESOURCE = "com.cloud.hypervisor.kvm.resource.LibvirtComputingResource";
80+
7981
public AgentShell() {
8082
}
8183

@@ -375,7 +377,7 @@ public void init(String[] args) throws ConfigurationException {
375377

376378
loadProperties();
377379
parseCommand(args);
378-
enableSSL();
380+
enableSSLForKvmAgent();
379381

380382
if (s_logger.isDebugEnabled()) {
381383
List<String> properties = Collections.list((Enumeration<String>)_properties.propertyNames());
@@ -399,12 +401,17 @@ public void init(String[] args) throws ConfigurationException {
399401
_backoff.configure("ConstantTimeBackoff", new HashMap<String, Object>());
400402
}
401403

402-
private void enableSSL() {
404+
private void enableSSLForKvmAgent() {
403405
final File agentFile = PropertiesUtil.findConfigFile("agent.properties");
404406
if (agentFile == null) {
405407
s_logger.info("Failed to find agent.properties file");
406408
return;
407409
}
410+
final String resource = getProperty(null, "resource");
411+
if (!LIBVIRT_COMPUTING_RESOURCE.equalsIgnoreCase(resource)) {
412+
s_logger.info("This is not a cloudstack kvm agent, ignoring");
413+
return;
414+
}
408415
String keystorePass = getProperty(null, "keystore.passphrase");
409416
if (StringUtils.isBlank(keystorePass)) {
410417
s_logger.info("Failed to find passphrase for keystore: " + KeyStoreUtils.KS_FILENAME);

0 commit comments

Comments
 (0)