Issue 620:elasticstack and cloudsigma-based providers do not report operating system on nodes

This commit is contained in:
Adrian Cole 2011-07-07 01:01:35 -07:00
parent 6b1720bfde
commit 48fa7a6d2c
4 changed files with 10 additions and 6 deletions

View File

@ -107,8 +107,9 @@ public class ElasticStackComputeServiceAdapter implements
public ServerInfo createNodeWithGroupEncodedIntoNameThenStoreCredentials(String tag, String name, Template template, public ServerInfo createNodeWithGroupEncodedIntoNameThenStoreCredentials(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().getId()).size(bootSize)
.build()); .build());
logger.debug("<< drive(%s)", drive.getUuid()); logger.debug("<< drive(%s)", drive.getUuid());
@ -120,12 +121,14 @@ 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!");
} }
cache.put(drive.getUuid(), drive);
Server toCreate = small(name, drive.getUuid(), defaultVncPassword).mem(template.getHardware().getRam()).cpu( Server toCreate = small(name, drive.getUuid(), defaultVncPassword).mem(template.getHardware().getRam()).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(template.getImage().getDefaultCredentials().identity, credentialStore.put("node#"+ from.getUuid(), new Credentials(template.getImage().getDefaultCredentials().identity,
from.getVnc().getPassword())); from.getVnc().getPassword()));
return from; return from;
} }
@ -213,7 +216,6 @@ public class ElasticStackComputeServiceAdapter implements
@Override @Override
public void resumeNode(String id) { public void resumeNode(String id) {
client.startServer(id); client.startServer(id);
} }
@Override @Override

View File

@ -106,7 +106,7 @@ public class ServerInfoToNodeMetadata implements Function<ServerInfo, NodeMetada
builder.state(serverStatusToNodeState.get(from.getStatus())); builder.state(serverStatusToNodeState.get(from.getStatus()));
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("node#"+ from.getUuid()));
return builder.build(); return builder.build();
} }

View File

@ -120,6 +120,8 @@ public class CloudSigmaComputeServiceAdapter 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!");
} }
cache.put(drive.getUuid(), drive);
Server toCreate = Servers.small(name, drive.getUuid(), defaultVncPassword).mem(template.getHardware().getRam()) Server toCreate = Servers.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())).build();
@ -129,7 +131,7 @@ public class CloudSigmaComputeServiceAdapter implements
logger.debug(">> starting server(%s)", from.getUuid()); logger.debug(">> starting server(%s)", from.getUuid());
client.startServer(from.getUuid()); client.startServer(from.getUuid());
// 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("cloudsigma", "cloudsigma")); credentialStore.put("node#"+ from.getUuid(), new Credentials("cloudsigma", "cloudsigma"));
return from; return from;
} }

View File

@ -107,7 +107,7 @@ public class ServerInfoToNodeMetadata implements Function<ServerInfo, NodeMetada
builder.state(serverStatusToNodeState.get(from.getStatus())); builder.state(serverStatusToNodeState.get(from.getStatus()));
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("node#"+ from.getUuid()));
return builder.build(); return builder.build();
} }