def _create_template_ebs_volume(self, operation): """ Helper function to create template EBS volume to work on. :param NamedConstant operation: Intended use of created template. A value from ``VolumeOperations``. :returns: Suitable volume in the right start state for input operation. :rtype: boto.ec2.volume.Volume """ volume = EbsVolume() # Irrelevant volume attributes. volume.id = u'vol-9c48a689' volume.create_time = u'2015-07-14T22:46:00.447Z' volume.size = 1 volume.snapshot_id = '' volume.zone = u'us-west-2b' volume.type = u'standard' volume_state_table = VolumeStateTable() state_flow = volume_state_table.table[operation] start_state = state_flow.start_state.value # Interesting volume attribute. volume.status = start_state return volume
def create_volume(self, size, zone, **kwargs): volume = Volume() volume.id = 'vol-' + new_id() volume.size = size volume.zone = zone volume.status = 'available' self.volumes[volume.id] = volume return volume