improvements on glesys

This commit is contained in:
Adrian Cole 2012-02-09 05:32:15 +01:00
parent aaaced142f
commit e3d3d93fa9
6 changed files with 28 additions and 7 deletions

View File

@ -158,7 +158,7 @@ public class GleSYSComputeServiceAdapter implements ComputeServiceAdapter<Server
if (templatesSupported.size() > 0) if (templatesSupported.size() > 0)
hardwareToReturn.add(new HardwareBuilder().ids( hardwareToReturn.add(new HardwareBuilder().ids(
String.format("datacenter(%s)platform(%s)cpuCores(%d)memorySizeMB(%d)diskSizeGB(%d)", String.format("datacenter(%s)platform(%s)cpuCores(%d)memorySizeMB(%d)diskSizeGB(%d)",
datacenter, platformToArgs.getKey(), cpuCores, cpuCores, diskSizeGB)).ram( datacenter, platformToArgs.getKey(), cpuCores, memorySizeMB, diskSizeGB)).ram(
memorySizeMB).processors(ImmutableList.of(new Processor(cpuCores, 1.0))).volumes( memorySizeMB).processors(ImmutableList.of(new Processor(cpuCores, 1.0))).volumes(
ImmutableList.<Volume> of(new VolumeImpl((float) diskSizeGB, true, true))).hypervisor( ImmutableList.<Volume> of(new VolumeImpl((float) diskSizeGB, true, true))).hypervisor(
platformToArgs.getKey()).location( platformToArgs.getKey()).location(

View File

@ -102,7 +102,8 @@ public class ServerDetailsToNodeMetadata implements Function<ServerDetails, Node
builder.ids(from.getId() + ""); builder.ids(from.getId() + "");
builder.name(from.getHostname()); builder.name(from.getHostname());
builder.hostname(from.getHostname()); builder.hostname(from.getHostname());
builder.location(findLocationForServerDetails.apply(from)); Location location = findLocationForServerDetails.apply(from);
assert (location != null) : String.format("no location matched ServerDetails %s", from);
builder.group(parseGroupFromName(from.getHostname())); builder.group(parseGroupFromName(from.getHostname()));
builder.imageId(from.getTemplateName() + ""); builder.imageId(from.getTemplateName() + "");
builder.operatingSystem(parseOperatingSystem(from)); builder.operatingSystem(parseOperatingSystem(from));

View File

@ -29,6 +29,7 @@ import org.jclouds.compute.domain.Processor;
import org.jclouds.compute.domain.Volume; import org.jclouds.compute.domain.Volume;
import org.jclouds.compute.domain.internal.VolumeImpl; import org.jclouds.compute.domain.internal.VolumeImpl;
import org.jclouds.compute.predicates.ImagePredicates; import org.jclouds.compute.predicates.ImagePredicates;
import org.jclouds.domain.Location;
import org.jclouds.glesys.domain.ServerSpec; import org.jclouds.glesys.domain.ServerSpec;
import com.google.common.base.Function; import com.google.common.base.Function;
@ -50,10 +51,12 @@ public class ServerSpecToHardware implements Function<ServerSpec, Hardware> {
@Override @Override
public Hardware apply(ServerSpec spec) { public Hardware apply(ServerSpec spec) {
Location location = findLocationForServerSpec.apply(spec);
assert (location != null) : String.format("no location matched ServerSpec %s", spec);
return new HardwareBuilder().ids(spec.toString()).ram(spec.getMemorySizeMB()).processors( return new HardwareBuilder().ids(spec.toString()).ram(spec.getMemorySizeMB()).processors(
ImmutableList.of(new Processor(spec.getCpuCores(), 1.0))).volumes( ImmutableList.of(new Processor(spec.getCpuCores(), 1.0))).volumes(
ImmutableList.<Volume> of(new VolumeImpl((float) spec.getDiskSizeGB(), true, true))).hypervisor( ImmutableList.<Volume> of(new VolumeImpl((float) spec.getDiskSizeGB(), true, true))).hypervisor(
spec.getPlatform()).location(findLocationForServerSpec.apply(spec)).supportsImage( spec.getPlatform()).location(location).supportsImage(
ImagePredicates.idEquals(spec.getTemplateName())).build(); ImagePredicates.idEquals(spec.getTemplateName())).build();
} }
} }

View File

@ -22,7 +22,16 @@ import java.util.Map;
import org.jclouds.glesys.GleSYSAsyncClient; import org.jclouds.glesys.GleSYSAsyncClient;
import org.jclouds.glesys.GleSYSClient; import org.jclouds.glesys.GleSYSClient;
import org.jclouds.glesys.features.*; import org.jclouds.glesys.features.ArchiveAsyncClient;
import org.jclouds.glesys.features.ArchiveClient;
import org.jclouds.glesys.features.DomainAsyncClient;
import org.jclouds.glesys.features.DomainClient;
import org.jclouds.glesys.features.EmailAsyncClient;
import org.jclouds.glesys.features.EmailClient;
import org.jclouds.glesys.features.IpAsyncClient;
import org.jclouds.glesys.features.IpClient;
import org.jclouds.glesys.features.ServerAsyncClient;
import org.jclouds.glesys.features.ServerClient;
import org.jclouds.glesys.handlers.GleSYSErrorHandler; import org.jclouds.glesys.handlers.GleSYSErrorHandler;
import org.jclouds.http.HttpErrorHandler; import org.jclouds.http.HttpErrorHandler;
import org.jclouds.http.HttpRetryHandler; import org.jclouds.http.HttpRetryHandler;
@ -31,10 +40,13 @@ import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection; import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError; import org.jclouds.http.annotation.ServerError;
import org.jclouds.http.handlers.BackoffLimitedRetryHandler; import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
import org.jclouds.location.suppliers.ImplicitLocationSupplier;
import org.jclouds.location.suppliers.implicit.OnlyLocationOrFirstZone;
import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.config.RestClientModule; import org.jclouds.rest.config.RestClientModule;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.inject.Scopes;
/** /**
* Configures the GleSYS connection. * Configures the GleSYS connection.
@ -74,5 +86,10 @@ public class GleSYSRestClientModule extends RestClientModule<GleSYSClient, GleSY
protected void bindRetryHandlers() { protected void bindRetryHandlers() {
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(BackoffLimitedRetryHandler.class); bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(BackoffLimitedRetryHandler.class);
} }
@Override
protected void installLocations() {
super.installLocations();
bind(ImplicitLocationSupplier.class).to(OnlyLocationOrFirstZone.class).in(Scopes.SINGLETON);
}
} }

View File

@ -1 +1 @@
{"response":{"status":{"code":200,"text":"OK"},"argumentslist":{"Xen":{"disksize":["5","10","20","30","40","50","80","100","120","140","150","160","160","200","250","300"],"memorysize":["512","768","1024","1536","2048","2560","3072","3584","4096","5120","6144","7168","8192","9216","10240","11264","12288","14336","16384"],"cpucores":["1","2","3","4","5","6","7","8"],"template":["CentOS 5.5 x64","CentOS 5.5 x86","Centos 6 x64","Centos 6 x86","Debian-6 x64","Debian 5.0.1 x64","FreeBSD 8.2","Gentoo 10.1 x64","Ubuntu 8.04 x64","Ubuntu 10.04 LTS 64-bit","Ubuntu 10.10 x64","Ubuntu 11.04 x64","Windows Server 2008 R2 x64 std","Windows Server 2008 R2 x64 web","Windows Server 2008 x64 web","Windows Server 2008 x86 web"],"transfer":["50","100","250","500","1000","2000","3000","4000","5000","6000","7000","8000","9000","10000"],"datacenter":["Falkenberg"]},"OpenVZ":{"disksize":["5","10","20","30","40","50","60","70","80","90","100","120","140","150"],"memorysize":["128","256","512","768","1024","1536","2048","2560","3072","3584","4096","5120","6144","7168","8192","9216","10240","11264","12288"],"cpucores":["1","2","3","4","5","6","7","8"],"template":["Centos 5","Centos 5 64-bit","Centos 6 32-bit","Centos 6 64-bit","Debian 5.0 32-bit","Debian 5.0 64-bit","Debian 6.0 32-bit","Debian 6.0 64-bit","Fedora Core 11","Fedora Core 11 64-bit","Gentoo","Gentoo 64-bit","Scientific Linux 6","Scientific Linux 6 64-bit","Slackware 12","Ubuntu 10.04 LTS 32-bit","Ubuntu 10.04 LTS 64-bit","Ubuntu 11.04 64-bit"],"transfer":["50","100","250","500","1000","2000","3000","4000","5000","6000","7000","8000","9000","10000"],"datacenter":["Amsterdam","Falkenberg","New York City","Stockholm"]}},"debug":{"input":[]}}} {"response":{"status":{"code":200,"timestamp":"2012-02-08T17:07:38+01:00","text":"OK"},"argumentslist":{"Xen":{"disksize":[5,10,20,30,40,50,80,100,120,140,150,160,160,200,250,300],"memorysize":[512,768,1024,1536,2048,2560,3072,3584,4096,5120,6144,7168,8192,9216,10240,11264,12288,14336,16384],"cpucores":[1,2,3,4,5,6,7,8],"template":["CentOS 5.5 x64","CentOS 5.5 x86","Centos 6 x64","Centos 6 x86","Debian-6 x64","Debian 5.0.1 x64","FreeBSD 8.2","Gentoo 10.1 x64","Ubuntu 8.04 x64","Ubuntu 10.04 LTS 64-bit","Ubuntu 10.10 x64","Ubuntu 11.04 x64","Windows Server 2008 R2 x64 std","Windows Server 2008 R2 x64 web","Windows Server 2008 x64 web","Windows Server 2008 x86 web"],"transfer":[50,100,250,500,1000,2000,3000,4000,5000,6000,7000,8000,9000,10000],"datacenter":["Falkenberg"]},"OpenVZ":{"disksize":[5,10,20,30,40,50,60,70,80,90,100,120,140,150],"memorysize":[128,256,512,768,1024,1536,2048,2560,3072,3584,4096,5120,6144,7168,8192,9216,10240,11264,12288],"cpucores":[1,2,3,4,5,6,7,8],"template":["Centos 5","Centos 5 64-bit","Centos 6 32-bit","Centos 6 64-bit","Debian 5.0 32-bit","Debian 5.0 64-bit","Debian 6.0 32-bit","Debian 6.0 64-bit","Fedora Core 11","Fedora Core 11 64-bit","Gentoo","Gentoo 64-bit","Scientific Linux 6","Scientific Linux 6 64-bit","Slackware 12","Ubuntu 10.04 LTS 32-bit","Ubuntu 10.04 LTS 64-bit","Ubuntu 11.04 64-bit"],"transfer":[50,100,250,500,1000,2000,3000,4000,5000,6000,7000,8000,9000,10000],"datacenter":["Amsterdam","Falkenberg","New York City","Stockholm"]}},"debug":{"input":[]}}}

View File

@ -1 +1 @@
{"response":{"status":{"code":200,"text":"OK"},"templates":{"OpenVZ":[{"name":"Centos 5","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"},{"name":"Centos 5 64-bit","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"},{"name":"Centos 6 32-bit","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"},{"name":"Centos 6 64-bit","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"},{"name":"Debian 5.0 32-bit","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"},{"name":"Debian 5.0 64-bit","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"},{"name":"Debian 6.0 32-bit","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"},{"name":"Debian 6.0 64-bit","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"},{"name":"Fedora Core 11","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"},{"name":"Fedora Core 11 64-bit","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"},{"name":"Gentoo","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"},{"name":"Gentoo 64-bit","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"},{"name":"Scientific Linux 6","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"},{"name":"Scientific Linux 6 64-bit","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"},{"name":"Slackware 12","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"},{"name":"Ubuntu 10.04 LTS 32-bit","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"},{"name":"Ubuntu 10.04 LTS 64-bit","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"},{"name":"Ubuntu 11.04 64-bit","minimumdisksize":"5","minimummemorysize":"128","operatingsystem":"linux","platform":"OpenVZ"}],"Xen":[{"name":"CentOS 5.5 x64","minimumdisksize":"5","minimummemorysize":"512","operatingsystem":"linux","platform":"Xen"},{"name":"CentOS 5.5 x86","minimumdisksize":"5","minimummemorysize":"512","operatingsystem":"linux","platform":"Xen"},{"name":"Centos 6 x64","minimumdisksize":"5","minimummemorysize":"512","operatingsystem":"linux","platform":"Xen"},{"name":"Centos 6 x86","minimumdisksize":"5","minimummemorysize":"512","operatingsystem":"linux","platform":"Xen"},{"name":"Debian-6 x64","minimumdisksize":"5","minimummemorysize":"512","operatingsystem":"linux","platform":"Xen"},{"name":"Debian 5.0.1 x64","minimumdisksize":"5","minimummemorysize":"512","operatingsystem":"linux","platform":"Xen"},{"name":"FreeBSD 8.2","minimumdisksize":"5","minimummemorysize":"512","operatingsystem":"freebsd","platform":"Xen"},{"name":"Gentoo 10.1 x64","minimumdisksize":"5","minimummemorysize":"512","operatingsystem":"linux","platform":"Xen"},{"name":"Ubuntu 8.04 x64","minimumdisksize":"5","minimummemorysize":"512","operatingsystem":"linux","platform":"Xen"},{"name":"Ubuntu 10.04 LTS 64-bit","minimumdisksize":"5","minimummemorysize":"512","operatingsystem":"linux","platform":"Xen"},{"name":"Ubuntu 10.10 x64","minimumdisksize":"5","minimummemorysize":"512","operatingsystem":"linux","platform":"Xen"},{"name":"Ubuntu 11.04 x64","minimumdisksize":"5","minimummemorysize":"512","operatingsystem":"linux","platform":"Xen"},{"name":"Windows Server 2008 R2 x64 std","minimumdisksize":"20","minimummemorysize":"1024","operatingsystem":"windows","platform":"Xen"},{"name":"Windows Server 2008 R2 x64 web","minimumdisksize":"20","minimummemorysize":"1024","operatingsystem":"windows","platform":"Xen"},{"name":"Windows Server 2008 x64 web","minimumdisksize":"20","minimummemorysize":"1024","operatingsystem":"windows","platform":"Xen"},{"name":"Windows Server 2008 x86 web","minimumdisksize":"20","minimummemorysize":"1024","operatingsystem":"windows","platform":"Xen"}]},"debug":{"input":[]}}} {"response":{"status":{"code":200,"timestamp":"2012-02-08T17:07:37+01:00","text":"OK"},"templates":{"OpenVZ":[{"name":"Centos 5","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"},{"name":"Centos 5 64-bit","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"},{"name":"Centos 6 32-bit","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"},{"name":"Centos 6 64-bit","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"},{"name":"Debian 5.0 32-bit","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"},{"name":"Debian 5.0 64-bit","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"},{"name":"Debian 6.0 32-bit","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"},{"name":"Debian 6.0 64-bit","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"},{"name":"Fedora Core 11","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"},{"name":"Fedora Core 11 64-bit","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"},{"name":"Gentoo","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"},{"name":"Gentoo 64-bit","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"},{"name":"Scientific Linux 6","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"},{"name":"Scientific Linux 6 64-bit","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"},{"name":"Slackware 12","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"},{"name":"Ubuntu 10.04 LTS 32-bit","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"},{"name":"Ubuntu 10.04 LTS 64-bit","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"},{"name":"Ubuntu 11.04 64-bit","minimumdisksize":5,"minimummemorysize":128,"operatingsystem":"linux","platform":"OpenVZ"}],"Xen":[{"name":"CentOS 5.5 x64","minimumdisksize":5,"minimummemorysize":512,"operatingsystem":"linux","platform":"Xen"},{"name":"CentOS 5.5 x86","minimumdisksize":5,"minimummemorysize":512,"operatingsystem":"linux","platform":"Xen"},{"name":"Centos 6 x64","minimumdisksize":5,"minimummemorysize":512,"operatingsystem":"linux","platform":"Xen"},{"name":"Centos 6 x86","minimumdisksize":5,"minimummemorysize":512,"operatingsystem":"linux","platform":"Xen"},{"name":"Debian-6 x64","minimumdisksize":5,"minimummemorysize":512,"operatingsystem":"linux","platform":"Xen"},{"name":"Debian 5.0.1 x64","minimumdisksize":5,"minimummemorysize":512,"operatingsystem":"linux","platform":"Xen"},{"name":"FreeBSD 8.2","minimumdisksize":5,"minimummemorysize":512,"operatingsystem":"freebsd","platform":"Xen"},{"name":"Gentoo 10.1 x64","minimumdisksize":5,"minimummemorysize":512,"operatingsystem":"linux","platform":"Xen"},{"name":"Ubuntu 8.04 x64","minimumdisksize":5,"minimummemorysize":512,"operatingsystem":"linux","platform":"Xen"},{"name":"Ubuntu 10.04 LTS 64-bit","minimumdisksize":5,"minimummemorysize":512,"operatingsystem":"linux","platform":"Xen"},{"name":"Ubuntu 10.10 x64","minimumdisksize":5,"minimummemorysize":512,"operatingsystem":"linux","platform":"Xen"},{"name":"Ubuntu 11.04 x64","minimumdisksize":5,"minimummemorysize":512,"operatingsystem":"linux","platform":"Xen"},{"name":"Windows Server 2008 R2 x64 std","minimumdisksize":20,"minimummemorysize":1024,"operatingsystem":"windows","platform":"Xen"},{"name":"Windows Server 2008 R2 x64 web","minimumdisksize":20,"minimummemorysize":1024,"operatingsystem":"windows","platform":"Xen"},{"name":"Windows Server 2008 x64 web","minimumdisksize":20,"minimummemorysize":1024,"operatingsystem":"windows","platform":"Xen"},{"name":"Windows Server 2008 x86 web","minimumdisksize":20,"minimummemorysize":1024,"operatingsystem":"windows","platform":"Xen"}]},"debug":{"input":[]}}}