Class: Backstore_block_lv
- Inherits:
-
Backstore_block
- Object
- TargetcliBase
- Backstore
- Backstore_block
- Backstore_block_lv
- Defined in:
- lib/Targetcli/Backstore_block_lv.rb
Instance Attribute Summary collapse
-
#lv ⇒ Object
Returns the value of attribute lv.
-
#vg ⇒ Object
Returns the value of attribute vg.
Attributes inherited from Backstore
#name, #path, #size, #status, #type, #write
Instance Method Summary collapse
- #create_cmd ⇒ Object
- #delete_cmd ⇒ Object
-
#initialize ⇒ Backstore_block_lv
constructor
A new instance of Backstore_block_lv.
- #ls_all_cmd ⇒ Object
- #lsDecode(string) ⇒ Object
Constructor Details
#initialize ⇒ Backstore_block_lv
Returns a new instance of Backstore_block_lv.
6 7 8 |
# File 'lib/Targetcli/Backstore_block_lv.rb', line 6 def initialize super end |
Instance Attribute Details
#lv ⇒ Object
Returns the value of attribute lv.
4 5 6 |
# File 'lib/Targetcli/Backstore_block_lv.rb', line 4 def lv @lv end |
#vg ⇒ Object
Returns the value of attribute vg.
3 4 5 |
# File 'lib/Targetcli/Backstore_block_lv.rb', line 3 def vg @vg end |
Instance Method Details
#create_cmd ⇒ Object
34 35 36 |
# File 'lib/Targetcli/Backstore_block_lv.rb', line 34 def create_cmd @command + ' /backstores/block create name=' + @name + ' dev=/dev/' + @vg + '/' + @lv end |
#delete_cmd ⇒ Object
38 39 40 |
# File 'lib/Targetcli/Backstore_block_lv.rb', line 38 def delete_cmd @command + ' /backstores/block delete ' + @name end |
#ls_all_cmd ⇒ Object
42 43 44 |
# File 'lib/Targetcli/Backstore_block_lv.rb', line 42 def ls_all_cmd @command + ' /backstores/block ls' end |
#lsDecode(string) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/Targetcli/Backstore_block_lv.rb', line 10 def lsDecode string regexp_ls_backstore = /^\s*\|\s+\|\s+\o\-\s+([\w\_]+)\s+[\.]+\s+\[\/dev\/([\w\_]+)\/([\w\_]+)\s+\((\d+\.\d+[MG]iB)\)\s+(write-thru)\s(activated)\]$/ if %r{^No\ssuch\spath\s}.match(string) 'no device' elsif match_ls_backstore = regexp_ls_backstore.match(string) @name = match_ls_backstore[1] @vg = match_ls_backstore[2] @lv = match_ls_backstore[3] @size = match_ls_backstore[4] @write = match_ls_backstore[5] @status = match_ls_backstore[6] @path = '/dev/' + @vg + '/' +@lv return 'device found' else puts "RegExp couldn't decode string >#{string}<" raise "Couldn't decode string" end end |