bootstrap-vz/bootstrapvz/providers/ec2/tasks/ebs.py

31 lines
694 B
Python
Raw Normal View History

from bootstrapvz.base import Task
from bootstrapvz.common import phases
class Create(Task):
description = 'Creating the EBS volume'
phase = phases.volume_creation
2013-06-26 20:14:37 +02:00
@classmethod
def run(cls, info):
info.volume.create(info._ec2['connection'], info._ec2['host']['availabilityZone'])
2013-06-26 20:14:37 +02:00
class Attach(Task):
description = 'Attaching the volume'
phase = phases.volume_creation
predecessors = [Create]
@classmethod
def run(cls, info):
info.volume.attach(info._ec2['host']['instanceId'])
class Snapshot(Task):
2013-07-07 19:24:52 +02:00
description = 'Creating a snapshot of the EBS volume'
phase = phases.image_registration
@classmethod
def run(cls, info):
info._ec2['snapshot'] = info.volume.snapshot()