glesys related changes for Issue 826

This commit is contained in:
Adrian Cole 2012-02-02 07:32:49 -08:00
parent e759c6a450
commit 9bcbb87604
5 changed files with 6 additions and 6 deletions

View File

@ -103,6 +103,7 @@ public class GleSYSComputeServiceAdapter implements ComputeServiceAdapter<Server
ServerSpec.Builder builder = ServerSpec.builder(); ServerSpec.Builder builder = ServerSpec.builder();
builder.datacenter(template.getLocation().getId()); builder.datacenter(template.getLocation().getId());
builder.templateName(template.getImage().getName());
builder.platform(template.getHardware().getHypervisor()); builder.platform(template.getHardware().getHypervisor());
builder.diskSizeGB(Math.round(template.getHardware().getVolumes().get(0).getSize())); builder.diskSizeGB(Math.round(template.getHardware().getVolumes().get(0).getSize()));
builder.cpuCores((int) template.getHardware().getProcessors().get(0).getCores()); builder.cpuCores((int) template.getHardware().getProcessors().get(0).getCores());

View File

@ -45,10 +45,8 @@ import org.jclouds.glesys.compute.functions.ServerDetailsToNodeMetadata;
import org.jclouds.glesys.compute.options.GleSYSTemplateOptions; import org.jclouds.glesys.compute.options.GleSYSTemplateOptions;
import org.jclouds.glesys.domain.OSTemplate; import org.jclouds.glesys.domain.OSTemplate;
import org.jclouds.glesys.domain.ServerDetails; import org.jclouds.glesys.domain.ServerDetails;
import org.jclouds.location.suppliers.OnlyLocationOrFirstZone;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.Scopes; import com.google.inject.Scopes;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
@ -82,10 +80,10 @@ public class GleSYSComputeServiceContextModule
}).to(DatacenterToLocation.class); }).to(DatacenterToLocation.class);
bind(new TypeLiteral<Function<String, OsFamilyVersion64Bit>>() { bind(new TypeLiteral<Function<String, OsFamilyVersion64Bit>>() {
}).to(ParseOsFamilyVersion64BitFromImageName.class); }).to(ParseOsFamilyVersion64BitFromImageName.class);
bind(new TypeLiteral<Supplier<Location>>() {
}).to(OnlyLocationOrFirstZone.class);
bind(TemplateOptions.class).to(GleSYSTemplateOptions.class); bind(TemplateOptions.class).to(GleSYSTemplateOptions.class);
bind(String.class).annotatedWith(Names.named("PASSWORD")).toProvider(PasswordProvider.class).in(Scopes.SINGLETON); bind(String.class).annotatedWith(Names.named("PASSWORD")).toProvider(PasswordProvider.class).in(Scopes.SINGLETON);
// to have the compute service adapter override default locations
install(new LocationsFromComputeServiceAdapterModule<ServerDetails, Hardware, OSTemplate, String>(){});
} }
// 128MB is perhaps too little ram // 128MB is perhaps too little ram

View File

@ -25,7 +25,7 @@ import javax.inject.Inject;
import org.jclouds.domain.Location; import org.jclouds.domain.Location;
import org.jclouds.domain.LocationBuilder; import org.jclouds.domain.LocationBuilder;
import org.jclouds.domain.LocationScope; import org.jclouds.domain.LocationScope;
import org.jclouds.location.suppliers.JustProvider; import org.jclouds.location.suppliers.all.JustProvider;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;

View File

@ -36,7 +36,7 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", enabled = false, singleThreaded = true) @Test(groups = "live", enabled = true, singleThreaded = true)
public class GleSYSComputeServiceLiveTest extends BaseComputeServiceLiveTest { public class GleSYSComputeServiceLiveTest extends BaseComputeServiceLiveTest {
public GleSYSComputeServiceLiveTest() { public GleSYSComputeServiceLiveTest() {
provider = "glesys"; provider = "glesys";

View File

@ -78,6 +78,7 @@ public class GleSYSTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
@Test @Test
public void testDefaultTemplateBuilder() throws IOException { public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = context.getComputeService().templateBuilder().build(); Template defaultTemplate = context.getComputeService().templateBuilder().build();
assertEquals(defaultTemplate.getImage().getId(), "11.04");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.04"); assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.04");
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);