Issue 397: updated default image to 64bit ubuntu 10.04, noting ecloud, eucalyptus, and gogrid only have working centos images, trmk-vcloudexpress doesn't have 10.4, vcloud doesn't have the ability to natively lookup versions, and amazon linux is preferred on ec2.

This commit is contained in:
Adrian Cole 2010-11-07 01:57:17 +01:00
parent 8849e2793a
commit d94ca19941
15 changed files with 66 additions and 45 deletions

View File

@ -22,7 +22,6 @@ package org.jclouds.aws.ec2.compute.config;
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
import static org.jclouds.compute.domain.OsFamily.AMZN_LINUX;
import static org.jclouds.compute.domain.OsFamily.CENTOS;
import static org.jclouds.compute.domain.OsFamily.UBUNTU;
import java.util.Map;
@ -65,12 +64,12 @@ public class EC2ComputeServiceContextModule extends BaseComputeServiceContextMod
@Override
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
String provider = injector.getInstance(Key.get(String.class, Provider.class));
if ("eucalyptus".equals(provider))
return template.osFamily(CENTOS);
else if ("nova".equals(provider))
return template.osFamily(UBUNTU);
else
if ("ec2".equals(provider))
return template.osFamily(AMZN_LINUX).os64Bit(true);
else if ("nova".equals(provider))
return super.provideTemplate(injector, template);
else
return template.osFamily(CENTOS);
}
@Provides

View File

