Class: Bosh::Agent::Message::UnmountDisk

Inherits:
Base show all
Defined in:
lib/bosh_agent/message/unmount_disk.rb

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

Returns:

  • (Boolean)


7
# File 'lib/bosh_agent/message/unmount_disk.rb', line 7

def self.long_running?; true; end

.process(args) ⇒ Object



9
10
11
# File 'lib/bosh_agent/message/unmount_disk.rb', line 9

def self.process(args)
  self.new.unmount(args)
end

Instance Method Details

#unmount(args) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bosh_agent/message/unmount_disk.rb', line 13

def unmount(args)
  cid = args.first
  disk = Bosh::Agent::Config.platform.lookup_disk_by_cid(cid)
  partition = "#{disk}1"

  if DiskUtil.mount_entry(partition)
    @block, @mountpoint = DiskUtil.mount_entry(partition).split
    DiskUtil.umount_guard(@mountpoint)
    logger.info("Unmounted #{@block} on #{@mountpoint}")
    return {:message => "Unmounted #{@block} on #{@mountpoint}" }
  else
    return {:message => "Unknown mount for partition: #{partition}"}
  end
end