Class: CloudFlock::App::ServerMigrate

Inherits:
Object
  • Object
show all
Includes:
Common, Remote
Defined in:
lib/cloudflock/app/server-migrate.rb

Overview

Public: The ServerMigrate class provides the interface to perform one-shot migrations as a CLI application.

Constant Summary

Constants included from Common

Common::DATA_DIR, Common::EXCLUSIONS, Common::MOUNT_POINT, Common::PRIVATE_KEY, Common::PUBLIC_KEY, Common::SSH_ARGUMENTS

Instance Method Summary collapse

Methods included from Common

#check_hostkey, #cleanup_destination, #cleanup_rackspace_server, #configure_ips, #define_compute_flavor, #define_compute_image, #define_compute_name, #define_destination, #define_host, #define_source, #determine_target_address, #filter_compute_flavors, #filter_compute_images, #generate_keypair, #generate_selection_table, #get_host_details, #managed_wait, #migrate_server, #provision_compute, #provision_wait, #remediate_ip, #rescue_compute, #restore_rackspace_users, #restore_user, #retry_prompt, #setup_destination, #setup_source, #ssh_connect, #transfer_rsync

Methods included from CloudFlock::App

#check_option, #check_option_fs, #check_option_pw, #check_option_yn

Methods included from Rackspace

#define_rackspace_api, #define_rackspace_cloudservers_region, #define_rackspace_files_region, #define_rackspace_region, #define_rackspace_service_region

Constructor Details

#initializeServerMigrate

Public: Perform the steps necessary to migrate a Unix host to a standing host or to a newly provisioned Rackspace Cloud server.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cloudflock/app/server-migrate.rb', line 16

def initialize
  options = parse_options

  source_host = source_connect(options)
  profile = fetch_profile(source_host)

  puts generate_recommendation(profile)

  dest_host = destination_connect(options, profile)
  exclusions = build_exclusions(profile.cpe)
  migrate_server(source_host, dest_host, exclusions)

  source_host.logout!
  cleanup_destination(dest_host, profile.cpe)
  configure_ips(dest_host, profile)

  puts UI.bold { UI.blue { "Migration complete to #{dest_host.hostname}"} }
rescue
  puts UI.red { 'An unhandled error was encountered.  Details follow:' }
  raise
end