diff --git a/manifests/ec2-ebs-pvm.manifest.json b/manifests/ec2-ebs-pvm.manifest.json index 63431df..425ed86 100644 --- a/manifests/ec2-ebs-pvm.manifest.json +++ b/manifests/ec2-ebs-pvm.manifest.json @@ -33,6 +33,10 @@ "build_metadata": { "enabled": false, "path" : "/root/build-metadata-{ami_name}" + }, + "prebootstrapped": { + "enabled": false, + "snapshot": "" } } } diff --git a/plugins/prebootstrapped/__init__.py b/plugins/prebootstrapped/__init__.py index 66baa83..c6986d8 100644 --- a/plugins/prebootstrapped/__init__.py +++ b/plugins/prebootstrapped/__init__.py @@ -1,6 +1,13 @@ def tasks(tasklist, manifest): - from ebs import CreateVolumeFromSnapshot - from providers.ec2.tasks.ebs import CreateVolume - tasklist.replace(CreateVolume, CreateVolumeFromSnapshot()) + from tasks import CreateVolumeFromSnapshot + from providers.ec2.tasks import ebs + from providers.ec2.tasks import bootstrap + from providers.ec2.tasks import filesystem + tasklist.replace(ebs.CreateVolume, CreateVolumeFromSnapshot()) + tasklist.remove(filesystem.FormatVolume, + filesystem.TuneVolumeFS, + filesystem.AddXFSProgs, + bootstrap.MakeTarball, + bootstrap.Bootstrap) diff --git a/plugins/prebootstrapped/ebs.py b/plugins/prebootstrapped/tasks.py similarity index 57% rename from plugins/prebootstrapped/ebs.py rename to plugins/prebootstrapped/tasks.py index e58abda..91aa258 100644 --- a/plugins/prebootstrapped/ebs.py +++ b/plugins/prebootstrapped/tasks.py @@ -1,21 +1,23 @@ from base import Task from common import phases -from connection import Connect +from providers.ec2.tasks import connection +from providers.ec2.tasks import ebs import time class CreateVolumeFromSnapshot(Task): phase = phases.volume_creation - after = [Connect] + after = [connection.Connect] + before = [ebs.AttachVolume] - description = 'Creating an EBS volume from a snapshot' + description = 'Creating EBS volume from a snapshot' def run(self, info): volume_size = int(info.manifest.volume['size']/1024) - snapshot_id = info.manifest.plugins['prebootstrapped'].snapshot_id + snapshot = info.manifest.plugins['prebootstrapped']['snapshot'] info.volume = info.connection.create_volume(volume_size, info.host['availabilityZone'], - snapshot=snapshot_id) + snapshot=snapshot) while info.volume.volume_state() != 'available': time.sleep(5) info.volume.update()