Skip to content

Commit 0f9a8bb

Browse files
committed
Merge pull request #175 from fogbow/develop
Integrated with green sitter
2 parents 8daaeca + 771ee46 commit 0f9a8bb

File tree

85 files changed

+3821
-804
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+3821
-804
lines changed

manager.conf.example

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ xmpp_host=127.0.0.1
44
xmpp_port=5347
55

66
rendezvous_jid=rendezvous.test.com
7+
greensitter_jid=greensitter.test.com
78

89
compute_class=org.fogbowcloud.manager.core.plugins.opennebula.OpenNebulaComputePlugin
910
compute_one_url=http://localhost:2633/RPC2
@@ -37,12 +38,24 @@ compute_occi_instance_scheme=http://schemas.openstack.org/compute/instance#
3738
compute_occi_resource_scheme=http://schemas.openstack.org/template/resource#
3839
compute_occi_network_id=ea51ed0c-0e8a-448d-8202-c79777109ffe
3940

41+
# If you are using the EgiImageStoragePlugin
4042
image_storage_class=org.fogbowcloud.manager.core.plugins.egi.EgiImageStoragePlugin
4143
image_storage_egi_base_url=http://lsd.ufcg.edu.br/~user/vm/
4244
image_storage_egi_tmp_storage=/tmp/
45+
46+
# If you are using the EgiApplianceImageStoragePlugin
47+
image_storage_class=org.fogbowcloud.manager.core.plugins.appliance.EgiApplianceImageStoragePlugin
48+
image_storage_appliance_base_url=http://appliance-repo.egi.eu/images
49+
image_storage_appliance_tmp_storage=/tmp/
50+
4351
image_storage_static_fogbow-linux-x86=55d938ef-57d1-44ea-8155-6036d170780a
4452
image_storage_static_fogbow-ubuntu-1204=81765250-a4e4-440d-a215-43c9c0849120
4553

54+
member_picker_class=org.fogbowcloud.manager.core.RoundRobinMemberPicker
55+
#If you are using NoFMemberPicker class
56+
nof_trustworthy=false
57+
58+
4659
compute_class=org.fogbowcloud.manager.core.plugins.openstack.OpenStackNovaV2ComputePlugin
4760
compute_novav2_url=http://localhost:8774
4861
compute_glancev2_url=http://localhost:9292
@@ -72,6 +85,7 @@ token_update_period=300000
7285
instance_monitoring_period=120000
7386
served_request_monitoring_period=120000
7487
garbage_collector_period=240000
88+
asyn_request_waiting_interval=300000
7589

7690
ssh_tunnel_public_host=150.165.80.1
7791
ssh_tunnel_private_host=10.0.0.1
@@ -83,3 +97,9 @@ my_ip=127.0.0.1
8397
http_port=8182
8498

8599
max_whoisalive_manager_count=100
100+
101+
accounting_class=org.fogbowcloud.manager.core.plugins.accounting.FCUAccountingPlugin
102+
accounting_update_period=300000
103+
accounting_datastore_url=jdbc:h2:/tmp/usage
104+
105+
benchmarking_class=org.fogbowcloud.manager.core.plugins.benchmarking.FCUStaticBenchmarkingPlugin

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@
205205
<artifactId>sshj</artifactId>
206206
<version>0.8.1</version>
207207
</dependency>
208+
<dependency>
209+
<groupId>com.h2database</groupId>
210+
<artifactId>h2</artifactId>
211+
<version>1.4.186</version>
212+
</dependency>
213+
208214
</dependencies>
209215

210216
</project>

src/main/java/org/fogbowcloud/manager/Main.java

