Class: Dcmgr::Drivers::LocalStorage

Inherits:
SnapshotStorage show all
Includes:
Helpers::CliHelper, Logger
Defined in:
lib/dcmgr/drivers/local_storage.rb

Instance Attribute Summary

Attributes inherited from SnapshotStorage

#volume_snaphost_path

Instance Method Summary collapse

Methods included from Helpers::CliHelper

#sh, #tryagain

Methods included from Logger

create, default_logdev, included

Methods inherited from SnapshotStorage

#check, #clear, #initialize, #setenv, #snapshot

Constructor Details

This class inherits a constructor from Dcmgr::Drivers::SnapshotStorage

Instance Method Details

#delete(filename) ⇒ Object



20
21
22
# File 'lib/dcmgr/drivers/local_storage.rb', line 20

def delete(filename)
  sh("rm -f %s", [File.join(@volume_snaphost_path, filename)])
end

#download(filename) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/dcmgr/drivers/local_storage.rb', line 8

def download(filename)
  from = File.join(@volume_snaphost_path, filename)
  to   = self.snapshot(filename)

  logger.debug("copying #{from} to #{to}")
  sh("/bin/cp -p %s %s", [from, to])
end

#upload(filename) ⇒ Object



16
17
18
# File 'lib/dcmgr/drivers/local_storage.rb', line 16

def upload(filename)
  sh("/bin/mv %s %s", [self.snapshot(filename), File.join(@volume_snaphost_path, filename)])
end