Issue 327: fixed terremark tag pattern and disk parsing

This commit is contained in:
Adrian Cole 2010-08-15 12:50:03 -07:00
parent 3363f62b83
commit 5b215533f1
5 changed files with 91 additions and 92 deletions

View File

@ -107,8 +107,7 @@ public class BaseComputeService implements ComputeService {
ListNodesStrategy listNodesStrategy, GetNodeMetadataStrategy getNodeMetadataStrategy, ListNodesStrategy listNodesStrategy, GetNodeMetadataStrategy getNodeMetadataStrategy,
RunNodesAndAddToSetStrategy runNodesAndAddToSetStrategy, RebootNodeStrategy rebootNodeStrategy, RunNodesAndAddToSetStrategy runNodesAndAddToSetStrategy, RebootNodeStrategy rebootNodeStrategy,
DestroyNodeStrategy destroyNodeStrategy, Provider<TemplateBuilder> templateBuilderProvider, DestroyNodeStrategy destroyNodeStrategy, Provider<TemplateBuilder> templateBuilderProvider,
Provider<TemplateOptions> templateOptionsProvider, Provider<TemplateOptions> templateOptionsProvider, @Named("NODE_RUNNING") Predicate<NodeMetadata> nodeRunning,
@Named("NODE_RUNNING") Predicate<NodeMetadata> nodeRunning,
@Named("NODE_TERMINATED") Predicate<NodeMetadata> nodeTerminated, ComputeUtils utils, @Named("NODE_TERMINATED") Predicate<NodeMetadata> nodeTerminated, ComputeUtils utils,
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) { @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
this.context = checkNotNull(context, "context"); this.context = checkNotNull(context, "context");

View File

@ -255,8 +255,9 @@ public abstract class BaseComputeServiceLiveTest {
assertLocationSameOrChild(node1.getLocation(), template.getLocation()); assertLocationSameOrChild(node1.getLocation(), template.getLocation());
assertLocationSameOrChild(node2.getLocation(), template.getLocation()); assertLocationSameOrChild(node2.getLocation(), template.getLocation());
if (node1.getImage() != null)
assertEquals(node1.getImage(), template.getImage()); assertEquals(node1.getImage(), template.getImage());
if (node2.getImage() != null)
assertEquals(node2.getImage(), template.getImage()); assertEquals(node2.getImage(), template.getImage());
} }
@ -337,9 +338,8 @@ public abstract class BaseComputeServiceLiveTest {
.append("echo \"name=jdkrepository\" >> /etc/yum.repos.d/CentOS-Base.repo\n") .append("echo \"name=jdkrepository\" >> /etc/yum.repos.d/CentOS-Base.repo\n")
.append( .append(
"echo \"baseurl=http://ec2-us-east-mirror.rightscale.com/epel/5/i386/\" >> /etc/yum.repos.d/CentOS-Base.repo\n") "echo \"baseurl=http://ec2-us-east-mirror.rightscale.com/epel/5/i386/\" >> /etc/yum.repos.d/CentOS-Base.repo\n")
.append("echo \"enabled=1\" >> /etc/yum.repos.d/CentOS-Base.repo\n") .append("echo \"enabled=1\" >> /etc/yum.repos.d/CentOS-Base.repo\n").append(
.append("yum --nogpgcheck -y install java-1.6.0-openjdk\n") "yum --nogpgcheck -y install java-1.6.0-openjdk\n").append(
.append(
"echo \"export PATH=\\\"/usr/lib/jvm/jre-1.6.0-openjdk/bin/:\\$PATH\\\"\" >> /root/.bashrc\n") "echo \"export PATH=\\\"/usr/lib/jvm/jre-1.6.0-openjdk/bin/:\\$PATH\\\"\" >> /root/.bashrc\n")
.toString(); .toString();
default: default:

View File

@ -60,7 +60,7 @@ public class GetExtra implements Function<VApp, Map<String, String>> {
.getVirtualQuantity() .getVirtualQuantity()
+ ""); + "");
for (ResourceAllocation disk : filter(vApp.getResourceAllocations(), resourceType(ResourceType.DISK_DRIVE))) { for (ResourceAllocation disk : filter(vApp.getResourceAllocations(), resourceType(ResourceType.DISK_DRIVE))) {
extra.put(String.format("disk_drive/%s/kb", disk.getId()), disk.getVirtualQuantity() + ""); extra.put(String.format("disk_drive/%s/kb", disk.getAddressOnParent()), disk.getVirtualQuantity() + "");
} }
for (Entry<String, String> net : vApp.getNetworkToAddresses().entries()) { for (Entry<String, String> net : vApp.getNetworkToAddresses().entries()) {

View File

@ -67,7 +67,7 @@ public class VCloudGetNodeMetadata {
protected final GetExtra getExtra; protected final GetExtra getExtra;
protected final Map<VAppStatus, NodeState> vAppStatusToNodeState; protected final Map<VAppStatus, NodeState> vAppStatusToNodeState;
public static final Pattern TAG_PATTERN_WITHOUT_TEMPLATE = Pattern.compile("([^-]+)-[0-9]+"); public static final Pattern TAG_PATTERN_WITHOUT_TEMPLATE = Pattern.compile("([^-]+)-[0-9a-f]+");
@Inject @Inject
VCloudGetNodeMetadata(VCloudClient client, VCloudComputeClient computeClient, VCloudGetNodeMetadata(VCloudClient client, VCloudComputeClient computeClient,

View File

@ -69,7 +69,7 @@ public class VCloudComputeServiceLiveTest extends BaseComputeServiceLiveTest {
assertEquals(node.getType(), ComputeType.NODE); assertEquals(node.getType(), ComputeType.NODE);
NodeMetadata allData = client.getNodeMetadata(node.getId()); NodeMetadata allData = client.getNodeMetadata(node.getId());
assert allData.getExtra().get("processor/count") != null : allData.getExtra(); assert allData.getExtra().get("processor/count") != null : allData.getExtra();
assert allData.getExtra().get("disk_drive/1/kb") != null : allData.getExtra(); assert allData.getExtra().get("disk_drive/0/kb") != null : allData.getExtra();
assert allData.getExtra().get("memory/mb") != null : allData.getExtra(); assert allData.getExtra().get("memory/mb") != null : allData.getExtra();
System.out.println(allData.getExtra()); System.out.println(allData.getExtra());
} }