Lines changed: 72 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@
77
import org.apache.log4j.Logger;
88
import org.fogbowcloud.manager.core.ConfigurationConstants;
99
import org.fogbowcloud.manager.core.DefaultMemberValidator;
10+
import org.fogbowcloud.manager.core.FederationMemberPicker;
1011
import org.fogbowcloud.manager.core.FederationMemberValidator;
1112
import org.fogbowcloud.manager.core.ManagerController;
13+
import org.fogbowcloud.manager.core.RoundRobinMemberPicker;
14+
import org.fogbowcloud.manager.core.plugins.AccountingPlugin;
1215
import org.fogbowcloud.manager.core.plugins.AuthorizationPlugin;
16+
import org.fogbowcloud.manager.core.plugins.BenchmarkingPlugin;
1317
import org.fogbowcloud.manager.core.plugins.ComputePlugin;
1418
import org.fogbowcloud.manager.core.plugins.IdentityPlugin;
1519
import org.fogbowcloud.manager.core.plugins.ImageStoragePlugin;
20+
import org.fogbowcloud.manager.core.plugins.accounting.FCUAccountingPlugin;
21+
import org.fogbowcloud.manager.core.plugins.benchmarking.FCUStaticBenchmarkingPlugin;
1622
import org.fogbowcloud.manager.core.plugins.egi.EgiImageStoragePlugin;
1723
import org.fogbowcloud.manager.occi.OCCIApplication;
1824
import org.fogbowcloud.manager.xmpp.ManagerXmppComponent;
@@ -25,21 +31,22 @@
2531
public class Main {
2632

2733
private static final Logger LOGGER = Logger.getLogger(Main.class);
28-
34+
private static final int EXIT_ERROR_CODE = 128;
35+
2936
public static void main(String[] args) throws Exception {
3037
configureLog4j();
3138

3239
Properties properties = new Properties();
3340
FileInputStream input = new FileInputStream(args[0]);
3441
properties.load(input);
3542

36-
ComputePlugin computePlugin;
43+
ComputePlugin computePlugin = null;
3744
try {
3845
computePlugin = (ComputePlugin) createInstance(
3946
ConfigurationConstants.COMPUTE_CLASS_KEY, properties);
4047
} catch (Exception e) {
4148
LOGGER.warn("Compute Plugin not especified in the properties.", e);
42-
return;
49+
System.exit(EXIT_ERROR_CODE);
4350
}
4451

4552
AuthorizationPlugin authorizationPlugin = null;
@@ -48,7 +55,7 @@ public static void main(String[] args) throws Exception {
4855
ConfigurationConstants.AUTHORIZATION_CLASS_KEY, properties);
4956
} catch (Exception e) {
5057
LOGGER.warn("Authorization Plugin not especified in the properties.", e);
51-
return;
58+
System.exit(EXIT_ERROR_CODE);
5259
}
5360

5461
IdentityPlugin localIdentityPlugin = null;
@@ -57,7 +64,7 @@ public static void main(String[] args) throws Exception {
5764
ConfigurationConstants.LOCAL_PREFIX);
5865
} catch (Exception e) {
5966
LOGGER.warn("Local Identity Plugin not especified in the properties.", e);
60-
return;
67+
System.exit(EXIT_ERROR_CODE);
6168
}
6269

6370
IdentityPlugin federationIdentityPlugin = null;
@@ -66,15 +73,16 @@ public static void main(String[] args) throws Exception {
6673
ConfigurationConstants.FEDERATION_PREFIX);
6774
} catch (Exception e) {
6875
LOGGER.warn("Federation Identity Plugin not especified in the properties.", e);
69-
return;
76+
System.exit(EXIT_ERROR_CODE);
7077
}
7178

72-
FederationMemberValidator validator = new DefaultMemberValidator();
79+
FederationMemberValidator validator = new DefaultMemberValidator(properties);
7380
try {
7481
validator = (FederationMemberValidator) createInstance(
7582
ConfigurationConstants.MEMBER_VALIDATOR_KEY, properties);
7683
} catch (Exception e) {
7784
LOGGER.warn("Member Validator not especified in the properties.");
85+
System.exit(EXIT_ERROR_CODE);
7886
}
7987

