update for elastichosts to support metadata and tags

This commit is contained in:
Adrian Cole 2012-09-16 16:21:09 -07:00
parent 2ebd5f0247
commit 612aa2c93a
3 changed files with 6 additions and 12 deletions

View File

@ -122,7 +122,8 @@ public class ElasticStackComputeServiceAdapter implements
}
Server toCreate = small(name, drive.getUuid(), defaultVncPassword).mem(template.getHardware().getRam())
.cpu((int) (template.getHardware().getProcessors().get(0).getSpeed())).build();
.cpu((int) (template.getHardware().getProcessors().get(0).getSpeed()))
.tags(template.getOptions().getTags()).userMetadata(template.getOptions().getUserMetadata()).build();
ServerInfo from = client.createServer(toCreate);
client.startServer(from.getUuid());

View File

@ -93,7 +93,8 @@ public class ServerInfoToNodeMetadata implements Function<ServerInfo, NodeMetada
builder.name(from.getName());
builder.location(locationSupplier.get());
builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getName()));
builder.tags(from.getTags());
builder.userMetadata(from.getUserMetadata());
String imageId = getImageIdFromServer.apply(from);
if (imageId != null) {
Image image = findImageForId.apply(imageId);

View File

@ -24,13 +24,12 @@ import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
import org.jclouds.sshj.config.SshjSshClientModule;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
import com.google.inject.Module;
/**
* @author Adrian Cole
*/
@Test(groups = "live")
@Test(groups = "live", testName = "ElasticStackComputeServiceLiveTest")
public class ElasticStackComputeServiceLiveTest extends BaseComputeServiceLiveTest {
public ElasticStackComputeServiceLiveTest() {
@ -42,13 +41,6 @@ public class ElasticStackComputeServiceLiveTest extends BaseComputeServiceLiveTe
return new SshjSshClientModule();
}
// elasticstack does not support metadata
@Override
protected void checkUserMetadataInNodeEquals(NodeMetadata node, ImmutableMap<String, String> userMetadata) {
assert node.getUserMetadata().equals(ImmutableMap.<String, String> of()) : String.format(
"node userMetadata did not match %s %s", userMetadata, node);
}
@Override
public void testOptionToNotBlock() {
// start call is blocking anyway.
@ -56,6 +48,6 @@ public class ElasticStackComputeServiceLiveTest extends BaseComputeServiceLiveTe
protected void checkResponseEqualsHostname(ExecResponse execResponse, NodeMetadata node1) {
// hostname is not predictable based on node metadata
assert execResponse.getOutput().trim().equals("ubuntu");
assert execResponse.getOutput().trim().equals("ubuntu") : execResponse.getOutput();
}
}