mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(ec2): word an AMI and instance type architecture mismatch as RunInstances does (#8403)
RunInstances already refused an AMI whose architecture the instance type cannot run, as AWS does, but said "The architecture 'x86_64' of the specified image does not match the architecture supported by instance type 'm6g.large'.". AWS names the instance type's architecture first: "The architecture 'arm64' of the specified instance type does not match the architecture 'x86_64' of the specified AMI."
This commit is contained in:
1 parent
b4fbe99123
commit
246d82ec57
3 files changed
+32
-3
No files matched your search
@@ -4526,13 +4526,18 @@ public class Ec2Service implements ContainerTeardown, ResourceProvider, Resettab
|
||||
.noneMatch(imageArchitecture.get()::equals))
|
||||
.ifPresent(type -> {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"The architecture '" + imageArchitecture.get()
|
||||
+ "' of the specified image does not match the architecture supported by instance type '"
|
||||
+ instanceType + "'.",
|
||||
"The architecture '" + instanceTypeArchitecture(type)
|
||||
+ "' of the specified instance type does not match the architecture '"
|
||||
+ imageArchitecture.get() + "' of the specified AMI.",
|
||||
400);
|
||||
});
|
||||
}
|
||||
|
||||
/** The architecture RunInstances names for an instance type: x86_64 for a type that also runs i386. */
|
||||
private static String instanceTypeArchitecture(Ec2InstanceTypeCatalog.CatalogInstanceType type) {
|
||||
return type.supportedArchitectures.contains("x86_64") ? "x86_64" : type.supportedArchitectures.getFirst();
|
||||
}
|
||||
|
||||
private String architectureFor(String region, String imageId, String instanceType) {
|
||||
Optional<String> registeredArchitecture = registeredImages.get(key(region, imageId))
|
||||
.map(Image::getArchitecture);
|
||||
|
||||
Reference in new issue
Block a user