Class: Bosh::Agent::Message::MigrateDisk
- Defined in:
- lib/bosh_agent/message/migrate_disk.rb
Overview
Migrates persistent data from the old persistent disk to the new persistent disk.
This message assumes that two mount messages have been received and processed: one to mount the old disk at /var/vcap/store and a second to mount the new disk at /var/vcap/store_migraton_target (sic).
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
#base_dir, #handler_error, #logger, #logs_dir, #settings, #store_migration_target, #store_path
Class Method Details
.long_running? ⇒ Boolean
14 |
# File 'lib/bosh_agent/message/migrate_disk.rb', line 14 def self.long_running?; true; end |
.process(args) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/bosh_agent/message/migrate_disk.rb', line 16 def self.process(args) #logger = Bosh::Agent::Config.logger #logger.info("MigrateDisk:" + args.inspect) self.new.migrate(args) {} end |
Instance Method Details
#migrate(args) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bosh_agent/message/migrate_disk.rb', line 24 def migrate(args) logger.info("MigrateDisk:" + args.inspect) @old_cid, @new_cid = args DiskUtil.umount_guard(store_path) mount_store(@old_cid, read_only: true) if check_mountpoints logger.info("Copy data from old to new store disk") `(cd #{store_path} && tar cf - .) | (cd #{store_migration_target} && tar xpf -)` end DiskUtil.umount_guard(store_path) DiskUtil.umount_guard(store_migration_target) mount_store(@new_cid) end |