Class: Dcmgr::Drivers::SunIscsi
- Inherits:
-
IscsiTarget
- Object
- IscsiTarget
- Dcmgr::Drivers::SunIscsi
- Includes:
- Helpers::CliHelper, Logger
- Defined in:
- lib/dcmgr/drivers/sun_iscsi.rb
Instance Attribute Summary
Attributes inherited from IscsiTarget
Instance Method Summary collapse
Methods included from Helpers::CliHelper
Methods included from Logger
create, default_logdev, included
Methods inherited from IscsiTarget
#register, select_iscsi_target
Instance Method Details
#create(ctx) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/dcmgr/drivers/sun_iscsi.rb', line 9 def create(ctx) @volume = ctx.volume @volume_id = ctx.volume_id sh("/usr/sbin/zfs shareiscsi=on %s/%s", [@volume[:storage_node][:export_path], @volume[:uuid]]) if $?.exitstatus != 0 raise "failed iscsi target request: #{@volume_id}" end il = sh("iscsitadm list target -v %s", ["#{@volume[:storage_node][:export_path]}/#{@volume[:uuid]}"]) if $?.exitstatus != 0 raise "iscsi target has not be created #{@volume_id}" end il = il[:stdout].downcase.split("\n").select {|row| row.strip!} # :transport_information => {:iqn => "iqn.1986-03.com.sun:02:787bca42-9639-44e4-f115-f5b06ed31817", :lun => 0} opt = {:iqn => il[0].split(": ").last, :lun=>il[6].split(": ").last.to_i} end |
#delete(ctx) ⇒ Object
26 27 28 29 |
# File 'lib/dcmgr/drivers/sun_iscsi.rb', line 26 def delete(ctx) @volume = ctx.volume sh("/usr/sbin/zfs shareiscsi=off %s/%s", [@volume[:storage_node][:export_path], @volume[:uuid]]) end |