@ -76,7 +76,7 @@ public abstract class BaseComputeServiceContextModule extends AbstractModule {
@Provides
@Named("DEFAULT")
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
return template.osFamily(UBUNTU);
return template.osFamily(UBUNTU).osVersionMatches("10.04.*").os64Bit(true);
}
/**

View File

@ -120,8 +120,11 @@ public class StubComputeServiceAdapter implements JCloudsNativeComputeServiceAda
new ImageBuilder().providerId("3").name(OsFamily.CENTOS.name()).id(parentId + "/3").location(zone)
.operatingSystem(
new OperatingSystem(OsFamily.CENTOS, "centos 64", null, "X86_64", "centos 64", true))
.description("stub centos 64").defaultCredentials(defaultCredentials).build() //
.description("stub centos 64").defaultCredentials(defaultCredentials).build(), //
new ImageBuilder().providerId("4").name(OsFamily.UBUNTU.name()).id(parentId + "/4").location(zone)
.operatingSystem(
new OperatingSystem(OsFamily.UBUNTU, "ubuntu 10.04 64", "10.04", "X86_64", "ubuntu 10.04 64", true))
.description("stub ubuntu 10.04 64").defaultCredentials(defaultCredentials).build() //
);
}

View File

@ -19,14 +19,9 @@
package org.jclouds.rackspace.cloudservers.compute.config;
import static org.jclouds.compute.domain.OsFamily.UBUNTU;
import org.jclouds.compute.config.BaseComputeServiceContextModule;
import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.internal.BaseComputeService;
import com.google.inject.Injector;
/**
* Configures the {@link CloudServersComputeServiceContext}; requires {@link BaseComputeService}
* bound.
@ -43,8 +38,4 @@ public class CloudServersComputeServiceContextModule extends BaseComputeServiceC
super.configure();
}
@Override
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
return template.osFamily(UBUNTU).imageNameMatches(".*10\\.?04.*");
}
}

View File

@ -52,7 +52,7 @@ public class CloudServersComputeServiceLiveTest extends BaseComputeServiceLiveTe
public void testTemplateBuilder() {
Template defaultTemplate = client.templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "9.10");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getLocation().getId(), "DFW1");
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
@ -66,7 +66,7 @@ public class CloudServersComputeServiceLiveTest extends BaseComputeServiceLiveTe
public void testAssignability() throws Exception {
@SuppressWarnings("unused")
RestContext<CloudServersClient, CloudServersAsyncClient> tmContext = new ComputeServiceContextFactory()
.createContext(provider, identity, credential).getProviderSpecificContext();
.createContext(provider, identity, credential).getProviderSpecificContext();
}
@Override
@ -82,4 +82,21 @@ public class CloudServersComputeServiceLiveTest extends BaseComputeServiceLiveTe
super.testSuspendResume();
}
@Test(enabled = true, dependsOnMethods = "testSuspendResume")
@Override
public void testGetNodesWithDetails() throws Exception {
super.testGetNodesWithDetails();
}
@Test(enabled = true, dependsOnMethods = "testSuspendResume")
@Override
public void testListNodes() throws Exception {
super.testListNodes();
}
@Test(enabled = true, dependsOnMethods = { "testListNodes", "testGetNodesWithDetails" })
@Override
public void testDestroyNodes() {
super.testDestroyNodes();
}
}

View File

@ -19,9 +19,6 @@
package org.jclouds.rimuhosting.miro.compute.config;
import static org.jclouds.compute.domain.OsFamily.UBUNTU;
import org.jclouds.compute.config.BaseComputeServiceContextModule;
import org.jclouds.compute.domain.TemplateBuilder;
@ -45,7 +42,7 @@ public class RimuHostingComputeServiceContextModule extends BaseComputeServiceCo
@Override
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
return template.hardwareId("MIRO1B").osFamily(UBUNTU).os64Bit(false).osVersionMatches("9.10");
return super.provideTemplate(injector, template).hardwareId("MIRO1B");
}
}

View File

@ -48,7 +48,7 @@ public class RimuHostingComputeServiceLiveTest extends BaseComputeServiceLiveTes
public void testTemplateBuilder() {
Template defaultTemplate = client.templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), false);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "9.10");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getLocation().getId(), "DCDALLAS");
assertEquals(defaultTemplate.getHardware().getProviderId(), "MIRO1B");

View File

@ -19,14 +19,11 @@
package org.jclouds.slicehost.compute.config;
import static org.jclouds.compute.domain.OsFamily.UBUNTU;
import java.util.Set;
import javax.inject.Singleton;
import org.jclouds.compute.config.BaseComputeServiceContextModule;
import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.internal.BaseComputeService;
import org.jclouds.domain.Location;
import org.jclouds.domain.LocationScope;
@ -34,7 +31,6 @@ import org.jclouds.domain.internal.LocationImpl;
import org.jclouds.rest.annotations.Provider;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Injector;
import com.google.inject.Provides;
/**
@ -51,11 +47,6 @@ public class SlicehostComputeServiceContextModule extends BaseComputeServiceCont
return new LocationImpl(LocationScope.ZONE, "DFW1", "Dallas, TX", provider);
}
@Override
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
return template.osFamily(UBUNTU).os64Bit(true);
}
@Provides
@Singleton
Set<? extends Location> provideLocations(Location location) {

View File

@ -48,7 +48,7 @@ public class SlicehostComputeServiceLiveTest extends BaseComputeServiceLiveTest
public void testTemplateBuilder() {
Template defaultTemplate = client.templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "9.10");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getLocation().getId(), "DFW1");
assertEquals(getCores(defaultTemplate.getHardware()), 0.25d);

View File

@ -20,6 +20,8 @@
package org.jclouds.vcloud.compute.config;
import static org.jclouds.compute.domain.OsFamily.UBUNTU;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.config.BindComputeStrategiesByClass;
import org.jclouds.compute.config.BindComputeSuppliersByClass;
@ -44,6 +46,7 @@ import org.jclouds.vcloud.domain.Org;
import org.jclouds.vcloud.domain.VApp;
import com.google.common.base.Function;
import com.google.inject.Injector;
import com.google.inject.Scopes;
import com.google.inject.TypeLiteral;
@ -80,6 +83,12 @@ public class VCloudComputeServiceContextModule extends CommonVCloudComputeServic
bind(PopulateDefaultLoginCredentialsForImageStrategy.class).to(GetLoginCredentialsFromGuestConfiguration.class);
}
//CIM ostype does not include version info
@Override
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
return template.osFamily(UBUNTU).os64Bit(true);
}
@Override
public BindComputeStrategiesByClass defineComputeStrategyModule() {
return new VCloudBindComputeStrategiesByClass();

View File

@ -29,7 +29,11 @@ import com.google.inject.Injector;
* @author Adrian Cole
*/
public class TerremarkECloudComputeServiceContextModule extends TerremarkVCloudComputeServiceContextModule {
// as of 6-nov-2010 only centos has ssh key injection in the images.
// ssh key injection in ubuntu is targeted for dec-2010 or sooner
@Override
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
return template.osFamily(CENTOS);
return template.osFamily(CENTOS).os64Bit(true);
}
}

