JCLOUDS-703: Google Hardware no longer supports images

This commit is contained in:
Stuart Hendren 2014-09-11 10:15:57 +01:00 committed by Chris Custine
parent 611c21ba69
commit f4f86edd4d
8 changed files with 6 additions and 33 deletions

View File

@ -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<MachineTypeInZone,
"location for %s",
input.getMachineType().getZone());
// TODO Figure out a robust way to deal with machineTypes with imageSizeGb==0 rather than just blocking them.
return new HardwareBuilder()
.id(SlashEncodedIds.fromTwoIds(input.getMachineType().getZone(), input.getMachineType().getName()).slashEncode())
.location(location)
@ -78,11 +76,8 @@ public class MachineTypeInZoneToHardware implements Function<MachineTypeInZone,
.providerId(input.getMachineType().getId())
.ram(input.getMachineType().getMemoryMb())
.uri(input.getMachineType().getSelfLink())
.userMetadata(ImmutableMap.of("imageSpaceGb", Integer.toString(input.getMachineType().getImageSpaceGb())))
.volumes(collectVolumes(input.getMachineType()))
.supportsImage(input.getMachineType().getImageSpaceGb() > 0
? Predicates.<Image>alwaysTrue()
: Predicates.<Image>alwaysFalse())
.supportsImage(Predicates.<Image>alwaysTrue())
.build();
}

View File

@ -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<ScratchDisk> 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<ScratchDisk> scratchDisks,
int guestCpus, int memoryMb, List<ScratchDisk> 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.<ScratchDisk>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());

View File

@ -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 + "\"," +

View File

@ -51,7 +51,6 @@ public class ParseMachineTypeListTest extends BaseGoogleComputeEngineParseTest<L
.description("1 vCPU (shared physical core) and 0.6 GB RAM")
.guestCpus(1)
.memoryMb(614)
.imageSpaceGb(0)
.maximumPersistentDisks(4)
.maximumPersistentDisksSizeGb(3072)
.build())
@ -65,7 +64,6 @@ public class ParseMachineTypeListTest extends BaseGoogleComputeEngineParseTest<L
.description("1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk")
.guestCpus(1)
.memoryMb(3840)
.imageSpaceGb(10)
.maximumPersistentDisks(16)
.maximumPersistentDisksSizeGb(128)
.build())
@ -80,7 +78,6 @@ public class ParseMachineTypeListTest extends BaseGoogleComputeEngineParseTest<L
"and 2 extra 1770 GB ephemeral disks")
.guestCpus(8)
.memoryMb(30720)
.imageSpaceGb(10)
.addScratchDisk(1770)
.addScratchDisk(1770)
.maximumPersistentDisks(16)

View File

@ -47,7 +47,6 @@ public class ParseMachineTypeTest extends BaseGoogleComputeEngineParseTest<Machi
.description("1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk")
.guestCpus(1)
.memoryMb(3840)
.imageSpaceGb(10)
.addScratchDisk(1770)
.addScratchDisk(1770)
.maximumPersistentDisks(16)

View File

@ -7,7 +7,6 @@
"description": "1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk",
"guestCpus": 1,
"memoryMb": 3840,
"imageSpaceGb": 10,
"scratchDisks": [
{
"diskGb": 1770

View File

@ -11,7 +11,6 @@
"description": "1 vCPU (shared physical core) and 0.6 GB RAM",
"guestCpus": 1,
"memoryMb": 614,
"imageSpaceGb": 0,
"maximumPersistentDisks": 4,
"maximumPersistentDisksSizeGb": "3072",
"zone": "us-central1-a",
@ -26,7 +25,6 @@
"description": "1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk",
"guestCpus": 1,
"memoryMb": 3840,
"imageSpaceGb": 10,
"maximumPersistentDisks": 16,
"maximumPersistentDisksSizeGb": "128",
"zone": "us-central1-a"
@ -40,7 +38,6 @@
"description": "8 vCPUs, 30 GB RAM, a 10 GB ephemeral root disk, and 2 extra 1770 GB ephemeral disks",
"guestCpus": 8,
"memoryMb": 30720,
"imageSpaceGb": 10,
"scratchDisks": [
{
"diskGb": 1770

View File

@ -12,7 +12,6 @@
"description": "1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk",
"guestCpus": 1,
"memoryMb": 3840,
"imageSpaceGb": 10,
"maximumPersistentDisks": 16,
"maximumPersistentDisksSizeGb": "128",
"zone": "us-central1-b"
@ -26,7 +25,6 @@
"description": "8 vCPUs, 30 GB RAM, a 10 GB ephemeral root disk, and 2 extra 1770 GB ephemeral disks",
"guestCpus": 8,
"memoryMb": 30720,
"imageSpaceGb": 10,
"scratchDisks": [
{
"diskGb": 1770