Method: CopySnapshot::TargetInstanceLaunchedState#enter

Defined in:
lib/scripts/ec2/copy_snapshot.rb

#enterObject



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/scripts/ec2/copy_snapshot.rb', line 184

def enter()
  local_region()
  ec2_helper = Ec2Helper.new(@context[:ec2_api_handler])
  volume_size = ec2_helper.snapshot_prop(@context[:snapshot_id], :volumeSize).to_i
  #
  remote_region()
  @context[:target_volume_id] = create_volume(@context[:target_availability_zone], volume_size)
  device = "/dev/sdj"  #TODO: make device configurable
  mount_point = "/mnt/tmp_#{@context[:target_volume_id]}"
  attach_volume(@context[:target_volume_id], @context[:target_instance_id], device, Ec2Script::CS_AWS_TIMEOUT)
  connect(@context[:target_dns_name], @context[:target_ssh_username], nil, @context[:target_ssh_keydata])
  create_labeled_fs(@context[:target_dns_name], device, @context[:fs_type], @context[:label])
  mount_fs(mount_point, device)
  disconnect()

  TargetVolumeReadyState.new(@context)
end