View File

@ -19,6 +19,8 @@
package org.jclouds.vcloud.terremark.compute.config;
import static org.jclouds.compute.domain.OsFamily.UBUNTU;
import java.security.SecureRandom;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@ -30,6 +32,7 @@ import org.jclouds.compute.ComputeService;
import org.jclouds.compute.config.BindComputeStrategiesByClass;
import org.jclouds.compute.config.BindComputeSuppliersByClass;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
@ -46,6 +49,7 @@ import org.jclouds.vcloud.terremark.compute.strategy.ParseVAppTemplateDescriptio
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.inject.Injector;
import com.google.inject.Provides;
import com.google.inject.TypeLiteral;
@ -69,6 +73,12 @@ public class TerremarkVCloudComputeServiceContextModule extends VCloudExpressCom
}
// prefer jeos as the copy time is much shorter
@Override
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
return template.osFamily(UBUNTU).osDescriptionMatches(".*JeOS.*").os64Bit(true);
}
@Override
protected void configure() {
super.configure();
@ -79,7 +89,7 @@ public class TerremarkVCloudComputeServiceContextModule extends VCloudExpressCom
bind(ComputeService.class).to(TerremarkVCloudComputeService.class);
bind(VCloudExpressComputeClient.class).to(TerremarkVCloudComputeClient.class);
bind(PopulateDefaultLoginCredentialsForImageStrategy.class).to(
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials.class);
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials.class);
bind(SecureRandom.class).toInstance(new SecureRandom());
}

View File

@ -90,8 +90,8 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
super.testCatalog();
}
protected String expectedOs = "Ubuntu Linux (32-bit)";
protected String itemName = "Ubuntu JeOS 9.10 (32-bit)";
protected String expectedOs = "Ubuntu Linux (64-bit)";
protected String itemName = "Ubuntu JeOS 9.10 (64-bit)";
protected TerremarkVCloudClient tmClient;
protected Factory sshFactory;
@ -154,8 +154,8 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
long hardDisk = 4194304;
// long hardDisk = 4194304 / 4 * 10;
// String catalogOs = "CentOS 5.3 (32-bit)";
// String expectedOs = "Red Hat Enterprise Linux 5 (32-bit)";
// String catalogOs = "CentOS 5.3 (64-bit)";
// String expectedOs = "Red Hat Enterprise Linux 5 (64-bit)";
// lookup the datacenter you are deploying into
vdc = tmClient.findVDCInOrgNamed(null, null);

View File

@ -59,8 +59,8 @@ public class TerremarkECloudComputeServiceLiveTest extends BaseComputeServiceLiv
public void testTemplateBuilder() {
Template defaultTemplate = client.templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "5.5");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
assert defaultTemplate.getLocation().getDescription() != null;// different per org
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}

View File

@ -99,7 +99,7 @@ public class TerremarkVCloudExpressTemplateBuilderLiveTest {
.<Module> of(new Log4JLoggingModule()), setupProperties());
Template defaultTemplate = newContext.getComputeService().templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), null);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "9.10");
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);