-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Spring Boot based configuration for the agents
- Loading branch information
Boris Schrijver
committed
May 29, 2018
1 parent
365e3de
commit 8f2ef87
Showing
78 changed files
with
1,562 additions
and
1,211 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/python | ||
|
||
from optparse import OptionParser | ||
|
||
import os | ||
import yaml | ||
|
||
if __name__ == '__main__': | ||
parser = OptionParser() | ||
parser.add_option("-m", "--host", dest="mgt", help="Management server hostname or IP-Address") | ||
parser.add_option("-z", "--zone", dest="zone", help="zone id") | ||
parser.add_option("-p", "--pod", dest="pod", help="pod id") | ||
parser.add_option("-c", "--cluster", dest="cluster", help="cluster id") | ||
parser.add_option("-g", "--guid", dest="guid", help="guid") | ||
|
||
(options, args) = parser.parse_args() | ||
|
||
config = '' | ||
|
||
with open('/etc/cosmic/agent/application.yml', 'r') as f: | ||
config = yaml.load(f) | ||
config['cosmic']['guid'] = options.guid | ||
config['cosmic']['hosts'] = [options.mgt] | ||
config['cosmic']['cluster'] = options.cluster | ||
config['cosmic']['pod'] = options.pod | ||
config['cosmic']['zone'] = options.zone | ||
config['cosmic']['localstorage']['uuid'] = options.guid | ||
|
||
with open('/etc/cosmic/agent/application.yml', 'w') as f: | ||
yaml.dump(config, f, default_flow_style=False) | ||
|
||
os.system("sudo systemctl start cosmic-agent") |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
cosmic-agent/src/main/java/com/cloud/agent/resource/AgentResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.cloud.agent.resource; | ||
|
||
import com.cloud.common.agent.IAgentControl; | ||
import com.cloud.legacymodel.communication.answer.Answer; | ||
import com.cloud.legacymodel.communication.command.Command; | ||
import com.cloud.legacymodel.communication.command.PingCommand; | ||
import com.cloud.legacymodel.communication.command.StartupCommand; | ||
import com.cloud.model.enumeration.HostType; | ||
|
||
import javax.naming.ConfigurationException; | ||
import java.util.Map; | ||
|
||
public interface AgentResource { | ||
String getName(); | ||
|
||
void setName(String name); | ||
|
||
boolean configure(Map<String, Object> params) throws ConfigurationException; | ||
|
||
boolean start(); | ||
|
||
boolean stop(); | ||
|
||
HostType getType(); | ||
|
||
StartupCommand[] initialize(); | ||
|
||
PingCommand getCurrentStatus(long id); | ||
|
||
Answer executeRequest(Command cmd); | ||
|
||
void disconnected(); | ||
|
||
IAgentControl getAgentControl(); | ||
|
||
void setAgentControl(IAgentControl agentControl); | ||
} |
Oops, something went wrong.