mirror of https://github.com/apache/jclouds.git
Issue 254: distinguish between id and providerId
This commit is contained in:
parent
b7f1e06cf5
commit
efc47969d9
|
@ -46,7 +46,7 @@ public class ResourceMetadataListToDirectoryEntryList
|
|||
public DirectoryEntry apply(StorageMetadata from) {
|
||||
FileType type = (from.getType() == StorageType.FOLDER || from.getType() == StorageType.RELATIVE_PATH) ? FileType.DIRECTORY
|
||||
: FileType.REGULAR;
|
||||
return new DirectoryEntry(from.getId(), type, from.getName());
|
||||
return new DirectoryEntry(from.getProviderId(), type, from.getName());
|
||||
}
|
||||
|
||||
}), from.getNextMarker());
|
||||
|
|
|
@ -127,7 +127,7 @@ public class EC2ComputeService extends BaseComputeService {
|
|||
Map<String, String> regionTags = Maps.newHashMap();
|
||||
for (NodeMetadata nodeMetadata : deadOnes) {
|
||||
if (nodeMetadata.getTag() != null)
|
||||
regionTags.put(parseHandle(nodeMetadata.getHandle())[0], nodeMetadata.getTag());
|
||||
regionTags.put(parseHandle(nodeMetadata.getId())[0], nodeMetadata.getTag());
|
||||
}
|
||||
for (Entry<String, String> regionTag : regionTags.entrySet()) {
|
||||
deleteKeyPair(regionTag.getKey(), regionTag.getValue());
|
||||
|
@ -157,7 +157,7 @@ public class EC2ComputeService extends BaseComputeService {
|
|||
for (NodeMetadata node : Iterables.filter(super
|
||||
.listNodesDetailsMatching(NodePredicates.all()), Predicates.and(filter, Predicates
|
||||
.not(NodePredicates.TERMINATED)))) {
|
||||
ids.add(node.getId());
|
||||
ids.add(node.getProviderId());
|
||||
location = node.getLocation();
|
||||
}
|
||||
logger.debug(">> creating load balancer (%s)", loadBalancerName);
|
||||
|
@ -171,7 +171,7 @@ public class EC2ComputeService extends BaseComputeService {
|
|||
public void deleteLoadBalancer(String loadBalancerName, Predicate<NodeMetadata> filter) {
|
||||
String region = parseHandle(Iterables.get(
|
||||
Iterables.filter(super.listNodesDetailsMatching(NodePredicates.all()), Predicates
|
||||
.and(filter, Predicates.not(NodePredicates.TERMINATED))), 0).getHandle())[0];
|
||||
.and(filter, Predicates.not(NodePredicates.TERMINATED))), 0).getId())[0];
|
||||
ec2Client.getElasticLoadBalancerServices().deleteLoadBalancerInRegion(region,
|
||||
loadBalancerName);
|
||||
}
|
||||
|
|
|
@ -297,7 +297,7 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
|
|||
return new Function<ComputeMetadata, String>() {
|
||||
@Override
|
||||
public String apply(ComputeMetadata from) {
|
||||
return from.getId();
|
||||
return from.getProviderId();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
|
|||
.describeImagesInRegion(region, ownedBy(amiOwners))) {
|
||||
Image image = parser.apply(from);
|
||||
if (image != null)
|
||||
images.put(new RegionAndName(region, image.getId()), image);
|
||||
images.put(new RegionAndName(region, image.getProviderId()), image);
|
||||
else if (from.getImageType() == ImageType.MACHINE)
|
||||
holder.logger.trace("<< image(%s) didn't parse", from.getId());
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class RunningInstanceToNodeMetadata implements Function<RunningInstance,
|
|||
|
||||
@Override
|
||||
public boolean apply(Image input) {
|
||||
return input.getId().equals(instance.getImageId())
|
||||
return input.getProviderId().equals(instance.getImageId())
|
||||
&& (input.getLocation() == null || input.getLocation().equals(location) || input
|
||||
.getLocation().equals(location.getParent()));
|
||||
}
|
||||
|
|
|
@ -129,9 +129,9 @@ public class EC2RunNodesAndAddToSetStrategy implements RunNodesAndAddToSetStrate
|
|||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug(">> running %d instance region(%s) zone(%s) ami(%s) params(%s)", count,
|
||||
region, zone, template.getImage().getId(), instanceOptions.buildFormParameters());
|
||||
region, zone, template.getImage().getProviderId(), instanceOptions.buildFormParameters());
|
||||
|
||||
return instanceClient.runInstancesInRegion(region, zone, template.getImage().getId(), 1,
|
||||
return instanceClient.runInstancesInRegion(region, zone, template.getImage().getProviderId(), 1,
|
||||
count, instanceOptions);
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
|||
assert first.getCredentials() != null : first;
|
||||
assert first.getCredentials().account != null : first;
|
||||
|
||||
startedId = Iterables.getOnlyElement(nodes).getId();
|
||||
startedId = Iterables.getOnlyElement(nodes).getProviderId();
|
||||
|
||||
RunningInstance instance = getInstance(instanceClient, startedId);
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
|||
Credentials creds = nodes.iterator().next().getCredentials();
|
||||
assert creds == null;
|
||||
|
||||
startedId = Iterables.getOnlyElement(nodes).getId();
|
||||
startedId = Iterables.getOnlyElement(nodes).getProviderId();
|
||||
|
||||
RunningInstance instance = getInstance(instanceClient, startedId);
|
||||
|
||||
|
@ -191,7 +191,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
|||
Set<? extends NodeMetadata> nodes = client.runNodesWithTag(tag, 2, template);
|
||||
Set<String> instanceIds = new HashSet<String>();
|
||||
for (NodeMetadata node : nodes) {
|
||||
instanceIds.add(node.getId());
|
||||
instanceIds.add(node.getProviderId());
|
||||
}
|
||||
|
||||
// create load balancer
|
||||
|
|
|
@ -141,7 +141,7 @@ public class EC2ComputeServiceTest {
|
|||
return new Function<ComputeMetadata, String>() {
|
||||
@Override
|
||||
public String apply(ComputeMetadata from) {
|
||||
return from.getId();
|
||||
return from.getProviderId();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -67,14 +67,14 @@ public class EC2TemplateBuilderLiveTest {
|
|||
ImmutableSet.of(new Log4JLoggingModule()));
|
||||
|
||||
Template defaultTemplate = newContext.getComputeService().templateBuilder().build();
|
||||
assert (defaultTemplate.getImage().getId().startsWith("ami-")) : defaultTemplate;
|
||||
assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate;
|
||||
assertEquals(defaultTemplate.getImage().getName(), "9.10");
|
||||
assertEquals(defaultTemplate.getImage().getArchitecture(), Architecture.X86_32);
|
||||
assertEquals(defaultTemplate.getImage().getOsFamily(), OsFamily.UBUNTU);
|
||||
assertEquals(defaultTemplate.getLocation().getId(), "us-east-1");
|
||||
assertEquals(defaultTemplate.getSize().getCores(), 1.0d);
|
||||
newContext.getComputeService().templateBuilder().imageId(
|
||||
Iterables.get(newContext.getComputeService().listImages(), 0).getId()).build();
|
||||
Iterables.get(newContext.getComputeService().listImages(), 0).getProviderId()).build();
|
||||
newContext.getComputeService().templateBuilder().osFamily(OsFamily.UBUNTU).smallest()
|
||||
.architecture(Architecture.X86_32).imageId("ami-7e28ca17").build();
|
||||
newContext.getComputeService().templateBuilder().osFamily(OsFamily.UBUNTU).smallest()
|
||||
|
@ -101,7 +101,7 @@ public class EC2TemplateBuilderLiveTest {
|
|||
Template template = newContext.getComputeService().templateBuilder().imageId(
|
||||
"ami-ccb35ea5").build();
|
||||
System.out.println(template.getImage());
|
||||
assert (template.getImage().getId().startsWith("ami-")) : template;
|
||||
assert (template.getImage().getProviderId().startsWith("ami-")) : template;
|
||||
assertEquals(template.getImage().getName(), "5.4");
|
||||
assertEquals(template.getImage().getArchitecture(), Architecture.X86_64);
|
||||
assertEquals(template.getImage().getOsFamily(), OsFamily.CENTOS);
|
||||
|
|
|
@ -62,7 +62,7 @@ public class ImageParserTest extends BaseEC2HandlerTest {
|
|||
assertEquals(ubuntuHardy.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_32);
|
||||
assertEquals(ubuntuHardy.getDescription(),
|
||||
"ubuntu-images-us/ubuntu-hardy-8.04-i386-server-20091130.manifest.xml");
|
||||
assertEquals(ubuntuHardy.getId(), "ami-7e28ca17");
|
||||
assertEquals(ubuntuHardy.getProviderId(), "ami-7e28ca17");
|
||||
assertEquals(ubuntuHardy.getLocation(), defaultLocation);
|
||||
assertEquals(ubuntuHardy.getName(), "8.04");
|
||||
assertEquals(ubuntuHardy.getOsDescription(),
|
||||
|
@ -77,7 +77,7 @@ public class ImageParserTest extends BaseEC2HandlerTest {
|
|||
assertEquals(alesticKarmic.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_32);
|
||||
assertEquals(alesticKarmic.getDescription(),
|
||||
"alestic/ubuntu-9.10-karmic-base-20090623.manifest.xml");
|
||||
assertEquals(alesticKarmic.getId(), "ami-19a34270");
|
||||
assertEquals(alesticKarmic.getProviderId(), "ami-19a34270");
|
||||
assertEquals(alesticKarmic.getLocation(), defaultLocation);
|
||||
assertEquals(alesticKarmic.getName(), "9.10");
|
||||
assertEquals(alesticKarmic.getOsDescription(),
|
||||
|
@ -92,7 +92,7 @@ public class ImageParserTest extends BaseEC2HandlerTest {
|
|||
assertEquals(ubuntuKarmic.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_32);
|
||||
assertEquals(ubuntuKarmic.getDescription(),
|
||||
"ubuntu-images-us/ubuntu-karmic-9.10-i386-server-20100121.manifest.xml");
|
||||
assertEquals(ubuntuKarmic.getId(), "ami-bb709dd2");
|
||||
assertEquals(ubuntuKarmic.getProviderId(), "ami-bb709dd2");
|
||||
assertEquals(ubuntuKarmic.getLocation(), defaultLocation);
|
||||
assertEquals(ubuntuKarmic.getName(), "9.10");
|
||||
assertEquals(ubuntuKarmic.getOsDescription(),
|
||||
|
@ -110,7 +110,7 @@ public class ImageParserTest extends BaseEC2HandlerTest {
|
|||
assertEquals(alesticHardy.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_32);
|
||||
assertEquals(alesticHardy.getDescription(),
|
||||
"alestic/ubuntu-8.04-hardy-base-20080905.manifest.xml");
|
||||
assertEquals(alesticHardy.getId(), "ami-c0fa1ea9");
|
||||
assertEquals(alesticHardy.getProviderId(), "ami-c0fa1ea9");
|
||||
assertEquals(alesticHardy.getLocation(), defaultLocation);
|
||||
assertEquals(alesticHardy.getName(), "8.04");
|
||||
assertEquals(alesticHardy.getOsDescription(),
|
||||
|
@ -141,7 +141,7 @@ public class ImageParserTest extends BaseEC2HandlerTest {
|
|||
assertEquals(image.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_32);
|
||||
assertEquals(image.getDescription(),
|
||||
"vostok-builds/vostok-0.95-5622/vostok-0.95-5622.manifest.xml");
|
||||
assertEquals(image.getId(), "ami-870de2ee");
|
||||
assertEquals(image.getProviderId(), "ami-870de2ee");
|
||||
assertEquals(image.getLocation(), defaultLocation);
|
||||
assertEquals(image.getName(), "");
|
||||
assertEquals(image.getOsDescription(),
|
||||
|
@ -166,7 +166,7 @@ public class ImageParserTest extends BaseEC2HandlerTest {
|
|||
|
||||
assertEquals(image.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_64);
|
||||
assertEquals(image.getDescription(), "rightscale-us-east/CentOS_5.4_x64_v4.4.10.manifest.xml");
|
||||
assertEquals(image.getId(), "ami-ccb35ea5");
|
||||
assertEquals(image.getProviderId(), "ami-ccb35ea5");
|
||||
assertEquals(image.getLocation(), defaultLocation);
|
||||
assertEquals(image.getName(), "5.4");
|
||||
assertEquals(image.getOsDescription(),
|
||||
|
@ -180,7 +180,7 @@ public class ImageParserTest extends BaseEC2HandlerTest {
|
|||
|
||||
assertEquals(image.getArchitecture(), org.jclouds.compute.domain.Architecture.X86_64);
|
||||
assertEquals(image.getDescription(), "RightImage_Ubuntu_9.10_x64_v4.5.3_EBS_Alpha");
|
||||
assertEquals(image.getId(), "ami-c19db6b5");
|
||||
assertEquals(image.getProviderId(), "ami-c19db6b5");
|
||||
assertEquals(image.getLocation(), defaultLocation);
|
||||
assertEquals(image.getName(), "9.10");
|
||||
assertEquals(image.getOsDescription(),
|
||||
|
|
|
@ -99,7 +99,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce();
|
||||
|
||||
expect(instance.getImageId()).andReturn("imageId").atLeastOnce();
|
||||
expect(jcImage.getId()).andReturn("notImageId").atLeastOnce();
|
||||
expect(jcImage.getProviderId()).andReturn("notImageId").atLeastOnce();
|
||||
expect(instance.getRegion()).andReturn("us-east-1").atLeastOnce();
|
||||
|
||||
expect(imageMap.get(new RegionAndName("us-east-1", "imageId"))).andReturn(null);
|
||||
|
@ -158,7 +158,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce();
|
||||
|
||||
expect(instance.getImageId()).andReturn("imageId").atLeastOnce();
|
||||
expect(jcImage.getId()).andReturn("notImageId").atLeastOnce();
|
||||
expect(jcImage.getProviderId()).andReturn("notImageId").atLeastOnce();
|
||||
expect(instance.getRegion()).andReturn("us-east-1").atLeastOnce();
|
||||
|
||||
expect(imageMap.get(new RegionAndName("us-east-1", "imageId"))).andThrow(
|
||||
|
@ -218,7 +218,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce();
|
||||
|
||||
expect(instance.getImageId()).andReturn("imageId").atLeastOnce();
|
||||
expect(jcImage.getId()).andReturn("notImageId").atLeastOnce();
|
||||
expect(jcImage.getProviderId()).andReturn("notImageId").atLeastOnce();
|
||||
expect(instance.getRegion()).andReturn("us-east-1").atLeastOnce();
|
||||
|
||||
org.jclouds.compute.domain.Image lateImage = createMock(org.jclouds.compute.domain.Image.class);
|
||||
|
@ -284,7 +284,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce();
|
||||
|
||||
expect(instance.getImageId()).andReturn("imageId").atLeastOnce();
|
||||
expect(jcImage.getId()).andReturn("imageId").atLeastOnce();
|
||||
expect(jcImage.getProviderId()).andReturn("imageId").atLeastOnce();
|
||||
expect(jcImage.getLocation()).andReturn(location).atLeastOnce();
|
||||
|
||||
expect(instance.getInstanceType()).andReturn(InstanceType.C1_XLARGE).atLeastOnce();
|
||||
|
@ -342,7 +342,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce();
|
||||
|
||||
expect(instance.getImageId()).andReturn("imageId").atLeastOnce();
|
||||
expect(jcImage.getId()).andReturn("imageId").atLeastOnce();
|
||||
expect(jcImage.getProviderId()).andReturn("imageId").atLeastOnce();
|
||||
expect(jcImage.getLocation()).andReturn(location).atLeastOnce();
|
||||
|
||||
expect(instance.getInstanceType()).andReturn(InstanceType.C1_XLARGE).atLeastOnce();
|
||||
|
@ -401,7 +401,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
expect(instance.getRegion()).andReturn(Region.US_EAST_1).atLeastOnce();
|
||||
|
||||
expect(instance.getImageId()).andReturn("imageId").atLeastOnce();
|
||||
expect(jcImage.getId()).andReturn("imageId").atLeastOnce();
|
||||
expect(jcImage.getProviderId()).andReturn("imageId").atLeastOnce();
|
||||
expect(jcImage.getLocation()).andReturn(location).atLeastOnce();
|
||||
|
||||
expect(amiClient.describeImagesInRegion(Region.US_EAST_1, imageIds("imageId"))).andReturn(
|
||||
|
@ -472,7 +472,7 @@ public class RunningInstanceToNodeMetadataTest {
|
|||
expect(instance.getRegion()).andReturn(Region.US_EAST_1).atLeastOnce();
|
||||
|
||||
expect(instance.getImageId()).andReturn("imageId").atLeastOnce();
|
||||
expect(jcImage.getId()).andReturn("imageId").atLeastOnce();
|
||||
expect(jcImage.getProviderId()).andReturn("imageId").atLeastOnce();
|
||||
expect(jcImage.getLocation()).andReturn(location).atLeastOnce();
|
||||
|
||||
expect(amiClient.describeImagesInRegion(Region.US_EAST_1, imageIds("imageId"))).andReturn(
|
||||
|
|
|
@ -88,7 +88,7 @@ public class CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptionsTest {
|
|||
RunInstancesOptions runOptions = strategy.execute(region, tag, template);
|
||||
assertEquals(runOptions.buildQueryParameters(), ImmutableMultimap.<String, String> of());
|
||||
assertEquals(runOptions.buildFormParameters().entries(), ImmutableMultimap
|
||||
.<String, String> of("InstanceType", size.getId(), "SecurityGroup.1",
|
||||
.<String, String> of("InstanceType", size.getProviderId(), "SecurityGroup.1",
|
||||
generatedGroup, "AdditionalInfo", tag, "KeyName",
|
||||
systemGeneratedKeyPairName).entries());
|
||||
assertEquals(runOptions.buildMatrixParameters(), ImmutableMultimap.<String, String> of());
|
||||
|
|
|
@ -107,7 +107,7 @@ public class EC2RunNodesAndAddToSetStrategyTest {
|
|||
input.tag, input.template)).andReturn(ec2Options);
|
||||
expect(input.template.getLocation()).andReturn(input.location).atLeastOnce();
|
||||
expect(input.template.getImage()).andReturn(input.image).atLeastOnce();
|
||||
expect(input.image.getId()).andReturn(imageId).atLeastOnce();
|
||||
expect(input.image.getProviderId()).andReturn(imageId).atLeastOnce();
|
||||
expect(
|
||||
strategy.instanceClient.runInstancesInRegion(region, zone, imageId, 1, input.count,
|
||||
ec2Options)).andReturn(reservation);
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ComputeServiceContextToStatusResult implements Function<String, Sta
|
|||
long start = System.currentTimeMillis();
|
||||
Set<? extends ComputeMetadata> nodes = context.getComputeService().listNodes();
|
||||
if (nodes.size() > 0)
|
||||
name = Iterables.get(nodes, 0).getId();
|
||||
name = Iterables.get(nodes, 0).getProviderId();
|
||||
status = ((System.currentTimeMillis() - start) + "ms");
|
||||
} catch (Exception e) {
|
||||
logger.error(e, "Error listing service %s", contextName);
|
||||
|
|
|
@ -49,7 +49,7 @@ public interface StorageMetadata extends ResourceMetadata<StorageType> {
|
|||
* @see org.jclouds.blobstore.attr.ContainerCapability#CONTAINER_METADATA
|
||||
*/
|
||||
@Override
|
||||
String getId();
|
||||
String getProviderId();
|
||||
|
||||
/**
|
||||
* Name of this resource. Names are dictated by the user. For files, this may be the filename,
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ResourceMetadataToRelativePathResourceMetadata implements
|
|||
if (name.endsWith(suffix))
|
||||
name = name.substring(0, name.length() - suffix.length());
|
||||
}
|
||||
return new StorageMetadataImpl(StorageType.RELATIVE_PATH, md.getId(), name, md
|
||||
return new StorageMetadataImpl(StorageType.RELATIVE_PATH, md.getProviderId(), name, md
|
||||
.getLocation(), md.getUri(), md.getETag(), md.getSize(), md.getLastModified(), md
|
||||
.getUserMetadata());
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ public class BlobStoreUtilsImpl implements BlobStoreUtils {
|
|||
blob.getMetadata().setContentType(((BlobMetadata) blobMeta).getContentType());
|
||||
}
|
||||
blob.getMetadata().setETag(blobMeta.getETag());
|
||||
blob.getMetadata().setId(blobMeta.getId());
|
||||
blob.getMetadata().setId(blobMeta.getProviderId());
|
||||
blob.getMetadata().setLastModified(blobMeta.getLastModified());
|
||||
blob.getMetadata().setLocation(blobMeta.getLocation());
|
||||
blob.getMetadata().setUri(blobMeta.getUri());
|
||||
|
|
|
@ -47,7 +47,7 @@ public class BlobMetadataToRelativePathResourceMetadataTest {
|
|||
md.setId("dir/");
|
||||
StorageMetadata rd = parser.apply(md);
|
||||
assertEquals(rd.getName(), "dir");
|
||||
assertEquals(rd.getId(), "dir/");
|
||||
assertEquals(rd.getProviderId(), "dir/");
|
||||
assertEquals(rd.getType(), StorageType.RELATIVE_PATH);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class BlobMetadataToRelativePathResourceMetadataTest {
|
|||
md.setId("dir_$folder$");
|
||||
StorageMetadata rd = parser.apply(md);
|
||||
assertEquals(rd.getName(), "dir");
|
||||
assertEquals(rd.getId(), "dir_$folder$");
|
||||
assertEquals(rd.getProviderId(), "dir_$folder$");
|
||||
assertEquals(rd.getType(), StorageType.RELATIVE_PATH);
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class BlobMetadataToRelativePathResourceMetadataTest {
|
|||
md.setId("dir");
|
||||
StorageMetadata rd = parser.apply(md);
|
||||
assertEquals(rd.getName(), "dir");
|
||||
assertEquals(rd.getId(), "dir");
|
||||
assertEquals(rd.getProviderId(), "dir");
|
||||
assertEquals(rd.getType(), StorageType.RELATIVE_PATH);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,10 +207,10 @@ See http://code.google.com/p/jclouds for details."
|
|||
(first (run-nodes tag 1 template compute))))
|
||||
|
||||
(defn #^NodeMetadata node-details
|
||||
"Retrieve the node metadata, given its handle."
|
||||
([handle] (node-details handle *compute*))
|
||||
([handle #^ComputeService compute]
|
||||
(.getNodeMetadata compute handle)))
|
||||
"Retrieve the node metadata, given its id."
|
||||
([id] (node-details id *compute*))
|
||||
([id #^ComputeService compute]
|
||||
(.getNodeMetadata compute id)))
|
||||
|
||||
(defn reboot-nodes-with-tag
|
||||
"Reboot all the nodes with the given tag."
|
||||
|
@ -219,10 +219,10 @@ See http://code.google.com/p/jclouds for details."
|
|||
(.rebootNodesMatching compute (NodePredicates/withTag tag))))
|
||||
|
||||
(defn reboot-node
|
||||
"Reboot a node, given its handle."
|
||||
([handle] (reboot-node handle *compute*))
|
||||
([handle #^ComputeService compute]
|
||||
(.rebootNode compute handle)))
|
||||
"Reboot a node, given its id."
|
||||
([id] (reboot-node id *compute*))
|
||||
([id #^ComputeService compute]
|
||||
(.rebootNode compute id)))
|
||||
|
||||
(defn destroy-nodes-with-tag
|
||||
"Destroy all the nodes with the given tag."
|
||||
|
@ -231,10 +231,10 @@ See http://code.google.com/p/jclouds for details."
|
|||
(.destroyNodesMatching compute (NodePredicates/withTag tag))))
|
||||
|
||||
(defn destroy-node
|
||||
"Destroy a node, given its handle."
|
||||
([handle] (destroy-node handle *compute*))
|
||||
([handle #^ComputeService compute]
|
||||
(.destroyNode compute handle)))
|
||||
"Destroy a node, given its id."
|
||||
([id] (destroy-node id *compute*))
|
||||
([id #^ComputeService compute]
|
||||
(.destroyNode compute id)))
|
||||
|
||||
(defmacro state-predicate [node state]
|
||||
`(= (.getState ~node)
|
||||
|
@ -295,10 +295,10 @@ See http://code.google.com/p/jclouds for details."
|
|||
[#^ComputeMetadata node]
|
||||
(-?> node .getLocation .getId))
|
||||
|
||||
(defn handle
|
||||
"Returns the compute node's handle"
|
||||
(defn id
|
||||
"Returns the compute node's id"
|
||||
[#^ComputeMetadata node]
|
||||
(.getHandle node))
|
||||
(.getId node))
|
||||
|
||||
(define-accessors Template image size location options)
|
||||
(define-accessors Image version os-family os-description architecture)
|
||||
|
|
|
@ -48,7 +48,7 @@ public class RunNodesException extends Exception {
|
|||
.format(
|
||||
"error running %d node%s tag(%s) location(%s) image(%s) size(%s) options(%s)%n%s%n%s",
|
||||
count, count > 1 ? "s" : "", tag, template.getLocation().getId(),
|
||||
template.getImage().getId(), template.getSize().getId(), template
|
||||
template.getImage().getProviderId(), template.getSize().getProviderId(), template
|
||||
.getOptions(), ComputeUtils
|
||||
.createExecutionErrorMessage(executionExceptions),
|
||||
ComputeUtils.createNodeErrorMessage(failedNodes)));
|
||||
|
|
|
@ -37,11 +37,11 @@ public interface ComputeMetadata extends ResourceMetadata<ComputeType> {
|
|||
public ComputeType getType();
|
||||
|
||||
/**
|
||||
* unique id of the server. potentially generated by the service.
|
||||
* id of the server within the naming scope it was created. potentially generated by the service.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public String getId();
|
||||
public String getProviderId();
|
||||
|
||||
/**
|
||||
* user defined name of the server.
|
||||
|
@ -51,11 +51,12 @@ public interface ComputeMetadata extends ResourceMetadata<ComputeType> {
|
|||
public String getName();
|
||||
|
||||
/**
|
||||
*
|
||||
* A means to uniquely address this resource within a provider. For example, if the namespace of
|
||||
* a node or image is region based, the handle will likely include both the region and the id
|
||||
* encoded to avoid collisions.
|
||||
* a node or image is region based, the id will likely include both the region and the
|
||||
* provider-supplied id encoded to avoid collisions.
|
||||
*
|
||||
*/
|
||||
public String getHandle();
|
||||
public String getId();
|
||||
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class ComputeMetadataImpl extends ResourceMetadataImpl<ComputeType> imple
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getHandle() {
|
||||
public String getId() {
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ public class ImageImpl extends ComputeMetadataImpl implements Image {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[id=" + getId() + ", name=" + getName() + ", locationId=" + getLocation()
|
||||
return "[id=" + getProviderId() + ", name=" + getName() + ", locationId=" + getLocation()
|
||||
+ ", architecture=" + architecture + ", osDescription=" + osDescription
|
||||
+ ", osFamily=" + osFamily + ", version=" + version + "]";
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ public class NodeMetadataImpl extends ComputeMetadataImpl implements NodeMetadat
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[id=" + getId() + ", tag=" + getTag() + ", name=" + getName() + ", location="
|
||||
return "[id=" + getProviderId() + ", tag=" + getTag() + ", name=" + getName() + ", location="
|
||||
+ getLocation() + ", uri=" + getUri() + ", image=" + getImage() + ", userMetadata="
|
||||
+ getUserMetadata() + ", state=" + getState() + ", privateAddresses="
|
||||
+ privateAddresses + ", publicAddresses=" + publicAddresses + "]";
|
||||
|
|
|
@ -103,7 +103,7 @@ public class SizeImpl extends ComputeMetadataImpl implements Size {
|
|||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[id=" + getId() + ", cores=" + cores + ", ram=" + ram + ", disk=" + disk
|
||||
return "[id=" + getProviderId() + ", cores=" + cores + ", ram=" + ram + ", disk=" + disk
|
||||
+ ", supportedArchitectures=" + supportedArchitectures + "]";
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ public class BaseComputeService implements ComputeService {
|
|||
checkNotNull(template.getLocation(), "location");
|
||||
logger.debug(">> running %d node%s tag(%s) location(%s) image(%s) size(%s) options(%s)",
|
||||
count, count > 1 ? "s" : "", tag, template.getLocation().getId(), template
|
||||
.getImage().getId(), template.getSize().getId(), template.getOptions());
|
||||
.getImage().getProviderId(), template.getSize().getProviderId(), template.getOptions());
|
||||
Set<NodeMetadata> nodes = Sets.newHashSet();
|
||||
Map<NodeMetadata, Exception> badNodes = Maps.newLinkedHashMap();
|
||||
Map<?, ListenableFuture<Void>> responses = runNodesAndAddToSetStrategy.execute(tag, count,
|
||||
|
@ -201,7 +201,7 @@ public class BaseComputeService implements ComputeService {
|
|||
responses.put(node, makeListenable(executor.submit(new Callable<Void>() {
|
||||
@Override
|
||||
public Void call() throws Exception {
|
||||
destroyNode(node.getHandle());
|
||||
destroyNode(node.getId());
|
||||
destroyedNodes.add(node);
|
||||
return null;
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ public class BaseComputeService implements ComputeService {
|
|||
responses.put(node, makeListenable(executor.submit(new Callable<Void>() {
|
||||
@Override
|
||||
public Void call() throws Exception {
|
||||
rebootNode(node.getHandle());
|
||||
rebootNode(node.getId());
|
||||
return null;
|
||||
}
|
||||
}), executor));
|
||||
|
|
|
@ -125,7 +125,7 @@ public class TemplateBuilderImpl implements TemplateBuilder {
|
|||
public boolean apply(Image input) {
|
||||
boolean returnVal = true;
|
||||
if (imageId != null) {
|
||||
returnVal = imageId.equals(input.getId());
|
||||
returnVal = imageId.equals(input.getProviderId());
|
||||
// match our input params so that the later predicates pass.
|
||||
if (returnVal) {
|
||||
fromImage(input);
|
||||
|
@ -228,7 +228,7 @@ public class TemplateBuilderImpl implements TemplateBuilder {
|
|||
public boolean apply(Size input) {
|
||||
boolean returnVal = true;
|
||||
if (sizeId != null) {
|
||||
returnVal = sizeId.equals(input.getId());
|
||||
returnVal = sizeId.equals(input.getProviderId());
|
||||
// match our input params so that the later predicates pass.
|
||||
if (returnVal) {
|
||||
fromSize(input);
|
||||
|
|
|
@ -56,7 +56,7 @@ public class NodePredicates {
|
|||
return new Predicate<ComputeMetadata>() {
|
||||
@Override
|
||||
public boolean apply(@Nullable ComputeMetadata nodeMetadata) {
|
||||
return search.contains(nodeMetadata.getId());
|
||||
return search.contains(nodeMetadata.getProviderId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -93,14 +93,14 @@ public class EncodeTagIntoNameRunNodesAndAddToSetStrategy implements RunNodesAnd
|
|||
NodeMetadata node = null;
|
||||
logger.debug(">> starting node(%s) tag(%s)", name, tag);
|
||||
node = addNodeWithTagStrategy.execute(tag, name, template);
|
||||
logger.debug("<< running node(%s)", node.getId());
|
||||
logger.debug("<< running node(%s)", node.getProviderId());
|
||||
try {
|
||||
utils.runOptionsOnNode(node, template.getOptions());
|
||||
logger.debug("<< options applied node(%s)", node.getId());
|
||||
logger.debug("<< options applied node(%s)", node.getProviderId());
|
||||
nodes.add(node);
|
||||
} catch (Exception e) {
|
||||
logger.error(e, "<< error applying options (%s) on node (%s)", template
|
||||
.getOptions(), node.getId());
|
||||
.getOptions(), node.getProviderId());
|
||||
badNodes.put(node, e);
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -126,10 +126,10 @@ public class ComputeUtils {
|
|||
public Void call() throws Exception {
|
||||
try {
|
||||
runOptionsOnNode(node, options);
|
||||
logger.debug("<< options applied node(%s)", node.getId());
|
||||
logger.debug("<< options applied node(%s)", node.getProviderId());
|
||||
goodNodes.add(node);
|
||||
} catch (Exception e) {
|
||||
logger.error(e, "<< problem applying options to node(%s): ", node.getId(),
|
||||
logger.error(e, "<< problem applying options to node(%s): ", node.getProviderId(),
|
||||
Throwables.getRootCause(e).getMessage());
|
||||
badNodes.put(node, e);
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ public class ComputeUtils {
|
|||
int index = 1;
|
||||
for (Entry<? extends NodeMetadata, ? extends Throwable> errorMessage : failedNodes.entrySet()) {
|
||||
fmt.format("%s) %s on node %s:%n%s%n%n", index++, errorMessage.getValue().getClass()
|
||||
.getSimpleName(), errorMessage.getKey().getId(), Throwables
|
||||
.getSimpleName(), errorMessage.getKey().getProviderId(), Throwables
|
||||
.getStackTraceAsString(errorMessage.getValue()));
|
||||
}
|
||||
return fmt.format("%s error[s]", failedNodes.size()).toString();
|
||||
|
@ -222,7 +222,7 @@ public class ComputeUtils {
|
|||
public Map<SshCallable<?>, ?> runCallablesOnNode(NodeMetadata node,
|
||||
Iterable<? extends SshCallable<?>> parallel, @Nullable SshCallable<?> last) {
|
||||
checkState(this.sshFactory != null, "runScript requested, but no SshModule configured");
|
||||
checkNotNull(node.getCredentials().key, "credentials.key for node " + node.getId());
|
||||
checkNotNull(node.getCredentials().key, "credentials.key for node " + node.getProviderId());
|
||||
SshClient ssh = createSshClientOncePortIsListeningOnNode(node);
|
||||
try {
|
||||
ssh.connect();
|
||||
|
@ -465,7 +465,7 @@ public class ComputeUtils {
|
|||
* returns a new instance of {@link NodeMetadata} that has new credentials
|
||||
*/
|
||||
public static NodeMetadata installNewCredentials(NodeMetadata node, Credentials newCredentials) {
|
||||
return new NodeMetadataImpl(node.getId(), node.getName(), node.getHandle(), node
|
||||
return new NodeMetadataImpl(node.getProviderId(), node.getName(), node.getId(), node
|
||||
.getLocation(), node.getUri(), node.getUserMetadata(), node.getTag(), node
|
||||
.getImage(), node.getState(), node.getPublicAddresses(), node.getPrivateAddresses(),
|
||||
node.getExtra(), newCredentials);
|
||||
|
|
|
@ -163,7 +163,7 @@ public abstract class BaseComputeServiceLiveTest {
|
|||
@Test(enabled = true, dependsOnMethods = "testImagesCache")
|
||||
public void testTemplateMatch() throws Exception {
|
||||
template = buildTemplate(client.templateBuilder());
|
||||
Template toMatch = client.templateBuilder().imageId(template.getImage().getId()).build();
|
||||
Template toMatch = client.templateBuilder().imageId(template.getImage().getProviderId()).build();
|
||||
assertEquals(toMatch, template);
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ public abstract class BaseComputeServiceLiveTest {
|
|||
|
||||
protected void checkNodes(Iterable<? extends NodeMetadata> nodes, String tag) throws IOException {
|
||||
for (NodeMetadata node : nodes) {
|
||||
assertNotNull(node.getId());
|
||||
assertNotNull(node.getProviderId());
|
||||
assertNotNull(node.getTag());
|
||||
assertEquals(node.getTag(), tag);
|
||||
assertEquals(node.getState(), NodeState.RUNNING);
|
||||
|
@ -324,8 +324,8 @@ public abstract class BaseComputeServiceLiveTest {
|
|||
.withTag(tag), Predicates.not(NodePredicates.TERMINATED))));
|
||||
for (NodeMetadata node : nodes) {
|
||||
metadataSet.remove(node);
|
||||
NodeMetadata metadata = client.getNodeMetadata(node.getHandle());
|
||||
assertEquals(metadata.getId(), node.getId());
|
||||
NodeMetadata metadata = client.getNodeMetadata(node.getId());
|
||||
assertEquals(metadata.getProviderId(), node.getProviderId());
|
||||
assertEquals(metadata.getTag(), node.getTag());
|
||||
assertLocationSameOrChild(metadata.getLocation(), template.getLocation());
|
||||
assertEquals(metadata.getImage(), template.getImage());
|
||||
|
@ -353,7 +353,7 @@ public abstract class BaseComputeServiceLiveTest {
|
|||
|
||||
public void testListNodes() throws Exception {
|
||||
for (ComputeMetadata node : client.listNodes()) {
|
||||
assert node.getId() != null;
|
||||
assert node.getProviderId() != null;
|
||||
assert node.getLocation() != null;
|
||||
assertEquals(node.getType(), ComputeType.NODE);
|
||||
}
|
||||
|
@ -361,12 +361,12 @@ public abstract class BaseComputeServiceLiveTest {
|
|||
|
||||
public void testGetNodesWithDetails() throws Exception {
|
||||
for (NodeMetadata node : client.listNodesDetailsMatching(NodePredicates.all())) {
|
||||
assert node.getId() != null : node;
|
||||
assert node.getProviderId() != null : node;
|
||||
assert node.getLocation() != null : node;
|
||||
assertEquals(node.getType(), ComputeType.NODE);
|
||||
assert node instanceof NodeMetadata;
|
||||
NodeMetadata nodeMetadata = (NodeMetadata) node;
|
||||
assert nodeMetadata.getId() != null : nodeMetadata;
|
||||
assert nodeMetadata.getProviderId() != null : nodeMetadata;
|
||||
// nullable
|
||||
// assert nodeMetadata.getImage() != null : node;
|
||||
// user specified name is not always supported
|
||||
|
@ -382,7 +382,7 @@ public abstract class BaseComputeServiceLiveTest {
|
|||
|
||||
public void testListImages() throws Exception {
|
||||
for (Image image : client.listImages()) {
|
||||
assert image.getId() != null : image;
|
||||
assert image.getProviderId() != null : image;
|
||||
// image.getLocationId() can be null, if it is a location-free image
|
||||
assertEquals(image.getType(), ComputeType.IMAGE);
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ public abstract class BaseComputeServiceLiveTest {
|
|||
|
||||
public void testListSizes() throws Exception {
|
||||
for (Size size : client.listSizes()) {
|
||||
assert size.getId() != null;
|
||||
assert size.getProviderId() != null;
|
||||
assert size.getCores() > 0;
|
||||
assert size.getDisk() > 0;
|
||||
assert size.getRam() > 0;
|
||||
|
|
|
@ -44,7 +44,7 @@ public interface ResourceMetadata<T extends Enum<T>> extends Comparable<Resource
|
|||
* the resource. ex. /path/to/file.txt
|
||||
*
|
||||
*/
|
||||
String getId();
|
||||
String getProviderId();
|
||||
|
||||
/**
|
||||
* Name of this resource. Names are dictated by the user. For files, this may be the filename,
|
||||
|
|
|
@ -52,7 +52,7 @@ public class MutableResourceMetadataImpl<T extends Enum<T>> implements MutableRe
|
|||
|
||||
public MutableResourceMetadataImpl(ResourceMetadata<T> from) {
|
||||
this.type = from.getType();
|
||||
this.id = from.getId();
|
||||
this.id = from.getProviderId();
|
||||
this.name = from.getName();
|
||||
this.location = from.getLocation();
|
||||
this.uri = from.getUri();
|
||||
|
@ -89,7 +89,7 @@ public class MutableResourceMetadataImpl<T extends Enum<T>> implements MutableRe
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getId() {
|
||||
public String getProviderId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ public class ResourceMetadataImpl<T extends Enum<T>> implements ResourceMetadata
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getId() {
|
||||
public String getProviderId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
|
|
@ -316,7 +316,7 @@ public class GoGridComputeServiceContextModule extends GoGridContextModule {
|
|||
return new Function<ComputeMetadata, String>() {
|
||||
@Override
|
||||
public String apply(ComputeMetadata from) {
|
||||
return from.getId();
|
||||
return from.getProviderId();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class ServerToNodeMetadata implements Function<Server, NodeMetadata> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Image input) {
|
||||
return input.getId().equals(instance.getImage().getId() + "")
|
||||
return input.getProviderId().equals(instance.getImage().getId() + "")
|
||||
&& (input.getLocation() == null || input.getLocation().equals(location) || input
|
||||
.getLocation().equals(location.getParent()));
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ public class GoGridAddNodeWithTagStrategy implements AddNodeWithTagStrategy {
|
|||
private Server addServer(String name, Template template, Ip availableIp) {
|
||||
Server addedServer;
|
||||
addedServer = client.getServerServices().addServer(name,
|
||||
checkNotNull(template.getImage().getId()),
|
||||
checkNotNull(template.getImage().getProviderId()),
|
||||
sizeToRam.apply(template.getSize()), availableIp.getIp());
|
||||
return addedServer;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class ServerToNodeMetadataTest {
|
|||
ServerImage image = createMock(ServerImage.class);
|
||||
expect(server.getImage()).andReturn(image).atLeastOnce();
|
||||
expect(image.getId()).andReturn(2000l).atLeastOnce();
|
||||
expect(jcImage.getId()).andReturn("2000").atLeastOnce();
|
||||
expect(jcImage.getProviderId()).andReturn("2000").atLeastOnce();
|
||||
expect(jcImage.getLocation()).andReturn(location).atLeastOnce();
|
||||
|
||||
replay(client);
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ContainerToResourceList implements
|
|||
object2blobMd), new Function<BlobMetadata, StorageMetadata>() {
|
||||
public StorageMetadata apply(BlobMetadata input) {
|
||||
if (input.getContentType().equals("application/directory")) {
|
||||
return new StorageMetadataImpl(StorageType.RELATIVE_PATH, input.getId(), input
|
||||
return new StorageMetadataImpl(StorageType.RELATIVE_PATH, input.getProviderId(), input
|
||||
.getName(), input.getLocation(), input.getUri(), input.getETag(), input
|
||||
.getSize(), input.getLastModified(), input.getUserMetadata());
|
||||
}
|
||||
|
|
|
@ -190,8 +190,8 @@ public class CloudServersComputeServiceContextModule extends CloudServersContext
|
|||
|
||||
@Override
|
||||
public NodeMetadata execute(String tag, String name, Template template) {
|
||||
Server server = client.createServer(name, Integer.parseInt(template.getImage().getId()),
|
||||
Integer.parseInt(template.getSize().getId()));
|
||||
Server server = client.createServer(name, Integer.parseInt(template.getImage().getProviderId()),
|
||||
Integer.parseInt(template.getSize().getProviderId()));
|
||||
serverActive.apply(server);
|
||||
return new NodeMetadataImpl(server.getId() + "", name, server.getId() + "",
|
||||
new LocationImpl(LocationScope.HOST, server.getHostId(), server.getHostId(),
|
||||
|
@ -301,7 +301,7 @@ public class CloudServersComputeServiceContextModule extends CloudServersContext
|
|||
return new Function<ComputeMetadata, String>() {
|
||||
@Override
|
||||
public String apply(ComputeMetadata from) {
|
||||
return from.getId();
|
||||
return from.getProviderId();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public class ServerToNodeMetadata implements Function<Server, NodeMetadata> {
|
|||
|
||||
@Override
|
||||
public boolean apply(Image input) {
|
||||
return input.getId().equals(instance.getImageId() + "")
|
||||
return input.getProviderId().equals(instance.getImageId() + "")
|
||||
&& (input.getLocation() == null || input.getLocation().equals(
|
||||
location.getParent()));
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class ServerToNodeMetadataTest {
|
|||
expect(addresses.getPrivateAddresses()).andReturn(privateAddresses);
|
||||
|
||||
expect(server.getImageId()).andReturn(2000).atLeastOnce();
|
||||
expect(jcImage.getId()).andReturn("2000").atLeastOnce();
|
||||
expect(jcImage.getProviderId()).andReturn("2000").atLeastOnce();
|
||||
expect(jcImage.getLocation()).andReturn(provider).atLeastOnce();
|
||||
|
||||
replay(addresses);
|
||||
|
|
|
@ -190,7 +190,7 @@ public class RimuHostingComputeServiceContextModule extends RimuHostingContextMo
|
|||
@Override
|
||||
public NodeMetadata execute(String tag, String name, Template template) {
|
||||
NewServerResponse serverResponse = client.createServer(name, checkNotNull(template
|
||||
.getImage().getId(), "imageId"), checkNotNull(template.getSize().getId(),
|
||||
.getImage().getProviderId(), "imageId"), checkNotNull(template.getSize().getProviderId(),
|
||||
"sizeId"));
|
||||
serverRunning.apply(serverResponse.getServer());
|
||||
Server server = client.getServer(serverResponse.getServer().getId());
|
||||
|
@ -287,7 +287,7 @@ public class RimuHostingComputeServiceContextModule extends RimuHostingContextMo
|
|||
|
||||
@Override
|
||||
public boolean apply(Image input) {
|
||||
return input.getId().equals(instance.getImageId())
|
||||
return input.getProviderId().equals(instance.getImageId())
|
||||
&& (input.getLocation() == null || input.getLocation().equals(location) || input
|
||||
.getLocation().equals(location.getParent()));
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ public class RimuHostingComputeServiceContextModule extends RimuHostingContextMo
|
|||
return new Function<ComputeMetadata, String>() {
|
||||
@Override
|
||||
public String apply(ComputeMetadata from) {
|
||||
return from.getId();
|
||||
return from.getProviderId();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public class RimuHostingComputeServiceLiveTest extends BaseComputeServiceLiveTes
|
|||
assertEquals(defaultTemplate.getImage().getArchitecture(), Architecture.X86_64);
|
||||
assertEquals(defaultTemplate.getImage().getOsFamily(), OsFamily.UBUNTU);
|
||||
assertEquals(defaultTemplate.getLocation().getId(), "DCDALLAS");
|
||||
assertEquals(defaultTemplate.getSize().getId(), "MIRO1B");
|
||||
assertEquals(defaultTemplate.getSize().getProviderId(), "MIRO1B");
|
||||
assertEquals(defaultTemplate.getSize().getCores(), 1.0d);
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ public class ComputeTask extends Task {
|
|||
log(String
|
||||
.format(
|
||||
" image location=%s, id=%s, name=%s, version=%s, arch=%s, osfam=%s, osdesc=%s, desc=%s",
|
||||
image.getLocation(), image.getId(), image.getName(), image.getVersion(),
|
||||
image.getLocation(), image.getProviderId(), image.getName(), image.getVersion(),
|
||||
image.getArchitecture(), image.getOsFamily(), image.getOsDescription(),
|
||||
image.getDescription()));
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ public class ComputeTask extends Task {
|
|||
private void listSizes(ComputeService computeService) {
|
||||
log("list sizes");
|
||||
for (Size size : computeService.listSizes()) {// TODO
|
||||
log(String.format(" size id=%s, cores=%s, ram=%s, disk=%s", size.getId(), size
|
||||
log(String.format(" size id=%s, cores=%s, ram=%s, disk=%s", size.getProviderId(), size
|
||||
.getCores(), size.getRam(), size.getDisk()));
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ public class ComputeTask extends Task {
|
|||
private void list(ComputeService computeService) {
|
||||
log("list");
|
||||
for (ComputeMetadata node : computeService.listNodes()) {
|
||||
log(String.format(" location=%s, id=%s, tag=%s", node.getLocation(), node.getId(), node
|
||||
log(String.format(" location=%s, id=%s, tag=%s", node.getLocation(), node.getProviderId(), node
|
||||
.getName()));
|
||||
}
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ public class ComputeTask extends Task {
|
|||
|
||||
private void addNodeDetailsAsProjectProperties(NodeMetadata createdNode) {
|
||||
if (nodeElement.getIdproperty() != null)
|
||||
getProject().setProperty(nodeElement.getIdproperty(), createdNode.getId());
|
||||
getProject().setProperty(nodeElement.getIdproperty(), createdNode.getProviderId());
|
||||
if (nodeElement.getHostproperty() != null)
|
||||
getProject().setProperty(nodeElement.getHostproperty(),
|
||||
ipOrEmptyString(createdNode.getPublicAddresses()));
|
||||
|
@ -235,11 +235,11 @@ public class ComputeTask extends Task {
|
|||
|
||||
private void logDetails(ComputeService computeService, ComputeMetadata node) {
|
||||
NodeMetadata metadata = node instanceof NodeMetadata ? NodeMetadata.class.cast(node)
|
||||
: computeService.getNodeMetadata(node.getHandle());
|
||||
: computeService.getNodeMetadata(node.getId());
|
||||
log(String
|
||||
.format(
|
||||
" node id=%s, name=%s, tag=%s, location=%s, state=%s, publicIp=%s, privateIp=%s, extra=%s",
|
||||
metadata.getId(), metadata.getName(), metadata.getTag(), metadata
|
||||
metadata.getProviderId(), metadata.getName(), metadata.getTag(), metadata
|
||||
.getLocation(), metadata.getState(), ComputeTaskUtils
|
||||
.ipOrEmptyString(metadata.getPublicAddresses()),
|
||||
ipOrEmptyString(metadata.getPrivateAddresses()), metadata.getExtra()));
|
||||
|
|
|
@ -223,7 +223,7 @@ public class BlobStoreFileObject extends AbstractFileObject {
|
|||
|
||||
private void deleteBasedOnType() {
|
||||
if (metadata.getType() != StorageType.CONTAINER) {
|
||||
deleteBlob(metadata.getId());
|
||||
deleteBlob(metadata.getProviderId());
|
||||
} else {
|
||||
getBlobStore().deleteContainer(getContainer());
|
||||
logger.info(String.format("<< deleted container: %s", getContainer()));
|
||||
|
|
|
@ -207,7 +207,7 @@ public class VCloudComputeServiceContextModule extends VCloudContextModule {
|
|||
Double.valueOf(template.getSize().getCores()).intValue()).memory(
|
||||
template.getSize().getRam()).disk(template.getSize().getDisk() * 1024 * 1024l);
|
||||
Map<String, String> metaMap = computeClient.start(template.getLocation().getId(), name,
|
||||
template.getImage().getId(), options, template.getOptions().getInboundPorts());
|
||||
template.getImage().getProviderId(), options, template.getOptions().getInboundPorts());
|
||||
VApp vApp = client.getVApp(metaMap.get("id"));
|
||||
return newCreateNodeResponse(tag, template, metaMap, vApp);
|
||||
}
|
||||
|
@ -387,7 +387,7 @@ public class VCloudComputeServiceContextModule extends VCloudContextModule {
|
|||
return new Function<ComputeMetadata, String>() {
|
||||
@Override
|
||||
public String apply(ComputeMetadata from) {
|
||||
return from.getId();
|
||||
return from.getProviderId();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ public class VCloudGetNodeMetadata {
|
|||
|
||||
@Override
|
||||
public boolean apply(Image input) {
|
||||
return input.getId().equals(templateId) && input.getLocation().equals(location);
|
||||
return input.getProviderId().equals(templateId) && input.getLocation().equals(location);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -61,7 +61,7 @@ public class EncodeTemplateIdIntoNameRunNodesAndAddToSetStrategy extends
|
|||
@Override
|
||||
protected String getNextName(final String tag, final Template template) {
|
||||
return String.format(nodeNamingConvention, tag, Strings.padStart(Integer.toHexString(Integer
|
||||
.parseInt(template.getImage().getId())), 3, '0'), Strings.padStart(Integer
|
||||
.parseInt(template.getImage().getProviderId())), 3, '0'), Strings.padStart(Integer
|
||||
.toHexString(random.nextInt(255)), 2, '0'));
|
||||
}
|
||||
}
|
|
@ -45,10 +45,10 @@ public class VCloudComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
|||
@Override
|
||||
public void testListNodes() throws Exception {
|
||||
for (ComputeMetadata node : client.listNodes()) {
|
||||
assert node.getId() != null;
|
||||
assert node.getProviderId() != null;
|
||||
assert node.getLocation() != null;
|
||||
assertEquals(node.getType(), ComputeType.NODE);
|
||||
NodeMetadata allData = client.getNodeMetadata(node.getHandle());
|
||||
NodeMetadata allData = client.getNodeMetadata(node.getId());
|
||||
assert allData.getExtra().get("processor/count") != null;
|
||||
assert allData.getExtra().get("disk_drive/1/kb") != null;
|
||||
assert allData.getExtra().get("memory/mb") != null;
|
||||
|
|
|
@ -52,7 +52,7 @@ public class EncodeTemplateIdIntoNameRunNodesAndAddToSetStrategyTest {
|
|||
Template template = createMock(Template.class);
|
||||
Image image = createMock(Image.class);
|
||||
expect(template.getImage()).andReturn(image);
|
||||
expect(image.getId()).andReturn("233");
|
||||
expect(image.getProviderId()).andReturn("233");
|
||||
replay(template);
|
||||
replay(image);
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ public class TerremarkVCloudComputeServiceContextModule extends VCloudComputeSer
|
|||
Image anyImage = Iterables.get(images, 0);
|
||||
holder.logger.debug(">> providing sizes");
|
||||
SortedSet<Size> sizes = Sets.newTreeSet(Iterables.transform(TerremarkVCloudClient.class.cast(
|
||||
client).getComputeOptionsOfCatalogItem(anyImage.getId()), sizeConverter));
|
||||
client).getComputeOptionsOfCatalogItem(anyImage.getProviderId()), sizeConverter));
|
||||
holder.logger.debug("<< sizes(%d)", sizes.size());
|
||||
return sizes;
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class TerremarkVCloudComputeServiceLiveTest extends VCloudComputeServiceL
|
|||
@Override
|
||||
public void testListImages() throws Exception {
|
||||
for (Image image : client.listImages()) {
|
||||
assert image.getId() != null : image;
|
||||
assert image.getProviderId() != null : image;
|
||||
// image.getLocationId() can be null, if it is a location-free image
|
||||
assertEquals(image.getType(), ComputeType.IMAGE);
|
||||
assert image.getDefaultCredentials().account != null : image;
|
||||
|
|
Loading…
Reference in New Issue