mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 18:00:35 +00:00
Implemented prebootstrapped plugin
This commit is contained in:
parent
b8341c48e4
commit
8479ff4dca
3 changed files with 21 additions and 8 deletions
|
@ -33,6 +33,10 @@
|
|||
"build_metadata": {
|
||||
"enabled": false,
|
||||
"path" : "/root/build-metadata-{ami_name}"
|
||||
},
|
||||
"prebootstrapped": {
|
||||
"enabled": false,
|
||||
"snapshot": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
Loading…
Add table
Reference in a new issue