From a3b84737f1e406ea4bae1a42925a9dcaac6ca27b Mon Sep 17 00:00:00 2001 From: Anders Ingemann Date: Sun, 4 May 2014 13:24:29 +0200 Subject: [PATCH] HVM AMIs only work when EBS backed right now. S3 backed AMIs only work when they are unpartitioned. Remove json schema restriction and add some nicer messages in the validation function --- bootstrapvz/providers/ec2/__init__.py | 13 ++++++++++--- bootstrapvz/providers/ec2/manifest-schema-s3.json | 11 ----------- bootstrapvz/providers/ec2/manifest-schema.json | 2 +- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/bootstrapvz/providers/ec2/__init__.py b/bootstrapvz/providers/ec2/__init__.py index 4d3a562..b77dfdb 100644 --- a/bootstrapvz/providers/ec2/__init__.py +++ b/bootstrapvz/providers/ec2/__init__.py @@ -39,17 +39,24 @@ def validate_manifest(data, validator, error): bootloader = data['system']['bootloader'] virtualization = data['virtualization'] + backing = data['volume']['backing'] partition_type = data['volume']['partitions']['type'] if virtualization == 'pvm' and bootloader != 'pvgrub': error('Paravirtualized AMIs only support pvgrub as a bootloader', ['system', 'bootloader']) if virtualization == 'hvm': + if backing != 'ebs': + error('HVM AMIs currently only work when they are EBS backed', ['volume', 'backing']) if bootloader != 'extlinux': - error('HVM AMIs only support extlinux as a bootloader', ['system', 'bootloader']) + error('HVM AMIs currently only work with extlinux as a bootloader', ['system', 'bootloader']) if bootloader == 'extlinux' and partition_type not in ['none', 'msdos']: - error('HVM AMIs booted with extlinux currently only support the `none\' or `msdos\' partition type', - ['system', 'bootloader']) + error('HVM AMIs booted with extlinux currently work with unpartitioned or msdos partitions volumes', + ['volume', 'partitions', 'type']) + + if backing == 's3': + if partition_type != 'none': + error('S3 backed AMIs currently only work with unpartitioned volumes', ['system', 'bootloader']) def resolve_tasks(taskset, manifest): diff --git a/bootstrapvz/providers/ec2/manifest-schema-s3.json b/bootstrapvz/providers/ec2/manifest-schema-s3.json index c8012a3..ef23e51 100644 --- a/bootstrapvz/providers/ec2/manifest-schema-s3.json +++ b/bootstrapvz/providers/ec2/manifest-schema-s3.json @@ -28,17 +28,6 @@ } }, "required": ["bucket", "region"] - }, - "volume": { - "type": "object", - "properties": { - "partitions": { - "type": "object", - "properties": { - "type": { "enum": ["none"] } - } - } - } } }, "required": ["image"], diff --git a/bootstrapvz/providers/ec2/manifest-schema.json b/bootstrapvz/providers/ec2/manifest-schema.json index 3bcc40d..bb4bd97 100644 --- a/bootstrapvz/providers/ec2/manifest-schema.json +++ b/bootstrapvz/providers/ec2/manifest-schema.json @@ -39,7 +39,7 @@ "partitions": { "type": "object", "properties": { - "type": { "enum": ["none", "msdos"] } + "type": { "enum": ["none", "msdos", "gpt"] } } } },