mirror of https://github.com/apache/jclouds.git
Issue 130: added size and image to ant config
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2723 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
aa41f4512b
commit
b7f9426a02
|
@ -33,7 +33,7 @@ import com.google.common.base.CaseFormat;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
public enum OsFamily {
|
||||
CENTOS, RHEL, FEDORA, DEBIAN, UBUNTU, JEOS, WINDOWS;
|
||||
CENTOS, RHEL, FEDORA, DEBIAN, UBUNTU, JEOS, ARCH, GENTOO, WINDOWS;
|
||||
public String value() {
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
||||
}
|
||||
|
|
|
@ -91,8 +91,8 @@ public class CloudServersComputeServiceContextModule extends CloudServersContext
|
|||
holder.logger.debug(">> providing sizes");
|
||||
for (final Flavor from : sync.listFlavors(ListOptions.Builder.withDetails())) {
|
||||
sizes.add(new CloudServersSize(from, from.getId() + "", from.getDisk() / 10,
|
||||
from .getRam(), from.getDisk(), ImmutableSet.<Architecture> of(Architecture.X86_32,
|
||||
Architecture.X86_64)));
|
||||
from.getRam(), from.getDisk(), ImmutableSet.<Architecture> of(
|
||||
Architecture.X86_32, Architecture.X86_64)));
|
||||
}
|
||||
holder.logger.debug("<< sizes(%d)", sizes.size());
|
||||
return sizes;
|
||||
|
@ -121,10 +121,12 @@ public class CloudServersComputeServiceContextModule extends CloudServersContext
|
|||
String version = "";
|
||||
|
||||
Matcher matcher = RACKSPACE_PATTERN.matcher(from.getName());
|
||||
if (matcher.find()) {
|
||||
osDescription = from.getName();
|
||||
if (from.getName().indexOf("Red Hat EL") != -1) {
|
||||
os = OsFamily.RHEL;
|
||||
} else if (matcher.find()) {
|
||||
try {
|
||||
os = OsFamily.fromValue(matcher.group(2).toLowerCase());
|
||||
osDescription = matcher.group(1);
|
||||
} catch (IllegalArgumentException e) {
|
||||
holder.logger.debug("<< didn't match os(%s)", matcher.group(2));
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
|
||||
<target name="create" description="create the node ${nodename}" depends="destroy" >
|
||||
<compute action="create" provider="${url}">
|
||||
<node name="${nodename}" os="JEOS" size="SMALLEST"
|
||||
<node name="${nodename}" os="UBUNTU" size="SMALLEST"
|
||||
runscript="runscript.sh" openports="22,${listenport}"
|
||||
hostproperty="host" usernameproperty="username" passwordproperty="password" />
|
||||
</compute>
|
||||
|
|
|
@ -69,6 +69,14 @@
|
|||
<compute action="list-details" provider="${jclouds.compute.url}" />
|
||||
</target>
|
||||
|
||||
<target name="list-images" description="list the images supported">
|
||||
<compute action="list-images" provider="${jclouds.compute.url}" />
|
||||
</target>
|
||||
|
||||
<target name="list-sizes" description="list the sizes supported">
|
||||
<compute action="list-sizes" provider="${jclouds.compute.url}" />
|
||||
</target>
|
||||
|
||||
<target name="destroy" description="destroy the node ${nodename}">
|
||||
|
||||
<input
|
||||
|
|
|
@ -40,7 +40,9 @@ import org.jclouds.compute.ComputeService;
|
|||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.compute.domain.ComputeMetadata;
|
||||
import org.jclouds.compute.domain.CreateNodeResponse;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.Size;
|
||||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.compute.options.RunNodeOptions;
|
||||
import org.jclouds.http.HttpUtils;
|
||||
|
@ -80,7 +82,7 @@ public class ComputeTask extends Task {
|
|||
}
|
||||
|
||||
public static enum Action {
|
||||
CREATE, GET, LIST, LIST_DETAILS, DESTROY
|
||||
CREATE, GET, LIST, LIST_DETAILS, DESTROY, LIST_IMAGES, LIST_SIZES
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,6 +126,12 @@ public class ComputeTask extends Task {
|
|||
case LIST_DETAILS:
|
||||
listDetails(computeService);
|
||||
break;
|
||||
case LIST_IMAGES:
|
||||
listImages(computeService);
|
||||
break;
|
||||
case LIST_SIZES:
|
||||
listSizes(computeService);
|
||||
break;
|
||||
default:
|
||||
this.log("bad action: " + action, Project.MSG_ERR);
|
||||
}
|
||||
|
@ -137,6 +145,23 @@ public class ComputeTask extends Task {
|
|||
}
|
||||
}
|
||||
|
||||
private void listImages(ComputeService computeService) {
|
||||
log("list images");
|
||||
for (Image image : computeService.listImages()) {// TODO
|
||||
log(String.format(" image location=%s, id=%s, version=%s, arch=%s, osfam=%s, desc=%s",
|
||||
image.getLocation(), image.getId(), image.getVersion(), image.getArchitecture(),
|
||||
image.getOsFamily(), image.getOsDescription()));
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
.getCores(), size.getRam(), size.getDisk()));
|
||||
}
|
||||
}
|
||||
|
||||
private void list(ComputeService computeService) {
|
||||
log("list");
|
||||
for (ComputeMetadata node : computeService.listNodes()) {
|
||||
|
|
Loading…
Reference in New Issue