8088
if (properties.get(ConfigurationConstants.RENDEZVOUS_JID_KEY) == null
@@ -91,6 +99,34 @@ public static void main(String[] args) throws Exception {
9199
imageStoragePlugin = new EgiImageStoragePlugin(properties, computePlugin);
92100
LOGGER.warn("Image Storage plugin not specified in properties. Using the default one.", e);
93101
}
102+
103+
BenchmarkingPlugin benchmarkingPlugin = null;
104+
try {
105+
benchmarkingPlugin = (BenchmarkingPlugin) createInstance(
106+
ConfigurationConstants.BENCHMARKING_PLUGIN_CLASS_KEY, properties);
107+
} catch (Exception e) {
108+
benchmarkingPlugin = new FCUStaticBenchmarkingPlugin(properties);
109+
LOGGER.warn("Benchmarking plugin not specified in properties. Using the default one.", e);
110+
}
111+
112+
AccountingPlugin accountingPlugin = null;
113+
try {
114+
accountingPlugin = (AccountingPlugin) createInstanceWithBenchmarkingPlugin(
115+
ConfigurationConstants.ACCOUNTING_PLUGIN_CLASS_KEY, properties, benchmarkingPlugin);
116+
} catch (Exception e) {
117+
accountingPlugin = new FCUAccountingPlugin(properties, benchmarkingPlugin);
118+
LOGGER.warn("Accounting plugin not specified in properties. Using the default one.", e);
119+
}
120+
121+
FederationMemberPicker memberPickerPlugin = null;
122+
try {
123+
memberPickerPlugin = (FederationMemberPicker) createInstanceWithAccoutingPlugin(
124+
ConfigurationConstants.MEMBER_PICKER_PLUGIN_CLASS_KEY, properties,
125+
accountingPlugin);
126+
} catch (Exception e) {
127+
memberPickerPlugin = new RoundRobinMemberPicker(properties, accountingPlugin);
128+
LOGGER.warn("Member picker plugin not specified in properties. Using the default one.", e);
129+
}
94130

95131
ManagerController facade = new ManagerController(properties);
96132
facade.setComputePlugin(computePlugin);
@@ -99,7 +135,10 @@ public static void main(String[] args) throws Exception {
99135
facade.setFederationIdentityPlugin(federationIdentityPlugin);
100136
facade.setImageStoragePlugin(imageStoragePlugin);
101137
facade.setValidator(validator);
102-
138+
facade.setBenchmarkingPlugin(benchmarkingPlugin);
139+
facade.setAccountingPlugin(accountingPlugin);
140+
facade.setMemberPickerPlugin(memberPickerPlugin);
141+
103142
ManagerXmppComponent xmpp = new ManagerXmppComponent(
104143
properties.getProperty(ConfigurationConstants.XMPP_JID_KEY),
105144
properties.getProperty(ConfigurationConstants.XMPP_PASS_KEY),
@@ -111,7 +150,7 @@ public static void main(String[] args) throws Exception {
111150
xmpp.connect();
112151
} catch (ComponentException e) {
113152
LOGGER.error("Conflict in the initialization of xmpp component.", e);
114-
return;
153+
System.exit(EXIT_ERROR_CODE);
115154
}
116155
xmpp.process(false);
117156
xmpp.init();
@@ -122,11 +161,16 @@ public static void main(String[] args) throws Exception {
122161
Slf4jLoggerFacade loggerFacade = new Slf4jLoggerFacade();
123162
Engine.getInstance().setLoggerFacade(loggerFacade);
124163

125-
Component http = new Component();
126-
http.getServers().add(Protocol.HTTP,
127-
Integer.parseInt(properties.getProperty(ConfigurationConstants.HTTP_PORT_KEY)));
128-
http.getDefaultHost().attach(application);
129-
http.start();
164+
try {
165+
Component http = new Component();
166+
http.getServers().add(Protocol.HTTP,
167+
Integer.parseInt(properties.getProperty(ConfigurationConstants.HTTP_PORT_KEY)));
168+
http.getDefaultHost().attach(application);
169+
http.start();
170+
} catch (Exception e) {
171+
LOGGER.error("Conflict in the initialization of the HTTP component.", e);
172+
System.exit(EXIT_ERROR_CODE);
173+
}
130174
}
131175

132176
private static Object getIdentityPluginByPrefix(Properties properties, String prefix)
@@ -153,6 +197,20 @@ private static Object createInstanceWithComputePlugin(String propName,
153197
return Class.forName(properties.getProperty(propName)).getConstructor(Properties.class, ComputePlugin.class)
154198
.newInstance(properties, computePlugin);
155199
}
200+
201+
private static Object createInstanceWithBenchmarkingPlugin(
202+
String propName, Properties properties,
203+
BenchmarkingPlugin benchmarkingPlugin) throws Exception {
204+
return Class.forName(properties.getProperty(propName)).getConstructor(Properties.class, BenchmarkingPlugin.class)
205+
.newInstance(properties, benchmarkingPlugin);
206+
}
207+
208+
private static Object createInstanceWithAccoutingPlugin(
209+
String propName, Properties properties,
210+
AccountingPlugin accoutingPlugin) throws Exception {
211+
return Class.forName(properties.getProperty(propName)).getConstructor(Properties.class, AccountingPlugin.class)
212+
.newInstance(properties, accoutingPlugin);
213+
}
156214

157215
private static void configureLog4j() {
158216
ConsoleAppender console = new ConsoleAppender();

src/main/java/org/fogbowcloud/manager/core/CertificateHandlerHelper.java

Lines changed: 0 additions & 114 deletions
This file was deleted.

src/main/java/org/fogbowcloud/manager/core/ConfigurationConstants.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public class ConfigurationConstants {
3535
public static final String TOKEN_UPDATE_PERIOD_KEY = "token_update_period";
3636
public static final String SERVED_REQUEST_MONITORING_PERIOD_KEY = "served_request_monitoring_period";
3737
public static final String GARBAGE_COLLECTOR_PERIOD_KEY = "garbage_collector_period";
38+
public static final String ACCOUNTING_UPDATE_PERIOD_KEY = "accounting_update_period";
39+
public static final String ASYNC_REQUEST_WAITING_INTERVAL_KEY = "asyn_request_waiting_interval";
3840

3941
//ssh properties TODO change these properties names to TOKEN_HOST_...
4042
public static final String SSH_PRIVATE_HOST_KEY = "ssh_tunnel_private_host";
@@ -46,6 +48,7 @@ public class ConfigurationConstants {
4648
public static final String VOMS_PATH_VOMSES = "path_vomses";
4749
public static final String VOMS_PATH_TRUST_ANCHORS = "path_trust_anchors";
4850
public static final String VOMS_PATH_VOMSDIR = "path_vomsdir";
51+
public static final String VOMS_SHOULD_FORWARD_PRIVATE_KEY = "should_forward_private_key";
4952

5053
//x509
5154
public static final String X509_CA_DIR_PATH_KEY = "x509_ca_dir_path";
@@ -54,4 +57,15 @@ public class ConfigurationConstants {
5457
public static final String MAX_WHOISALIVE_MANAGER_COUNT = "max_whoisalive_manager_count";
5558
public static final String IMAGE_STORAGE_PLUGIN_CLASS = "image_storage_class";
5659

60+
//benchmarking
61+
public static final String BENCHMARKING_PLUGIN_CLASS_KEY = "benchmarking_class";
62+
63+
//accounting
64+
public static final String ACCOUNTING_PLUGIN_CLASS_KEY = "accounting_class";
65+
66+
//Green
67+
public static final String GREEN_SITTER_JID = "greensitter_jid";
68+
69+
//member picker
70+
public static final String MEMBER_PICKER_PLUGIN_CLASS_KEY = "member_picker_class";
5771
}

0 commit comments

Comments
 (0)