Method: CloudFlock::App::Common#prepare_destination_filesystem

Defined in:
lib/cloudflock/app/common/servers.rb

#prepare_destination_filesystem(shell) ⇒ Object

Public: Mount the destination host’s target device and make backups of authentication-related files (passwd, group, shadow).

shell - SSH object logged in to the destination host.

TODO: Dynamic mountpoint/block device support Presently mount point and block device are hard-coded. This will be changed in a future release.

Returns nothing.



637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
# File 'lib/cloudflock/app/common/servers.rb', line 637

def prepare_destination_filesystem(shell)
  preserve_files = ['passwd', 'shadow', 'group']
  path = "#{MOUNT_POINT}/etc"

  UI.spinner('Preparing the destination filesystem') do
    shell.as_root("mkdir -p #{MOUNT_POINT}")
    shell.as_root("mount -o acl /dev/xvdb1 #{MOUNT_POINT}")

    preserve_files.each do |file|
      original = "#{path}/#{file}"
      backup   = "#{original}.migration"
      shell.as_root("[ -f #{backup} ] || /bin/cp -a #{original} #{backup}")
    end
  end
rescue Timeout::Error
  retry_exit('Host is slow to respond while preparing the destination.')
  retry
end