From f4f86edd4daac5f46329f216457e1df361eb1e7a Mon Sep 17 00:00:00 2001 From: Stuart Hendren Date: Thu, 11 Sep 2014 10:15:57 +0100 Subject: [PATCH] JCLOUDS-703: Google Hardware no longer supports images --- .../MachineTypeInZoneToHardware.java | 7 +------ .../domain/MachineType.java | 20 ++++--------------- .../GoogleComputeEngineServiceExpectTest.java | 2 +- .../parse/ParseMachineTypeListTest.java | 3 --- .../parse/ParseMachineTypeTest.java | 1 - .../src/test/resources/machinetype.json | 1 - .../src/test/resources/machinetype_list.json | 3 --- .../resources/machinetype_list_central1b.json | 2 -- 8 files changed, 6 insertions(+), 33 deletions(-) diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/MachineTypeInZoneToHardware.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/MachineTypeInZoneToHardware.java index ddf8cab4c2..08ba6d5aa6 100644 --- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/MachineTypeInZoneToHardware.java +++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/MachineTypeInZoneToHardware.java @@ -39,7 +39,6 @@ import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.base.Predicates; import com.google.common.base.Supplier; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.inject.Inject; @@ -68,7 +67,6 @@ public class MachineTypeInZoneToHardware implements Function 0 - ? Predicates.alwaysTrue() - : Predicates.alwaysFalse()) + .supportsImage(Predicates.alwaysTrue()) .build(); } diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java index cc00c25ffb..eb59b7d8a5 100644 --- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java +++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java @@ -43,7 +43,6 @@ public final class MachineType extends Resource { private final Integer guestCpus; private final Integer memoryMb; - private final Integer imageSpaceGb; private final List scratchDisks; private final Integer maximumPersistentDisks; private final Long maximumPersistentDisksSizeGb; @@ -52,17 +51,15 @@ public final class MachineType extends Resource { @ConstructorProperties({ "id", "creationTimestamp", "selfLink", "name", "description", "guestCpus", "memoryMb", - "imageSpaceGb", "scratchDisks", "maximumPersistentDisks", "maximumPersistentDisksSizeGb", "zone", - "deprecated" + "scratchDisks", "maximumPersistentDisks", "maximumPersistentDisksSizeGb", "zone", "deprecated" }) private MachineType(String id, Date creationTimestamp, URI selfLink, String name, String description, - int guestCpus, int memoryMb, int imageSpaceGb, List scratchDisks, + int guestCpus, int memoryMb, List scratchDisks, int maximumPersistentDisks, long maximumPersistentDisksSizeGb, String zone, @Nullable Deprecated deprecated) { super(Kind.MACHINE_TYPE, id, creationTimestamp, selfLink, name, description); this.guestCpus = checkNotNull(guestCpus, "guestCpus of %s", name); this.memoryMb = checkNotNull(memoryMb, "memoryMb of %s", name); - this.imageSpaceGb = checkNotNull(imageSpaceGb, "imageSpaceGb of %s", name); this.scratchDisks = scratchDisks == null ? ImmutableList.of() : scratchDisks; this.maximumPersistentDisks = checkNotNull(maximumPersistentDisks, "maximumPersistentDisks of %s", name); this.maximumPersistentDisksSizeGb = maximumPersistentDisksSizeGb; @@ -84,13 +81,6 @@ public final class MachineType extends Resource { return memoryMb; } - /** - * @return space allotted for the image, defined in GB. - */ - public int getImageSpaceGb() { - return imageSpaceGb; - } - /** * @return extended scratch disks assigned to the instance. */ @@ -147,7 +137,6 @@ public final class MachineType extends Resource { return super.string() .add("guestCpus", guestCpus) .add("memoryMb", memoryMb) - .add("imageSpaceGb", imageSpaceGb) .add("scratchDisks", scratchDisks) .add("maximumPersistentDisks", maximumPersistentDisks) .add("maximumPersistentDisksSizeGb", maximumPersistentDisksSizeGb) @@ -261,13 +250,12 @@ public final class MachineType extends Resource { public MachineType build() { return new MachineType(id, creationTimestamp, selfLink, name, description, guestCpus, memoryMb, - imageSpaceGb, scratchDisks.build(), maximumPersistentDisks, maximumPersistentDisksSizeGb, - zone, deprecated); + scratchDisks.build(), maximumPersistentDisks, maximumPersistentDisksSizeGb, zone, deprecated); } public Builder fromMachineType(MachineType in) { - return super.fromResource(in).memoryMb(in.getMemoryMb()).imageSpaceGb(in.getImageSpaceGb()).scratchDisks(in + return super.fromResource(in).memoryMb(in.getMemoryMb()).scratchDisks(in .getScratchDisks()).maximumPersistentDisks(in.getMaximumPersistentDisks()) .maximumPersistentDisksSizeGb(in.getMaximumPersistentDisksSizeGb()).zone(in.getZone()) .deprecated(in.getDeprecated().orNull()); diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceExpectTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceExpectTest.java index f5597033a9..885289fc58 100644 --- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceExpectTest.java +++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceExpectTest.java @@ -214,7 +214,7 @@ public class GoogleComputeEngineServiceExpectTest extends BaseGoogleComputeEngin .addHeader("Authorization", "Bearer " + TOKEN) .payload(payloadFromStringWithContentType("{\"name\":\"" + instanceName + "\"," + "\"machineType\":\"https://www.googleapis" + - ".com/compute/v1/projects/myproject/zones/us-central1-a/machineTypes/n1-standard-1\"," + + ".com/compute/v1/projects/myproject/zones/us-central1-a/machineTypes/f1-micro\"," + "\"serviceAccounts\":[]," + "\"networkInterfaces\":[{\"network\":\"https://www.googleapis" + ".com/compute/v1/projects/myproject/global/networks/" + networkName + "\"," + diff --git a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java index 5d76e7c236..5ed9260ccd 100644 --- a/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java +++ b/providers/google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/parse/ParseMachineTypeListTest.java @@ -51,7 +51,6 @@ public class ParseMachineTypeListTest extends BaseGoogleComputeEngineParseTest