2014-03-23 23:12:07 +01:00
|
|
|
from bootstrapvz.base import Task
|
|
|
|
from bootstrapvz.common import phases
|
2013-06-24 23:12:39 +02:00
|
|
|
|
2013-06-23 12:00:17 +02:00
|
|
|
|
2013-07-13 13:55:12 +02:00
|
|
|
class Create(Task):
|
2013-09-15 13:19:45 +02:00
|
|
|
description = 'Creating the EBS volume'
|
2013-07-09 20:32:50 +02:00
|
|
|
phase = phases.volume_creation
|
2013-06-26 20:14:37 +02:00
|
|
|
|
2014-01-05 15:57:11 +01:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
2014-04-10 00:20:35 +02:00
|
|
|
info.volume.create(info._ec2['connection'], info._ec2['host']['availabilityZone'])
|
2013-06-23 12:00:17 +02:00
|
|
|
|
2013-06-26 20:14:37 +02:00
|
|
|
|
2013-10-09 00:09:34 +02:00
|
|
|
class Attach(Task):
|
|
|
|
description = 'Attaching the volume'
|
|
|
|
phase = phases.volume_creation
|
2013-11-21 15:54:42 +01:00
|
|
|
predecessors = [Create]
|
2013-10-09 00:09:34 +02:00
|
|
|
|
2014-01-05 15:57:11 +01:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
2014-04-10 00:20:35 +02:00
|
|
|
info.volume.attach(info._ec2['host']['instanceId'])
|
2013-10-09 00:09:34 +02:00
|
|
|
|
|
|
|
|
2013-07-13 13:55:12 +02:00
|
|
|
class Snapshot(Task):
|
2013-07-07 19:24:52 +02:00
|
|
|
description = 'Creating a snapshot of the EBS volume'
|
|
|
|
phase = phases.image_registration
|
|
|
|
|
2014-01-05 15:57:11 +01:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
2014-04-10 00:20:35 +02:00
|
|
|
info._ec2['snapshot'] = info.volume.snapshot()
|