mirror of https://github.com/apache/jclouds.git
JCLOUDS-703: Google Hardware no longer supports images
This commit is contained in:
parent
611c21ba69
commit
f4f86edd4d
|
@ -39,7 +39,6 @@ import com.google.common.base.Function;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
|
@ -68,7 +67,6 @@ public class MachineTypeInZoneToHardware implements Function<MachineTypeInZone,
|
||||||
"location for %s",
|
"location for %s",
|
||||||
input.getMachineType().getZone());
|
input.getMachineType().getZone());
|
||||||
|
|
||||||
// TODO Figure out a robust way to deal with machineTypes with imageSizeGb==0 rather than just blocking them.
|
|
||||||
return new HardwareBuilder()
|
return new HardwareBuilder()
|
||||||
.id(SlashEncodedIds.fromTwoIds(input.getMachineType().getZone(), input.getMachineType().getName()).slashEncode())
|
.id(SlashEncodedIds.fromTwoIds(input.getMachineType().getZone(), input.getMachineType().getName()).slashEncode())
|
||||||
.location(location)
|
.location(location)
|
||||||
|
@ -78,11 +76,8 @@ public class MachineTypeInZoneToHardware implements Function<MachineTypeInZone,
|
||||||
.providerId(input.getMachineType().getId())
|
.providerId(input.getMachineType().getId())
|
||||||
.ram(input.getMachineType().getMemoryMb())
|
.ram(input.getMachineType().getMemoryMb())
|
||||||
.uri(input.getMachineType().getSelfLink())
|
.uri(input.getMachineType().getSelfLink())
|
||||||
.userMetadata(ImmutableMap.of("imageSpaceGb", Integer.toString(input.getMachineType().getImageSpaceGb())))
|
|
||||||
.volumes(collectVolumes(input.getMachineType()))
|
.volumes(collectVolumes(input.getMachineType()))
|
||||||
.supportsImage(input.getMachineType().getImageSpaceGb() > 0
|
.supportsImage(Predicates.<Image>alwaysTrue())
|
||||||
? Predicates.<Image>alwaysTrue()
|
|
||||||
: Predicates.<Image>alwaysFalse())
|
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,6 @@ public final class MachineType extends Resource {
|
||||||
|
|
||||||
private final Integer guestCpus;
|
private final Integer guestCpus;
|
||||||
private final Integer memoryMb;
|
private final Integer memoryMb;
|
||||||
private final Integer imageSpaceGb;
|
|
||||||
private final List<ScratchDisk> scratchDisks;
|
private final List<ScratchDisk> scratchDisks;
|
||||||
private final Integer maximumPersistentDisks;
|
private final Integer maximumPersistentDisks;
|
||||||
private final Long maximumPersistentDisksSizeGb;
|
private final Long maximumPersistentDisksSizeGb;
|
||||||
|
@ -52,17 +51,15 @@ public final class MachineType extends Resource {
|
||||||
|
|
||||||
@ConstructorProperties({
|
@ConstructorProperties({
|
||||||
"id", "creationTimestamp", "selfLink", "name", "description", "guestCpus", "memoryMb",
|
"id", "creationTimestamp", "selfLink", "name", "description", "guestCpus", "memoryMb",
|
||||||
"imageSpaceGb", "scratchDisks", "maximumPersistentDisks", "maximumPersistentDisksSizeGb", "zone",
|
"scratchDisks", "maximumPersistentDisks", "maximumPersistentDisksSizeGb", "zone", "deprecated"
|
||||||
"deprecated"
|
|
||||||
})
|
})
|
||||||
private MachineType(String id, Date creationTimestamp, URI selfLink, String name, String description,
|
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,
|
int maximumPersistentDisks, long maximumPersistentDisksSizeGb, String zone,
|
||||||
@Nullable Deprecated deprecated) {
|
@Nullable Deprecated deprecated) {
|
||||||
super(Kind.MACHINE_TYPE, id, creationTimestamp, selfLink, name, description);
|
super(Kind.MACHINE_TYPE, id, creationTimestamp, selfLink, name, description);
|
||||||
this.guestCpus = checkNotNull(guestCpus, "guestCpus of %s", name);
|
this.guestCpus = checkNotNull(guestCpus, "guestCpus of %s", name);
|
||||||
this.memoryMb = checkNotNull(memoryMb, "memoryMb 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.scratchDisks = scratchDisks == null ? ImmutableList.<ScratchDisk>of() : scratchDisks;
|
||||||
this.maximumPersistentDisks = checkNotNull(maximumPersistentDisks, "maximumPersistentDisks of %s", name);
|
this.maximumPersistentDisks = checkNotNull(maximumPersistentDisks, "maximumPersistentDisks of %s", name);
|
||||||
this.maximumPersistentDisksSizeGb = maximumPersistentDisksSizeGb;
|
this.maximumPersistentDisksSizeGb = maximumPersistentDisksSizeGb;
|
||||||
|
@ -84,13 +81,6 @@ public final class MachineType extends Resource {
|
||||||
return memoryMb;
|
return memoryMb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return space allotted for the image, defined in GB.
|
|
||||||
*/
|
|
||||||
public int getImageSpaceGb() {
|
|
||||||
return imageSpaceGb;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return extended scratch disks assigned to the instance.
|
* @return extended scratch disks assigned to the instance.
|
||||||
*/
|
*/
|
||||||
|
@ -147,7 +137,6 @@ public final class MachineType extends Resource {
|
||||||
return super.string()
|
return super.string()
|
||||||
.add("guestCpus", guestCpus)
|
.add("guestCpus", guestCpus)
|
||||||
.add("memoryMb", memoryMb)
|
.add("memoryMb", memoryMb)
|
||||||
.add("imageSpaceGb", imageSpaceGb)
|
|
||||||
.add("scratchDisks", scratchDisks)
|
.add("scratchDisks", scratchDisks)
|
||||||
.add("maximumPersistentDisks", maximumPersistentDisks)
|
.add("maximumPersistentDisks", maximumPersistentDisks)
|
||||||
.add("maximumPersistentDisksSizeGb", maximumPersistentDisksSizeGb)
|
.add("maximumPersistentDisksSizeGb", maximumPersistentDisksSizeGb)
|
||||||
|
@ -261,13 +250,12 @@ public final class MachineType extends Resource {
|
||||||
|
|
||||||
public MachineType build() {
|
public MachineType build() {
|
||||||
return new MachineType(id, creationTimestamp, selfLink, name, description, guestCpus, memoryMb,
|
return new MachineType(id, creationTimestamp, selfLink, name, description, guestCpus, memoryMb,
|
||||||
imageSpaceGb, scratchDisks.build(), maximumPersistentDisks, maximumPersistentDisksSizeGb,
|
scratchDisks.build(), maximumPersistentDisks, maximumPersistentDisksSizeGb, zone, deprecated);
|
||||||
zone, deprecated);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Builder fromMachineType(MachineType in) {
|
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())
|
.getScratchDisks()).maximumPersistentDisks(in.getMaximumPersistentDisks())
|
||||||
.maximumPersistentDisksSizeGb(in.getMaximumPersistentDisksSizeGb()).zone(in.getZone())
|
.maximumPersistentDisksSizeGb(in.getMaximumPersistentDisksSizeGb()).zone(in.getZone())
|
||||||
.deprecated(in.getDeprecated().orNull());
|
.deprecated(in.getDeprecated().orNull());
|
||||||
|
|
|
@ -214,7 +214,7 @@ public class GoogleComputeEngineServiceExpectTest extends BaseGoogleComputeEngin
|
||||||
.addHeader("Authorization", "Bearer " + TOKEN)
|
.addHeader("Authorization", "Bearer " + TOKEN)
|
||||||
.payload(payloadFromStringWithContentType("{\"name\":\"" + instanceName + "\"," +
|
.payload(payloadFromStringWithContentType("{\"name\":\"" + instanceName + "\"," +
|
||||||
"\"machineType\":\"https://www.googleapis" +
|
"\"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\":[]," +
|
"\"serviceAccounts\":[]," +
|
||||||
"\"networkInterfaces\":[{\"network\":\"https://www.googleapis" +
|
"\"networkInterfaces\":[{\"network\":\"https://www.googleapis" +
|
||||||
".com/compute/v1/projects/myproject/global/networks/" + networkName + "\"," +
|
".com/compute/v1/projects/myproject/global/networks/" + networkName + "\"," +
|
||||||
|
|
|
@ -51,7 +51,6 @@ public class ParseMachineTypeListTest extends BaseGoogleComputeEngineParseTest<L
|
||||||
.description("1 vCPU (shared physical core) and 0.6 GB RAM")
|
.description("1 vCPU (shared physical core) and 0.6 GB RAM")
|
||||||
.guestCpus(1)
|
.guestCpus(1)
|
||||||
.memoryMb(614)
|
.memoryMb(614)
|
||||||
.imageSpaceGb(0)
|
|
||||||
.maximumPersistentDisks(4)
|
.maximumPersistentDisks(4)
|
||||||
.maximumPersistentDisksSizeGb(3072)
|
.maximumPersistentDisksSizeGb(3072)
|
||||||
.build())
|
.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")
|
.description("1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk")
|
||||||
.guestCpus(1)
|
.guestCpus(1)
|
||||||
.memoryMb(3840)
|
.memoryMb(3840)
|
||||||
.imageSpaceGb(10)
|
|
||||||
.maximumPersistentDisks(16)
|
.maximumPersistentDisks(16)
|
||||||
.maximumPersistentDisksSizeGb(128)
|
.maximumPersistentDisksSizeGb(128)
|
||||||
.build())
|
.build())
|
||||||
|
@ -80,7 +78,6 @@ public class ParseMachineTypeListTest extends BaseGoogleComputeEngineParseTest<L
|
||||||
"and 2 extra 1770 GB ephemeral disks")
|
"and 2 extra 1770 GB ephemeral disks")
|
||||||
.guestCpus(8)
|
.guestCpus(8)
|
||||||
.memoryMb(30720)
|
.memoryMb(30720)
|
||||||
.imageSpaceGb(10)
|
|
||||||
.addScratchDisk(1770)
|
.addScratchDisk(1770)
|
||||||
.addScratchDisk(1770)
|
.addScratchDisk(1770)
|
||||||
.maximumPersistentDisks(16)
|
.maximumPersistentDisks(16)
|
||||||
|
|
|
@ -47,7 +47,6 @@ public class ParseMachineTypeTest extends BaseGoogleComputeEngineParseTest<Machi
|
||||||
.description("1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk")
|
.description("1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk")
|
||||||
.guestCpus(1)
|
.guestCpus(1)
|
||||||
.memoryMb(3840)
|
.memoryMb(3840)
|
||||||
.imageSpaceGb(10)
|
|
||||||
.addScratchDisk(1770)
|
.addScratchDisk(1770)
|
||||||
.addScratchDisk(1770)
|
.addScratchDisk(1770)
|
||||||
.maximumPersistentDisks(16)
|
.maximumPersistentDisks(16)
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
"description": "1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk",
|
"description": "1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk",
|
||||||
"guestCpus": 1,
|
"guestCpus": 1,
|
||||||
"memoryMb": 3840,
|
"memoryMb": 3840,
|
||||||
"imageSpaceGb": 10,
|
|
||||||
"scratchDisks": [
|
"scratchDisks": [
|
||||||
{
|
{
|
||||||
"diskGb": 1770
|
"diskGb": 1770
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
"description": "1 vCPU (shared physical core) and 0.6 GB RAM",
|
"description": "1 vCPU (shared physical core) and 0.6 GB RAM",
|
||||||
"guestCpus": 1,
|
"guestCpus": 1,
|
||||||
"memoryMb": 614,
|
"memoryMb": 614,
|
||||||
"imageSpaceGb": 0,
|
|
||||||
"maximumPersistentDisks": 4,
|
"maximumPersistentDisks": 4,
|
||||||
"maximumPersistentDisksSizeGb": "3072",
|
"maximumPersistentDisksSizeGb": "3072",
|
||||||
"zone": "us-central1-a",
|
"zone": "us-central1-a",
|
||||||
|
@ -26,7 +25,6 @@
|
||||||
"description": "1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk",
|
"description": "1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk",
|
||||||
"guestCpus": 1,
|
"guestCpus": 1,
|
||||||
"memoryMb": 3840,
|
"memoryMb": 3840,
|
||||||
"imageSpaceGb": 10,
|
|
||||||
"maximumPersistentDisks": 16,
|
"maximumPersistentDisks": 16,
|
||||||
"maximumPersistentDisksSizeGb": "128",
|
"maximumPersistentDisksSizeGb": "128",
|
||||||
"zone": "us-central1-a"
|
"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",
|
"description": "8 vCPUs, 30 GB RAM, a 10 GB ephemeral root disk, and 2 extra 1770 GB ephemeral disks",
|
||||||
"guestCpus": 8,
|
"guestCpus": 8,
|
||||||
"memoryMb": 30720,
|
"memoryMb": 30720,
|
||||||
"imageSpaceGb": 10,
|
|
||||||
"scratchDisks": [
|
"scratchDisks": [
|
||||||
{
|
{
|
||||||
"diskGb": 1770
|
"diskGb": 1770
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
"description": "1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk",
|
"description": "1 vCPU, 3.75 GB RAM, and a 10 GB ephemeral root disk",
|
||||||
"guestCpus": 1,
|
"guestCpus": 1,
|
||||||
"memoryMb": 3840,
|
"memoryMb": 3840,
|
||||||
"imageSpaceGb": 10,
|
|
||||||
"maximumPersistentDisks": 16,
|
"maximumPersistentDisks": 16,
|
||||||
"maximumPersistentDisksSizeGb": "128",
|
"maximumPersistentDisksSizeGb": "128",
|
||||||
"zone": "us-central1-b"
|
"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",
|
"description": "8 vCPUs, 30 GB RAM, a 10 GB ephemeral root disk, and 2 extra 1770 GB ephemeral disks",
|
||||||
"guestCpus": 8,
|
"guestCpus": 8,
|
||||||
"memoryMb": 30720,
|
"memoryMb": 30720,
|
||||||
"imageSpaceGb": 10,
|
|
||||||
"scratchDisks": [
|
"scratchDisks": [
|
||||||
{
|
{
|
||||||
"diskGb": 1770
|
"diskGb": 1770
|
||||||
|
|
Loading…
Reference in New Issue