mirror of https://github.com/apache/jclouds.git
updates to fix elastichosts and cloudsigma support
This commit is contained in:
parent
ade9fa6119
commit
89e7fd6092
|
@ -39,6 +39,7 @@ import org.jclouds.elasticstack.domain.DriveInfo;
|
||||||
import org.jclouds.elasticstack.domain.ImageConversionType;
|
import org.jclouds.elasticstack.domain.ImageConversionType;
|
||||||
import org.jclouds.elasticstack.domain.Server;
|
import org.jclouds.elasticstack.domain.Server;
|
||||||
import org.jclouds.elasticstack.domain.ServerInfo;
|
import org.jclouds.elasticstack.domain.ServerInfo;
|
||||||
|
import org.jclouds.elasticstack.domain.ServerStatus;
|
||||||
import org.jclouds.elasticstack.domain.WellKnownImage;
|
import org.jclouds.elasticstack.domain.WellKnownImage;
|
||||||
import org.jclouds.elasticstack.reference.ElasticStackConstants;
|
import org.jclouds.elasticstack.reference.ElasticStackConstants;
|
||||||
import org.jclouds.location.Provider;
|
import org.jclouds.location.Provider;
|
||||||
|
@ -57,7 +58,7 @@ import com.google.common.collect.ImmutableSet.Builder;
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ElasticStackComputeServiceAdapter implements
|
public class ElasticStackComputeServiceAdapter implements
|
||||||
ComputeServiceAdapter<ServerInfo, Hardware, DriveInfo, Location> {
|
ComputeServiceAdapter<ServerInfo, Hardware, DriveInfo, Location> {
|
||||||
private final ElasticStackClient client;
|
private final ElasticStackClient client;
|
||||||
private final ElasticStackAsyncClient aclient;
|
private final ElasticStackAsyncClient aclient;
|
||||||
private final Predicate<DriveInfo> driveNotClaimed;
|
private final Predicate<DriveInfo> driveNotClaimed;
|
||||||
|
@ -74,10 +75,10 @@ public class ElasticStackComputeServiceAdapter implements
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ElasticStackComputeServiceAdapter(ElasticStackClient client, ElasticStackAsyncClient aclient,
|
public ElasticStackComputeServiceAdapter(ElasticStackClient client, ElasticStackAsyncClient aclient,
|
||||||
Predicate<DriveInfo> driveNotClaimed, @Provider String providerName, @Provider URI providerURI,
|
Predicate<DriveInfo> driveNotClaimed, @Provider String providerName, @Provider URI providerURI,
|
||||||
Map<String, WellKnownImage> preinstalledImages, Map<String, DriveInfo> cache,
|
Map<String, WellKnownImage> preinstalledImages, Map<String, DriveInfo> cache,
|
||||||
@Named(ElasticStackConstants.PROPERTY_VNC_PASSWORD) String defaultVncPassword,
|
@Named(ElasticStackConstants.PROPERTY_VNC_PASSWORD) String defaultVncPassword,
|
||||||
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
|
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
|
||||||
this.client = checkNotNull(client, "client");
|
this.client = checkNotNull(client, "client");
|
||||||
this.aclient = checkNotNull(aclient, "aclient");
|
this.aclient = checkNotNull(aclient, "aclient");
|
||||||
this.driveNotClaimed = checkNotNull(driveNotClaimed, "driveNotClaimed");
|
this.driveNotClaimed = checkNotNull(driveNotClaimed, "driveNotClaimed");
|
||||||
|
@ -91,11 +92,11 @@ public class ElasticStackComputeServiceAdapter implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServerInfo runNodeWithTagAndNameAndStoreCredentials(String tag, String name, Template template,
|
public ServerInfo runNodeWithTagAndNameAndStoreCredentials(String tag, String name, Template template,
|
||||||
Map<String, Credentials> credentialStore) {
|
Map<String, Credentials> credentialStore) {
|
||||||
long bootSize = (long) (template.getHardware().getVolumes().get(0).getSize() * 1024 * 1024 * 1024l);
|
long bootSize = (long) (template.getHardware().getVolumes().get(0).getSize() * 1024 * 1024 * 1024l);
|
||||||
logger.debug(">> creating boot drive bytes(%d)", bootSize);
|
logger.debug(">> creating boot drive bytes(%d)", bootSize);
|
||||||
DriveInfo drive = client.createDrive(new Drive.Builder().name(template.getImage().getName()).size(bootSize)
|
DriveInfo drive = client.createDrive(new Drive.Builder().name(template.getImage().getName()).size(bootSize)
|
||||||
.build());
|
.build());
|
||||||
logger.debug("<< drive(%s)", drive.getUuid());
|
logger.debug("<< drive(%s)", drive.getUuid());
|
||||||
|
|
||||||
logger.debug(">> imaging boot drive source(%s)", template.getImage().getId());
|
logger.debug(">> imaging boot drive source(%s)", template.getImage().getId());
|
||||||
|
@ -106,12 +107,13 @@ public class ElasticStackComputeServiceAdapter implements
|
||||||
client.destroyDrive(drive.getUuid());
|
client.destroyDrive(drive.getUuid());
|
||||||
throw new IllegalStateException("could not image drive in time!");
|
throw new IllegalStateException("could not image drive in time!");
|
||||||
}
|
}
|
||||||
Server toCreate = small(name, drive.getUuid(), defaultVncPassword).mem(template.getHardware().getRam())
|
Server toCreate = small(name, drive.getUuid(), defaultVncPassword).mem(template.getHardware().getRam()).cpu(
|
||||||
.cpu((int) (template.getHardware().getProcessors().get(0).getSpeed())).build();
|
(int) (template.getHardware().getProcessors().get(0).getSpeed())).build();
|
||||||
|
|
||||||
ServerInfo from = client.createAndStartServer(toCreate);
|
ServerInfo from = client.createAndStartServer(toCreate);
|
||||||
// store the credentials so that later functions can use them
|
// store the credentials so that later functions can use them
|
||||||
credentialStore.put(from.getUuid() + "", new Credentials("toor", from.getVnc().getPassword()));
|
credentialStore.put(from.getUuid() + "", new Credentials(template.getImage().getDefaultCredentials().identity,
|
||||||
|
from.getVnc().getPassword()));
|
||||||
return from;
|
return from;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,8 +137,8 @@ public class ElasticStackComputeServiceAdapter implements
|
||||||
return "sizeLessThanOrEqual(" + size + ")";
|
return "sizeLessThanOrEqual(" + size + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
}).ids(id).ram(ram).processors(ImmutableList.of(new Processor(1, cpu)))
|
}).ids(id).ram(ram).processors(ImmutableList.of(new Processor(1, cpu))).volumes(
|
||||||
.volumes(ImmutableList.<Volume> of(new VolumeImpl(size, true, true))).build());
|
ImmutableList.<Volume> of(new VolumeImpl(size, true, true))).build());
|
||||||
}
|
}
|
||||||
return hardware.build();
|
return hardware.build();
|
||||||
}
|
}
|
||||||
|
@ -147,14 +149,14 @@ public class ElasticStackComputeServiceAdapter implements
|
||||||
@Override
|
@Override
|
||||||
public Iterable<DriveInfo> listImages() {
|
public Iterable<DriveInfo> listImages() {
|
||||||
Iterable<DriveInfo> drives = transformParallel(preinstalledImages.keySet(),
|
Iterable<DriveInfo> drives = transformParallel(preinstalledImages.keySet(),
|
||||||
new Function<String, Future<DriveInfo>>() {
|
new Function<String, Future<DriveInfo>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Future<DriveInfo> apply(String input) {
|
public Future<DriveInfo> apply(String input) {
|
||||||
return aclient.getDriveInfo(input);
|
return aclient.getDriveInfo(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, executor, null, logger, "drives");
|
}, executor, null, logger, "drives");
|
||||||
Iterable<DriveInfo> returnVal = filter(drives, notNull());
|
Iterable<DriveInfo> returnVal = filter(drives, notNull());
|
||||||
for (DriveInfo drive : returnVal)
|
for (DriveInfo drive : returnVal)
|
||||||
cache.put(drive.getUuid(), drive);
|
cache.put(drive.getUuid(), drive);
|
||||||
|
@ -170,7 +172,7 @@ public class ElasticStackComputeServiceAdapter implements
|
||||||
@Override
|
@Override
|
||||||
public Iterable<Location> listLocations() {
|
public Iterable<Location> listLocations() {
|
||||||
return ImmutableSet.<Location> of(new LocationImpl(LocationScope.PROVIDER, providerName, providerURI
|
return ImmutableSet.<Location> of(new LocationImpl(LocationScope.PROVIDER, providerName, providerURI
|
||||||
.toASCIIString(), null));
|
.toASCIIString(), null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -182,6 +184,8 @@ public class ElasticStackComputeServiceAdapter implements
|
||||||
public void destroyNode(String id) {
|
public void destroyNode(String id) {
|
||||||
ServerInfo server = getNode(id);
|
ServerInfo server = getNode(id);
|
||||||
if (server != null) {
|
if (server != null) {
|
||||||
|
if (server.getStatus() != ServerStatus.STOPPED)
|
||||||
|
client.stopServer(id);
|
||||||
client.destroyServer(id);
|
client.destroyServer(id);
|
||||||
for (Device dev : server.getDevices().values())
|
for (Device dev : server.getDevices().values())
|
||||||
client.destroyDrive(dev.getDriveUuid());
|
client.destroyDrive(dev.getDriveUuid());
|
||||||
|
|
|
@ -68,14 +68,14 @@ import com.google.inject.TypeLiteral;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class ElasticStackComputeServiceContextModule
|
public class ElasticStackComputeServiceContextModule
|
||||||
extends
|
extends
|
||||||
ComputeServiceAdapterContextModule<ElasticStackClient, ElasticStackAsyncClient, ServerInfo, Hardware, DriveInfo, Location> {
|
ComputeServiceAdapterContextModule<ElasticStackClient, ElasticStackAsyncClient, ServerInfo, Hardware, DriveInfo, Location> {
|
||||||
|
|
||||||
public ElasticStackComputeServiceContextModule() {
|
public ElasticStackComputeServiceContextModule() {
|
||||||
super(ElasticStackClient.class, ElasticStackAsyncClient.class);
|
super(ElasticStackClient.class, ElasticStackAsyncClient.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings( { "unchecked", "rawtypes" })
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
super.configure();
|
super.configure();
|
||||||
|
@ -123,10 +123,9 @@ public class ElasticStackComputeServiceContextModule
|
||||||
@Singleton
|
@Singleton
|
||||||
@Provides
|
@Provides
|
||||||
protected Map<String, WellKnownImage> provideImages(Json json, @Provider String providerName) throws IOException {
|
protected Map<String, WellKnownImage> provideImages(Json json, @Provider String providerName) throws IOException {
|
||||||
List<WellKnownImage> wellKnowns = json.fromJson(
|
List<WellKnownImage> wellKnowns = json.fromJson(Strings2.toStringAndClose(getClass().getResourceAsStream(
|
||||||
Strings2.toStringAndClose(getClass().getResourceAsStream("/"+providerName+"/preinstalled_images.json")),
|
"/" + providerName + "/preinstalled_images.json")), new TypeLiteral<List<WellKnownImage>>() {
|
||||||
new TypeLiteral<List<WellKnownImage>>() {
|
}.getType());
|
||||||
}.getType());
|
|
||||||
return Maps.uniqueIndex(wellKnowns, new Function<WellKnownImage, String>() {
|
return Maps.uniqueIndex(wellKnowns, new Function<WellKnownImage, String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -140,8 +139,8 @@ public class ElasticStackComputeServiceContextModule
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Predicate<DriveInfo> supplyDriveUnclaimed(DriveClaimed driveClaimed,
|
protected Predicate<DriveInfo> supplyDriveUnclaimed(DriveClaimed driveClaimed,
|
||||||
ComputeServiceConstants.Timeouts timeouts) {
|
ComputeServiceConstants.Timeouts timeouts) {
|
||||||
return new RetryablePredicate<DriveInfo>(Predicates.not(driveClaimed), timeouts.nodeRunning, 1000,
|
return new RetryablePredicate<DriveInfo>(Predicates.not(driveClaimed), timeouts.nodeRunning, 1000,
|
||||||
TimeUnit.MILLISECONDS);
|
TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -53,18 +53,13 @@ public class WellKnownImageToImage implements Function<DriveInfo, Image> {
|
||||||
@Override
|
@Override
|
||||||
public Image apply(DriveInfo drive) {
|
public Image apply(DriveInfo drive) {
|
||||||
WellKnownImage input = preinstalledImages.get(drive.getUuid());
|
WellKnownImage input = preinstalledImages.get(drive.getUuid());
|
||||||
return new ImageBuilder()
|
return new ImageBuilder().ids(drive.getUuid()).userMetadata(
|
||||||
.ids(drive.getUuid())
|
ImmutableMap.<String, String> builder().putAll(drive.getUserMetadata())
|
||||||
.userMetadata(
|
.put("size", input.getSize() + "").build()).defaultCredentials(
|
||||||
ImmutableMap.<String, String> builder().putAll(drive.getUserMetadata())
|
new Credentials(input.getLoginUser(), null)).location(locationSupplier.get()).name(
|
||||||
.put("size", input.getSize() + "").build())
|
input.getDescription()).description(drive.getName()).operatingSystem(
|
||||||
.defaultCredentials(new Credentials("toor", null))
|
new OperatingSystemBuilder().family(input.getOsFamily()).version(input.getOsVersion()).name(
|
||||||
.location(locationSupplier.get())
|
input.getDescription()).description(drive.getName()).is64Bit(input.is64bit()).build()).version(
|
||||||
.name(input.getDescription())
|
"").build();
|
||||||
.description(drive.getName())
|
|
||||||
.operatingSystem(
|
|
||||||
new OperatingSystemBuilder().family(input.getOsFamily()).version(input.getOsVersion())
|
|
||||||
.name(input.getDescription()).description(drive.getName()).is64Bit(input.is64bit()).build()).version("")
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -28,6 +28,7 @@ import com.google.common.base.Objects;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class WellKnownImage {
|
public class WellKnownImage {
|
||||||
|
private String loginUser = "toor";
|
||||||
private String uuid;
|
private String uuid;
|
||||||
private String description;
|
private String description;
|
||||||
private OsFamily osFamily;
|
private OsFamily osFamily;
|
||||||
|
@ -66,9 +67,13 @@ public class WellKnownImage {
|
||||||
return is64bit;
|
return is64bit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLoginUser() {
|
||||||
|
return loginUser;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(uuid, description, osFamily, osVersion, size, is64bit);
|
return Objects.hashCode(uuid, description, osFamily, osVersion, size, is64bit, loginUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -81,7 +86,8 @@ public class WellKnownImage {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Objects.toStringHelper(this).add("uuid", uuid).add("description", description).add("osFamily", osFamily)
|
return Objects.toStringHelper(this).add("uuid", uuid).add("description", description).add("osFamily", osFamily)
|
||||||
.add("osVersion", osVersion).add("size", size).add("is64bit", is64bit).toString();
|
.add("osVersion", osVersion).add("size", size).add("is64bit", is64bit).add("loginUser", loginUser)
|
||||||
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -45,9 +45,11 @@ public class ListOfKeyValuesDelimitedByBlankLinesToListOfMaps implements Functio
|
||||||
for (String keyValueLine : Splitter.on('\n').split(listOfKeyValues)) {
|
for (String keyValueLine : Splitter.on('\n').split(listOfKeyValues)) {
|
||||||
if (!"".equals(keyValueLine)) {
|
if (!"".equals(keyValueLine)) {
|
||||||
int firstIndex = keyValueLine.indexOf(' ');
|
int firstIndex = keyValueLine.indexOf(' ');
|
||||||
String key = keyValueLine.substring(0, firstIndex);
|
if (firstIndex != -1) {
|
||||||
String value = keyValueLine.substring(firstIndex + 1).replace("\\n", "\n");
|
String key = keyValueLine.substring(0, firstIndex);
|
||||||
map.put(key, value);
|
String value = keyValueLine.substring(firstIndex + 1).replace("\\n", "\n");
|
||||||
|
map.put(key, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (map.size() != 0)
|
if (map.size() != 0)
|
||||||
|
|
|
@ -22,12 +22,14 @@ package org.jclouds.elasticstack.functions;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.elasticstack.domain.ClaimType;
|
import org.jclouds.elasticstack.domain.ClaimType;
|
||||||
import org.jclouds.elasticstack.domain.DriveInfo;
|
import org.jclouds.elasticstack.domain.DriveInfo;
|
||||||
import org.jclouds.elasticstack.domain.DriveMetrics;
|
import org.jclouds.elasticstack.domain.DriveMetrics;
|
||||||
import org.jclouds.elasticstack.domain.DriveStatus;
|
import org.jclouds.elasticstack.domain.DriveStatus;
|
||||||
|
import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
|
@ -39,6 +41,10 @@ import com.google.common.collect.Maps;
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class MapToDriveInfo implements Function<Map<String, String>, DriveInfo> {
|
public class MapToDriveInfo implements Function<Map<String, String>, DriveInfo> {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DriveInfo apply(Map<String, String> from) {
|
public DriveInfo apply(Map<String, String> from) {
|
||||||
if (from.size() == 0)
|
if (from.size() == 0)
|
||||||
|
@ -67,7 +73,12 @@ public class MapToDriveInfo implements Function<Map<String, String>, DriveInfo>
|
||||||
metadata.put(entry.getKey().substring(entry.getKey().indexOf(':') + 1), entry.getValue());
|
metadata.put(entry.getKey().substring(entry.getKey().indexOf(':') + 1), entry.getValue());
|
||||||
}
|
}
|
||||||
builder.userMetadata(metadata);
|
builder.userMetadata(metadata);
|
||||||
return builder.build();
|
try {
|
||||||
|
return builder.build();
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.trace("entry missing data: %s; %s", e.getMessage(), from);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DriveMetrics buildMetrics(Map<String, String> from) {
|
protected DriveMetrics buildMetrics(Map<String, String> from) {
|
||||||
|
|
|
@ -81,6 +81,7 @@ public class ElasticStackClientLiveTest {
|
||||||
protected ElasticStackClient client;
|
protected ElasticStackClient client;
|
||||||
protected RestContext<ElasticStackClient, ElasticStackAsyncClient> context;
|
protected RestContext<ElasticStackClient, ElasticStackAsyncClient> context;
|
||||||
protected Predicate<IPSocket> socketTester;
|
protected Predicate<IPSocket> socketTester;
|
||||||
|
protected String bootDrive = "38df0986-4d85-4b76-b502-3878ffc80161";
|
||||||
|
|
||||||
protected String provider = "elasticstack";
|
protected String provider = "elasticstack";
|
||||||
protected String identity;
|
protected String identity;
|
||||||
|
@ -115,13 +116,13 @@ public class ElasticStackClientLiveTest {
|
||||||
setupCredentials();
|
setupCredentials();
|
||||||
Properties overrides = setupProperties();
|
Properties overrides = setupProperties();
|
||||||
context = new ComputeServiceContextFactory().createContext(provider,
|
context = new ComputeServiceContextFactory().createContext(provider,
|
||||||
ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).getProviderSpecificContext();
|
ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).getProviderSpecificContext();
|
||||||
|
|
||||||
client = context.getApi();
|
client = context.getApi();
|
||||||
driveNotClaimed = new RetryablePredicate<DriveInfo>(Predicates.not(new DriveClaimed(client)), maxDriveImageTime,
|
driveNotClaimed = new RetryablePredicate<DriveInfo>(Predicates.not(new DriveClaimed(client)), maxDriveImageTime,
|
||||||
1, TimeUnit.SECONDS);
|
1, TimeUnit.SECONDS);
|
||||||
socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), maxDriveImageTime, 1,
|
socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), maxDriveImageTime, 1,
|
||||||
TimeUnit.SECONDS);
|
TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -198,12 +199,10 @@ public class ElasticStackClientLiveTest {
|
||||||
@Test(dependsOnMethods = "testCreateDrive")
|
@Test(dependsOnMethods = "testCreateDrive")
|
||||||
public void testSetDriveData() throws Exception {
|
public void testSetDriveData() throws Exception {
|
||||||
|
|
||||||
DriveInfo drive2 = client.setDriveData(
|
DriveInfo drive2 = client.setDriveData(drive.getUuid(), new DriveData.Builder().claimType(ClaimType.SHARED).name(
|
||||||
drive.getUuid(),
|
"rediculous").readers(ImmutableSet.of("ffffffff-ffff-ffff-ffff-ffffffffffff")).tags(
|
||||||
new DriveData.Builder().claimType(ClaimType.SHARED).name("rediculous")
|
ImmutableSet.of("networking", "security", "gateway")).userMetadata(ImmutableMap.of("foo", "bar"))
|
||||||
.readers(ImmutableSet.of("ffffffff-ffff-ffff-ffff-ffffffffffff"))
|
.build());
|
||||||
.tags(ImmutableSet.of("networking", "security", "gateway"))
|
|
||||||
.userMetadata(ImmutableMap.of("foo", "bar")).build());
|
|
||||||
|
|
||||||
assertNotNull(drive2.getUuid(), drive.getUuid());
|
assertNotNull(drive2.getUuid(), drive.getUuid());
|
||||||
assertEquals(drive2.getName(), "rediculous");
|
assertEquals(drive2.getName(), "rediculous");
|
||||||
|
@ -244,8 +243,8 @@ public class ElasticStackClientLiveTest {
|
||||||
assertNotNull(server.getUser());
|
assertNotNull(server.getUser());
|
||||||
assertEquals(server.getName(), prefix);
|
assertEquals(server.getName(), prefix);
|
||||||
assertEquals(server.isPersistent(), true);
|
assertEquals(server.isPersistent(), true);
|
||||||
assertEquals(server.getDevices(),
|
assertEquals(server.getDevices(), ImmutableMap.of("ide:0:0", new IDEDevice.Builder(0, 0).uuid(drive.getUuid())
|
||||||
ImmutableMap.of("ide:0:0", new IDEDevice.Builder(0, 0).uuid(drive.getUuid()).build()));
|
.build()));
|
||||||
assertEquals(server.getBootDeviceIds(), ImmutableSet.of("ide:0:0"));
|
assertEquals(server.getBootDeviceIds(), ImmutableSet.of("ide:0:0"));
|
||||||
assertEquals(server.getNics().get(0).getDhcp(), server.getVnc().getIp());
|
assertEquals(server.getNics().get(0).getDhcp(), server.getVnc().getIp());
|
||||||
assertEquals(server.getNics().get(0).getModel(), Model.E1000);
|
assertEquals(server.getNics().get(0).getModel(), Model.E1000);
|
||||||
|
@ -254,10 +253,12 @@ public class ElasticStackClientLiveTest {
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateAndStartServer")
|
@Test(dependsOnMethods = "testCreateAndStartServer")
|
||||||
public void testConnectivity() throws Exception {
|
public void testConnectivity() throws Exception {
|
||||||
Logger.getAnonymousLogger().info("awaiting vnc");
|
IPSocket vncsocket = new IPSocket(server.getVnc().getIp(), 5900);
|
||||||
assert socketTester.apply(new IPSocket(server.getVnc().getIp(), 5900)) : server;
|
Logger.getAnonymousLogger().info("awaiting vnc: " + vncsocket);
|
||||||
Logger.getAnonymousLogger().info("awaiting ssh");
|
assert socketTester.apply(vncsocket) : server;
|
||||||
assert socketTester.apply(new IPSocket(server.getNics().get(0).getDhcp(), 22)) : server;
|
IPSocket sshsocket = new IPSocket(server.getNics().get(0).getDhcp(), 22);
|
||||||
|
Logger.getAnonymousLogger().info("awaiting ssh: " + sshsocket);
|
||||||
|
assert socketTester.apply(sshsocket) : server;
|
||||||
doConnectViaSsh(server, getSshCredentials(server));
|
doConnectViaSsh(server, getSshCredentials(server));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +277,7 @@ public class ElasticStackClientLiveTest {
|
||||||
// behavior on shutdown depends on how your server OS is set up to respond to an ACPI power
|
// behavior on shutdown depends on how your server OS is set up to respond to an ACPI power
|
||||||
// button signal
|
// button signal
|
||||||
assert (client.getServerInfo(server.getUuid()).getStatus() == ServerStatus.ACTIVE || client.getServerInfo(
|
assert (client.getServerInfo(server.getUuid()).getStatus() == ServerStatus.ACTIVE || client.getServerInfo(
|
||||||
server.getUuid()).getStatus() == ServerStatus.STOPPED);
|
server.getUuid()).getStatus() == ServerStatus.STOPPED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testLifeCycle")
|
@Test(dependsOnMethods = "testLifeCycle")
|
||||||
|
@ -284,11 +285,9 @@ public class ElasticStackClientLiveTest {
|
||||||
client.stopServer(server.getUuid());
|
client.stopServer(server.getUuid());
|
||||||
assertEquals(client.getServerInfo(server.getUuid()).getStatus(), ServerStatus.STOPPED);
|
assertEquals(client.getServerInfo(server.getUuid()).getStatus(), ServerStatus.STOPPED);
|
||||||
|
|
||||||
ServerInfo server2 = client.setServerConfiguration(
|
ServerInfo server2 = client.setServerConfiguration(server.getUuid(), Server.Builder.fromServer(server).name(
|
||||||
server.getUuid(),
|
"rediculous").tags(ImmutableSet.of("networking", "security", "gateway")).userMetadata(
|
||||||
Server.Builder.fromServer(server).name("rediculous")
|
ImmutableMap.of("foo", "bar")).build());
|
||||||
.tags(ImmutableSet.of("networking", "security", "gateway"))
|
|
||||||
.userMetadata(ImmutableMap.of("foo", "bar")).build());
|
|
||||||
|
|
||||||
assertNotNull(server2.getUuid(), server.getUuid());
|
assertNotNull(server2.getUuid(), server.getUuid());
|
||||||
assertEquals(server2.getName(), "rediculous");
|
assertEquals(server2.getName(), "rediculous");
|
||||||
|
@ -314,8 +313,8 @@ public class ElasticStackClientLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doConnectViaSsh(Server server, Credentials creds) throws IOException {
|
protected void doConnectViaSsh(Server server, Credentials creds) throws IOException {
|
||||||
SshClient ssh = Guice.createInjector(new JschSshClientModule()).getInstance(SshClient.Factory.class)
|
SshClient ssh = Guice.createInjector(new JschSshClientModule()).getInstance(SshClient.Factory.class).create(
|
||||||
.create(new IPSocket(server.getVnc().getIp(), 22), creds);
|
new IPSocket(server.getVnc().getIp(), 22), creds);
|
||||||
try {
|
try {
|
||||||
ssh.connect();
|
ssh.connect();
|
||||||
ExecResponse hello = ssh.exec("echo hello");
|
ExecResponse hello = ssh.exec("echo hello");
|
||||||
|
@ -358,7 +357,7 @@ public class ElasticStackClientLiveTest {
|
||||||
public void testWeCopyADriveContentsViaGzip() throws IOException {
|
public void testWeCopyADriveContentsViaGzip() throws IOException {
|
||||||
try {
|
try {
|
||||||
drive3 = client
|
drive3 = client
|
||||||
.createDrive(new CreateDriveRequest.Builder().name(prefix + "3").size(1 * 1024 * 1024l).build());
|
.createDrive(new CreateDriveRequest.Builder().name(prefix + "3").size(1 * 1024 * 1024l).build());
|
||||||
System.err.println("before image; drive 2" + client.getDriveInfo(drive2.getUuid()));
|
System.err.println("before image; drive 2" + client.getDriveInfo(drive2.getUuid()));
|
||||||
System.err.println("before image; drive 3" + client.getDriveInfo(drive3.getUuid()));
|
System.err.println("before image; drive 3" + client.getDriveInfo(drive3.getUuid()));
|
||||||
client.imageDrive(drive2.getUuid(), drive3.getUuid());
|
client.imageDrive(drive2.getUuid(), drive3.getUuid());
|
||||||
|
@ -379,7 +378,7 @@ public class ElasticStackClientLiveTest {
|
||||||
|
|
||||||
protected void prepareDrive() {
|
protected void prepareDrive() {
|
||||||
System.err.println("before prepare" + client.getDriveInfo(drive.getUuid()));
|
System.err.println("before prepare" + client.getDriveInfo(drive.getUuid()));
|
||||||
client.imageDrive("38df0986-4d85-4b76-b502-3878ffc80161", drive.getUuid(), ImageConversionType.GUNZIP);
|
client.imageDrive(bootDrive, drive.getUuid(), ImageConversionType.GUNZIP);
|
||||||
assert driveNotClaimed.apply(drive) : client.getDriveInfo(drive.getUuid());
|
assert driveNotClaimed.apply(drive) : client.getDriveInfo(drive.getUuid());
|
||||||
System.err.println("after prepare" + client.getDriveInfo(drive.getUuid()));
|
System.err.println("after prepare" + client.getDriveInfo(drive.getUuid()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,4 +36,8 @@ public class ElasticStackComputeServiceLiveTest extends BaseComputeServiceLiveTe
|
||||||
return new JschSshClientModule();
|
return new JschSshClientModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void testOptionToNotBlock() {
|
||||||
|
// start call is blocking anyway.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import java.util.concurrent.Future;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
import javax.net.ssl.SSLException;
|
||||||
|
|
||||||
import org.jclouds.Constants;
|
import org.jclouds.Constants;
|
||||||
import org.jclouds.http.HttpCommand;
|
import org.jclouds.http.HttpCommand;
|
||||||
|
@ -47,6 +48,7 @@ import org.jclouds.http.IOExceptionRetryHandler;
|
||||||
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
||||||
import org.jclouds.http.handlers.DelegatingRetryHandler;
|
import org.jclouds.http.handlers.DelegatingRetryHandler;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
import org.jclouds.rest.AuthorizationException;
|
||||||
import org.jclouds.util.Throwables2;
|
import org.jclouds.util.Throwables2;
|
||||||
|
|
||||||
import com.google.common.io.NullOutputStream;
|
import com.google.common.io.NullOutputStream;
|
||||||
|
@ -73,9 +75,9 @@ public abstract class BaseHttpCommandExecutorService<Q> implements HttpCommandEx
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected BaseHttpCommandExecutorService(HttpUtils utils,
|
protected BaseHttpCommandExecutorService(HttpUtils utils,
|
||||||
@Named(Constants.PROPERTY_IO_WORKER_THREADS) ExecutorService ioWorkerExecutor,
|
@Named(Constants.PROPERTY_IO_WORKER_THREADS) ExecutorService ioWorkerExecutor,
|
||||||
DelegatingRetryHandler retryHandler, IOExceptionRetryHandler ioRetryHandler,
|
DelegatingRetryHandler retryHandler, IOExceptionRetryHandler ioRetryHandler,
|
||||||
DelegatingErrorHandler errorHandler, HttpWire wire) {
|
DelegatingErrorHandler errorHandler, HttpWire wire) {
|
||||||
this.utils = checkNotNull(utils, "utils");
|
this.utils = checkNotNull(utils, "utils");
|
||||||
this.retryHandler = checkNotNull(retryHandler, "retryHandler");
|
this.retryHandler = checkNotNull(retryHandler, "retryHandler");
|
||||||
this.ioRetryHandler = checkNotNull(ioRetryHandler, "ioRetryHandler");
|
this.ioRetryHandler = checkNotNull(ioRetryHandler, "ioRetryHandler");
|
||||||
|
@ -125,7 +127,8 @@ public abstract class BaseHttpCommandExecutorService<Q> implements HttpCommandEx
|
||||||
public Future<HttpResponse> submit(HttpCommand command) {
|
public Future<HttpResponse> submit(HttpCommand command) {
|
||||||
HttpRequest request = command.getCurrentRequest();
|
HttpRequest request = command.getCurrentRequest();
|
||||||
checkRequestHasContentLengthOrChunkedEncoding(request,
|
checkRequestHasContentLengthOrChunkedEncoding(request,
|
||||||
"if the request has a payload, it must be set to chunked encoding or specify a content length: " + request);
|
"if the request has a payload, it must be set to chunked encoding or specify a content length: "
|
||||||
|
+ request);
|
||||||
return ioWorkerExecutor.submit(new HttpResponseCallable(command));
|
return ioWorkerExecutor.submit(new HttpResponseCallable(command));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +150,7 @@ public abstract class BaseHttpCommandExecutorService<Q> implements HttpCommandEx
|
||||||
request = filter.filter(request);
|
request = filter.filter(request);
|
||||||
}
|
}
|
||||||
checkRequestHasContentLengthOrChunkedEncoding(request,
|
checkRequestHasContentLengthOrChunkedEncoding(request,
|
||||||
"After filtering, the request has niether chunked encoding nor content length: " + request);
|
"After filtering, the request has niether chunked encoding nor content length: " + request);
|
||||||
logger.debug("Sending request %s: %s", request.hashCode(), request.getRequestLine());
|
logger.debug("Sending request %s: %s", request.hashCode(), request.getRequestLine());
|
||||||
wirePayloadIfEnabled(wire, request);
|
wirePayloadIfEnabled(wire, request);
|
||||||
nativeRequest = convert(request);
|
nativeRequest = convert(request);
|
||||||
|
@ -169,13 +172,18 @@ public abstract class BaseHttpCommandExecutorService<Q> implements HttpCommandEx
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
IOException ioe = Throwables2.getFirstThrowableOfType(e, IOException.class);
|
IOException ioe = Throwables2.getFirstThrowableOfType(e, IOException.class);
|
||||||
if (ioe != null && ioRetryHandler.shouldRetryRequest(command, ioe)) {
|
if (ioe != null) {
|
||||||
continue;
|
if (ioe instanceof SSLException) {
|
||||||
} else {
|
command.setException(new AuthorizationException(e.getMessage() + " connecting to "
|
||||||
command.setException(new HttpResponseException(e.getMessage() + " connecting to "
|
+ command.getCurrentRequest().getRequestLine(), e));
|
||||||
+ command.getCurrentRequest().getRequestLine(), command, null, e));
|
break;
|
||||||
break;
|
} else if (ioRetryHandler.shouldRetryRequest(command, ioe)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
command.setException(new HttpResponseException(e.getMessage() + " connecting to "
|
||||||
|
+ command.getCurrentRequest().getRequestLine(), command, null, e));
|
||||||
|
break;
|
||||||
} finally {
|
} finally {
|
||||||
cleanup(nativeRequest);
|
cleanup(nativeRequest);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class PreinstalledDiskToImage implements Function<DriveInfo, Image> {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public PreinstalledDiskToImage(Supplier<Location> locationSupplier,
|
public PreinstalledDiskToImage(Supplier<Location> locationSupplier,
|
||||||
Function<String, OsFamilyVersion64Bit> imageParser) {
|
Function<String, OsFamilyVersion64Bit> imageParser) {
|
||||||
this.locationSupplier = locationSupplier;
|
this.locationSupplier = locationSupplier;
|
||||||
this.imageParser = imageParser;
|
this.imageParser = imageParser;
|
||||||
}
|
}
|
||||||
|
@ -56,11 +56,11 @@ public class PreinstalledDiskToImage implements Function<DriveInfo, Image> {
|
||||||
String description = drive.getDescription() != null ? drive.getDescription() : drive.getName();
|
String description = drive.getDescription() != null ? drive.getDescription() : drive.getName();
|
||||||
OperatingSystemBuilder builder = new OperatingSystemBuilder();
|
OperatingSystemBuilder builder = new OperatingSystemBuilder();
|
||||||
OsFamilyVersion64Bit parsed = imageParser.apply(drive.getName());
|
OsFamilyVersion64Bit parsed = imageParser.apply(drive.getName());
|
||||||
builder.name(drive.getName()).description(description).is64Bit(parsed.is64Bit).version(parsed.version)
|
builder.name(drive.getName()).description(description).is64Bit(parsed.is64Bit).version(parsed.version).family(
|
||||||
.family(parsed.family);
|
parsed.family);
|
||||||
return new ImageBuilder().ids(drive.getUuid())
|
return new ImageBuilder().ids(drive.getUuid()).adminPassword("cloudsigma").userMetadata(
|
||||||
.userMetadata(ImmutableMap.<String, String> of("size", drive.getSize() / 1024 / 1024 / 1024 + ""))
|
ImmutableMap.<String, String> of("size", drive.getSize() / 1024 / 1024 / 1024 + "")).defaultCredentials(
|
||||||
.defaultCredentials(new Credentials("cloudsigma", "cloudsigma")).location(locationSupplier.get())
|
new Credentials("cloudsigma", "cloudsigma")).location(locationSupplier.get()).name(drive.getName())
|
||||||
.name(drive.getName()).description(description).operatingSystem(builder.build()).version("").build();
|
.description(description).operatingSystem(builder.build()).version("").build();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -99,6 +99,7 @@ public class ServerInfoToNodeMetadata implements Function<ServerInfo, NodeMetada
|
||||||
Image image = findImageForId.apply(imageId);
|
Image image = findImageForId.apply(imageId);
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
builder.operatingSystem(image.getOperatingSystem());
|
builder.operatingSystem(image.getOperatingSystem());
|
||||||
|
builder.adminPassword(image.getAdminPassword());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
builder.hardware(new HardwareBuilder().ids(from.getUuid())
|
builder.hardware(new HardwareBuilder().ids(from.getUuid())
|
||||||
|
@ -108,8 +109,6 @@ public class ServerInfoToNodeMetadata implements Function<ServerInfo, NodeMetada
|
||||||
builder.publicAddresses(ImmutableSet.<String> of(from.getVnc().getIp()));
|
builder.publicAddresses(ImmutableSet.<String> of(from.getVnc().getIp()));
|
||||||
builder.privateAddresses(ImmutableSet.<String> of());
|
builder.privateAddresses(ImmutableSet.<String> of());
|
||||||
builder.credentials(credentialStore.get(from.getUuid()));
|
builder.credentials(credentialStore.get(from.getUuid()));
|
||||||
// note sudo password!
|
|
||||||
builder.adminPassword(from.getVnc().getPassword());
|
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,11 @@ public class ListOfKeyValuesDelimitedByBlankLinesToListOfMaps implements Functio
|
||||||
for (String keyValueLine : Splitter.on('\n').split(listOfKeyValues)) {
|
for (String keyValueLine : Splitter.on('\n').split(listOfKeyValues)) {
|
||||||
if (!"".equals(keyValueLine)) {
|
if (!"".equals(keyValueLine)) {
|
||||||
int firstIndex = keyValueLine.indexOf(' ');
|
int firstIndex = keyValueLine.indexOf(' ');
|
||||||
String key = keyValueLine.substring(0, firstIndex);
|
if (firstIndex != -1) {
|
||||||
String value = keyValueLine.substring(firstIndex + 1).replace("\\n", "\n");
|
String key = keyValueLine.substring(0, firstIndex);
|
||||||
map.put(key, value);
|
String value = keyValueLine.substring(firstIndex + 1).replace("\\n", "\n");
|
||||||
|
map.put(key, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (map.size() != 0)
|
if (map.size() != 0)
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.cloudsigma.domain.ClaimType;
|
import org.jclouds.cloudsigma.domain.ClaimType;
|
||||||
|
@ -30,6 +31,7 @@ import org.jclouds.cloudsigma.domain.DriveInfo;
|
||||||
import org.jclouds.cloudsigma.domain.DriveMetrics;
|
import org.jclouds.cloudsigma.domain.DriveMetrics;
|
||||||
import org.jclouds.cloudsigma.domain.DriveStatus;
|
import org.jclouds.cloudsigma.domain.DriveStatus;
|
||||||
import org.jclouds.cloudsigma.domain.DriveType;
|
import org.jclouds.cloudsigma.domain.DriveType;
|
||||||
|
import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
|
@ -42,6 +44,9 @@ import com.google.common.collect.Maps;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class MapToDriveInfo implements Function<Map<String, String>, DriveInfo> {
|
public class MapToDriveInfo implements Function<Map<String, String>, DriveInfo> {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
protected Logger logger = Logger.NULL;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DriveInfo apply(Map<String, String> from) {
|
public DriveInfo apply(Map<String, String> from) {
|
||||||
if (from.size() == 0)
|
if (from.size() == 0)
|
||||||
|
@ -89,7 +94,12 @@ public class MapToDriveInfo implements Function<Map<String, String>, DriveInfo>
|
||||||
builder.free(new Boolean(from.get("free")));
|
builder.free(new Boolean(from.get("free")));
|
||||||
if (from.containsKey("type"))
|
if (from.containsKey("type"))
|
||||||
builder.type(DriveType.fromValue(from.get("type")));
|
builder.type(DriveType.fromValue(from.get("type")));
|
||||||
return builder.build();
|
try {
|
||||||
|
return builder.build();
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.trace("entry missing data: %s; %s", e.getMessage(), from);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DriveMetrics buildMetrics(Map<String, String> from) {
|
protected DriveMetrics buildMetrics(Map<String, String> from) {
|
||||||
|
|
|
@ -30,5 +30,6 @@ import org.testng.annotations.Test;
|
||||||
public class ElasticHostsBlueSquareLondonClientLiveTest extends ElasticStackClientLiveTest {
|
public class ElasticHostsBlueSquareLondonClientLiveTest extends ElasticStackClientLiveTest {
|
||||||
public ElasticHostsBlueSquareLondonClientLiveTest() {
|
public ElasticHostsBlueSquareLondonClientLiveTest() {
|
||||||
provider = "elastichosts-lon-b";
|
provider = "elastichosts-lon-b";
|
||||||
|
bootDrive = "aee5589a-88c3-43ef-bb0a-9cab6e64192d";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,5 +30,6 @@ import org.testng.annotations.Test;
|
||||||
public class ElasticHostsPeer1LondonClientLiveTest extends ElasticStackClientLiveTest {
|
public class ElasticHostsPeer1LondonClientLiveTest extends ElasticStackClientLiveTest {
|
||||||
public ElasticHostsPeer1LondonClientLiveTest() {
|
public ElasticHostsPeer1LondonClientLiveTest() {
|
||||||
provider = "elastichosts-lon-p";
|
provider = "elastichosts-lon-p";
|
||||||
|
bootDrive = "aee5589a-88c3-43ef-bb0a-9cab6e64192d";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,5 +30,6 @@ import org.testng.annotations.Test;
|
||||||
public class ElasticHostsPeer1SanAntonioClientLiveTest extends ElasticStackClientLiveTest {
|
public class ElasticHostsPeer1SanAntonioClientLiveTest extends ElasticStackClientLiveTest {
|
||||||
public ElasticHostsPeer1SanAntonioClientLiveTest() {
|
public ElasticHostsPeer1SanAntonioClientLiveTest() {
|
||||||
provider = "elastichosts-sat-p";
|
provider = "elastichosts-sat-p";
|
||||||
|
bootDrive = "aee5589a-88c3-43ef-bb0a-9cab6e64192d";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,22 +19,12 @@
|
||||||
|
|
||||||
package org.jclouds.serverlove.config;
|
package org.jclouds.serverlove.config;
|
||||||
|
|
||||||
import static org.jclouds.compute.domain.OsFamily.UBUNTU;
|
|
||||||
|
|
||||||
import org.jclouds.compute.domain.TemplateBuilder;
|
|
||||||
import org.jclouds.elasticstack.compute.config.ElasticStackComputeServiceContextModule;
|
import org.jclouds.elasticstack.compute.config.ElasticStackComputeServiceContextModule;
|
||||||
|
|
||||||
import com.google.inject.Injector;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class ServerloveManchesterComputeServiceContextModule extends ElasticStackComputeServiceContextModule {
|
public class ServerloveManchesterComputeServiceContextModule extends ElasticStackComputeServiceContextModule {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
|
|
||||||
return template.osFamily(UBUNTU).osVersionMatches("10.10").os64Bit(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,72 +1,42 @@
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"uuid": "38df0986-4d85-4b76-b502-3878ffc80161",
|
"uuid": "679f5f44-0be7-4745-a658-cccd4334c1aa",
|
||||||
"description": "CentOS Linux 5.5",
|
"description": "CentOS Linux 5.5",
|
||||||
"osFamily": "CENTOS",
|
"osFamily": "CENTOS",
|
||||||
"osVersion": "5.5",
|
"osVersion": "5.5",
|
||||||
"size": "3"
|
"size": "3",
|
||||||
|
"loginUser": "root"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "980cf63c-f21e-4382-997b-6541d5809629",
|
"uuid": "5795b68f-ed26-4639-b41d-c93235062b6b",
|
||||||
"description": "Debian Linux 5.0",
|
"description": "Debian Linux 5.0",
|
||||||
"osFamily": "DEBIAN",
|
"osFamily": "DEBIAN",
|
||||||
"osVersion": "5.0",
|
"osVersion": "5.0",
|
||||||
"size": "1"
|
"size": "1",
|
||||||
|
"loginUser": "root"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "aee5589a-88c3-43ef-bb0a-9cab6e64192d",
|
"uuid": "5f2e0e29-2937-42b9-b362-d2d07eddbdeb",
|
||||||
"description": "Ubuntu Linux 10.04",
|
"description": "Ubuntu Linux 10.04",
|
||||||
"osFamily": "UBUNTU",
|
"osFamily": "UBUNTU",
|
||||||
"osVersion": "10.04",
|
"osVersion": "10.04",
|
||||||
"size": "1"
|
"size": "1",
|
||||||
|
"loginUser": "root"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "bf1d943e-2a55-46bb-a8c7-6099e44a3dde",
|
"uuid": "85623ca1-9c2a-4398-a771-9a43c347e86b",
|
||||||
"description": "Ubuntu Linux 8.10: Base system with X",
|
|
||||||
"osFamily": "UBUNTU",
|
|
||||||
"osVersion": "8.10",
|
|
||||||
"size": "3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"uuid": "757586d5-f1e9-4d9c-b215-5a391c9a24bf",
|
|
||||||
"description": "Ubuntu Linux 9.04: Base system with X",
|
|
||||||
"osFamily": "UBUNTU",
|
|
||||||
"osVersion": "9.04",
|
|
||||||
"size": "3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"uuid": "b9d0eb72-d273-43f1-98e3-0d4b87d372c0",
|
|
||||||
"description": "Windows Web Server 2008",
|
|
||||||
"osFamily": "WINDOWS",
|
|
||||||
"osVersion": "2008",
|
|
||||||
"size": "13"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"uuid": "b405b598-4ae4-4ba8-8a2b-a9487d693f34",
|
|
||||||
"description": "Windows Web Server 2008 R2",
|
"description": "Windows Web Server 2008 R2",
|
||||||
"osFamily": "WINDOWS",
|
"osFamily": "WINDOWS",
|
||||||
"osVersion": "2008 R2",
|
"osVersion": "2008 R2",
|
||||||
"size": "13"
|
"size": "13",
|
||||||
|
"loginUser": "Administrator"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "9397d327-3bf6-46a2-abf6-69553dbb6927",
|
"uuid": "41993a02-0b22-4e49-bb47-0aa8975217e4",
|
||||||
"description": "Windows Web Server 2008 R2 + SQL Server",
|
|
||||||
"osFamily": "WINDOWS",
|
|
||||||
"osVersion": "2008 R2",
|
|
||||||
"size": "13"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"uuid": "10a88d1c-6575-46e3-8d2c-7744065ea530",
|
|
||||||
"description": "Windows Server 2008 Standard R2",
|
"description": "Windows Server 2008 Standard R2",
|
||||||
"osFamily": "WINDOWS",
|
"osFamily": "WINDOWS",
|
||||||
"osVersion": "2008 R2",
|
"osVersion": "2008 R2",
|
||||||
"size": "13"
|
"size": "13",
|
||||||
},
|
"loginUser": "Administrator"
|
||||||
{
|
|
||||||
"uuid": "662c5b3f-9828-4aa2-a866-7cfa53798cdf",
|
|
||||||
"description": "Windows Server 2008 Standard R2 + SQL Server",
|
|
||||||
"osFamily": "WINDOWS",
|
|
||||||
"osVersion": "2008 R2",
|
|
||||||
"size": "13"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
|
@ -19,7 +19,9 @@
|
||||||
|
|
||||||
package org.jclouds.serverlove;
|
package org.jclouds.serverlove;
|
||||||
|
|
||||||
|
import org.jclouds.domain.Credentials;
|
||||||
import org.jclouds.elasticstack.ElasticStackClientLiveTest;
|
import org.jclouds.elasticstack.ElasticStackClientLiveTest;
|
||||||
|
import org.jclouds.elasticstack.domain.Server;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,5 +32,10 @@ import org.testng.annotations.Test;
|
||||||
public class ServerloveManchesterClientLiveTest extends ElasticStackClientLiveTest {
|
public class ServerloveManchesterClientLiveTest extends ElasticStackClientLiveTest {
|
||||||
public ServerloveManchesterClientLiveTest() {
|
public ServerloveManchesterClientLiveTest() {
|
||||||
provider = "serverlove-z1-man";
|
provider = "serverlove-z1-man";
|
||||||
|
bootDrive = "5f2e0e29-2937-42b9-b362-d2d07eddbdeb";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Credentials getSshCredentials(Server server) {
|
||||||
|
return new Credentials("root", server.getVnc().getPassword());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,8 @@ public class ServerloveManchesterTemplateBuilderLiveTest extends BaseTemplateBui
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
return ((input.family == OsFamily.RHEL) || //
|
return ((input.family == OsFamily.RHEL) || //
|
||||||
(input.family == OsFamily.CENTOS && !(input.version.equals("5.5") && input.is64Bit)) || //
|
(input.family == OsFamily.CENTOS && !(input.version.equals("5.5") && input.is64Bit)) || //
|
||||||
(input.family == OsFamily.UBUNTU && !(input.version.equals("10.10") && input.is64Bit)) || //
|
(input.family == OsFamily.UBUNTU && !(input.version.equals("10.04") && input.is64Bit)) || //
|
||||||
(input.family == OsFamily.WINDOWS) //
|
(input.family == OsFamily.WINDOWS && !(input.version.equals("2008 R2") && input.is64Bit)) //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public class ServerloveManchesterTemplateBuilderLiveTest extends BaseTemplateBui
|
||||||
public void testTemplateBuilder() {
|
public void testTemplateBuilder() {
|
||||||
Template defaultTemplate = this.context.getComputeService().templateBuilder().build();
|
Template defaultTemplate = this.context.getComputeService().templateBuilder().build();
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.10");
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04");
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||||
assertEquals(defaultTemplate.getLocation().getId(), "serverlove-z1-man");
|
assertEquals(defaultTemplate.getLocation().getId(), "serverlove-z1-man");
|
||||||
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
||||||
|
|
|
@ -30,5 +30,6 @@ import org.testng.annotations.Test;
|
||||||
public class SkaliCloudMalaysiaClientLiveTest extends ElasticStackClientLiveTest {
|
public class SkaliCloudMalaysiaClientLiveTest extends ElasticStackClientLiveTest {
|
||||||
public SkaliCloudMalaysiaClientLiveTest() {
|
public SkaliCloudMalaysiaClientLiveTest() {
|
||||||
provider = "skalicloud-sdg-my";
|
provider = "skalicloud-sdg-my";
|
||||||
|
bootDrive = "3051699a-a536-4220-aeb5-67f2ec101a09";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue