mirror of https://github.com/apache/jclouds.git
Issue 610: adjusted vcloud code to match greenhouse settings
This commit is contained in:
parent
75b336b83f
commit
6394370ddf
|
@ -36,7 +36,7 @@ public class GreenHouseDataElementVCloudPropertiesBuilder extends VCloudProperti
|
||||||
Properties properties = super.defaultProperties();
|
Properties properties = super.defaultProperties();
|
||||||
properties.setProperty(PROPERTY_ISO3166_CODES, "US-WY");
|
properties.setProperty(PROPERTY_ISO3166_CODES, "US-WY");
|
||||||
properties.setProperty(PROPERTY_ENDPOINT, "https://mycloud.greenhousedata.com/api");
|
properties.setProperty(PROPERTY_ENDPOINT, "https://mycloud.greenhousedata.com/api");
|
||||||
properties.setProperty(PROPERTY_VCLOUD_DEFAULT_NETWORK, "orgNet-.*-Internal-Routed");
|
properties.setProperty(PROPERTY_VCLOUD_DEFAULT_NETWORK, "orgNet-.*-External");
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,10 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.greenhousedata.element.vcloud.config;
|
package org.jclouds.greenhousedata.element.vcloud.config;
|
||||||
|
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
import org.jclouds.compute.options.TemplateOptions;
|
||||||
import org.jclouds.compute.domain.TemplateBuilder;
|
|
||||||
import org.jclouds.vcloud.compute.config.VCloudComputeServiceContextModule;
|
import org.jclouds.vcloud.compute.config.VCloudComputeServiceContextModule;
|
||||||
|
import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
|
||||||
|
import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
|
||||||
|
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
|
|
||||||
|
@ -31,9 +32,8 @@ import com.google.inject.Injector;
|
||||||
*/
|
*/
|
||||||
public class GreenHouseDataElementVCloudComputeServiceContextModule extends VCloudComputeServiceContextModule {
|
public class GreenHouseDataElementVCloudComputeServiceContextModule extends VCloudComputeServiceContextModule {
|
||||||
|
|
||||||
//CentOS template matches Linux incorrectly
|
|
||||||
@Override
|
@Override
|
||||||
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
|
protected TemplateOptions provideTemplateOptions(Injector injector, TemplateOptions options) {
|
||||||
return template.osFamily(OsFamily.LINUX);
|
return options.as(VCloudTemplateOptions.class).ipAddressAllocationMode(IpAddressAllocationMode.POOL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,14 +18,9 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.greenhousedata.element.vcloud.compute;
|
package org.jclouds.greenhousedata.element.vcloud.compute;
|
||||||
|
|
||||||
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
|
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
|
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.domain.OsFamily;
|
|
||||||
import org.jclouds.compute.domain.Template;
|
import org.jclouds.compute.domain.Template;
|
||||||
import org.jclouds.compute.domain.TemplateBuilder;
|
import org.jclouds.compute.domain.TemplateBuilder;
|
||||||
import org.jclouds.compute.predicates.OperatingSystemPredicates;
|
|
||||||
import org.jclouds.vcloud.compute.VCloudComputeServiceLiveTest;
|
import org.jclouds.vcloud.compute.VCloudComputeServiceLiveTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -47,18 +42,6 @@ public class GreenHouseDataElementVCloudComputeServiceLiveTest extends VCloudCom
|
||||||
group = "director";
|
group = "director";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testTemplateBuilder() {
|
|
||||||
Template defaultTemplate = client.templateBuilder().build();
|
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
|
||||||
assert OperatingSystemPredicates.supportsApt().apply(defaultTemplate.getImage().getOperatingSystem());
|
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getDescription(), "Ubuntu Linux (64-bit)");
|
|
||||||
assert defaultTemplate.getLocation().getId() != null : defaultTemplate.getLocation();
|
|
||||||
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
|
||||||
System.out.println(defaultTemplate.getHardware());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Template buildTemplate(TemplateBuilder templateBuilder) {
|
protected Template buildTemplate(TemplateBuilder templateBuilder) {
|
||||||
Template template = super.buildTemplate(templateBuilder);
|
Template template = super.buildTemplate(templateBuilder);
|
||||||
|
|
|
@ -50,7 +50,12 @@ public class GreenHouseDataElementVCloudTemplateBuilderLiveTest extends BaseTemp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
return true;
|
switch (input.family) {
|
||||||
|
case UBUNTU:
|
||||||
|
return !input.version.equals("") || !input.is64Bit;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -61,8 +66,8 @@ public class GreenHouseDataElementVCloudTemplateBuilderLiveTest extends BaseTemp
|
||||||
Template defaultTemplate = context.getComputeService().templateBuilder().build();
|
Template defaultTemplate = context.getComputeService().templateBuilder().build();
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "");
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "");
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.LINUX);
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||||
assertEquals(getCores(defaultTemplate.getHardware()), 2.0d);
|
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue