core/rails/lib/barclamp_raid/lsi_ircu.rb
#       Issue the command to create a RAID volue:
#         The format of the CREATE command is
#       sas2ircu <controller #> create <volume type> <size>
#       <Encl:Bay> [Volume Name] [noprompt]
#       where <controller #> is:
#       A controller number between 0 and 255.
#         where <volume type> is:
#         The type of the volume to create and is either RAID1 (or)
#       RAID1E (or) RAID0 (or) RAID10.
#         where <size> is:
#         The size of the volume to create. It should be given in Mbytes
#       e.g. 2048 or 'MAX' to use the maximum size possible.
#         where <Encl:Bay> is:
#         A list of Encl:Bay pairs identifying the disk drives you
#       wish to include in the volume being created. If the volume type is
#       'RAID1', the first drive will be selected as the primary and the
#       second as the secondary drive.
#         For a type 'RAID1' volume exactly 2 disks must be specified.
#         For a type 'RAID1E' volume min of 3 disks must be specified.
#         For a type 'RAID0' volume min of 2 disks must be specified.
#         For a type 'RAID10' volume min of 4 disks must be specified.
#         where [Volume Name] is an optional argument that can be used
#       to identify a Volume with a user specified Alpha-numeric string
#       where noprompt is an optional argument that eliminates
#       warnings and prompts
Issue the command to create a RAID volue:
The format of the CREATE command is
sas2ircu  create  
 [Volume Name] [noprompt]
where  is:
A controller number between 0 and 255.
where  is:
The type of the volume to create and is either RAID1 (or)
RAID1E (or) RAID0 (or) RAID10.
where  is:
The size of the volume to create. It should be given in Mbytes
e.g. 2048 or 'MAX' to use the maximum size possible.
where  is:
A list of Encl:Bay pairs identifying the disk drives you
wish to include in the volume being created. If the volume type is
'RAID1', the first drive will be selected as the primary and the
second as the secondary drive.
For a type 'RAID1' volume exactly 2 disks must be specified.
For a type 'RAID1E' volume min of 3 disks must be specified.
For a type 'RAID0' volume min of 2 disks must be specified.
For a type 'RAID10' volume min of 4 disks must be specified.
where [Volume Name] is an optional argument that can be used
to identify a Volume with a user specified Alpha-numeric string
where noprompt is an optional argument that eliminates
warnings and prompts
Issue the command to create a RAID volue : The format of the CREATE command is sas2ircu create [ Volume Name ] [ noprompt ] where is : A controller number between 0 and 255 . where is : The type of the volume to create and is either RAID1 ( or ) RAID1E ( or ) RAID0 ( or ) RAID10 . where is : The size of the volume to create . It should be given in Mbytes e . g . 2048 or ' MAX ' to use the maximum size possible . where is : A list of Encl : Bay pairs identifying the disk drives you wish to include in the volume being created . If the volume type is ' RAID1 ' the first drive will be selected as the primary and the second as the secondary drive . For a type ' RAID1 ' volume exactly 2 disks must be specified . For a type ' RAID1E ' volume min of 3 disks must be specified . For a type ' RAID0 ' volume min of 2 disks must be specified . For a type ' RAID10 ' volume min of 4 disks must be specified . where [ Volume Name ] is an optional argument that can be used to identify a Volume with a user specified Alpha - numeric string where noprompt is an optional argument that eliminates warnings and prompts
def create_vd(controller, volume)
      max_size       = (Rebar::RAID::TERA * 2 - Rebar::RAID::MEGA) / Rebar::RAID::MEGA
      size           = nil
      curr_boot_mode = nil
      pend_boot_mode = nil
      vol_type       = INV_MAP[volume[:type]]
      name           = ""
      name           = volume[:name] if volume[:name]
      cid            = controller.controller_id
      no_boot_mode   = false
      if (@nodeinfo["rebar_wall"] and @nodeinfo["rebar_wall"]["track"] and @nodeinfo["rebar_wall"]["track"]["bios_settings"] and @nodeinfo["rebar_wall"]["track"]["bios_settings"]["boot_mode"])
        boot_mode_data = @nodeinfo["rebar_wall"]["track"]["bios_settings"]["boot_mode"]
        curr_boot_mode = boot_mode_data["current"].to_s if (boot_mode_data)
        pend_boot_mode = boot_mode_data["desired"].to_s if (boot_mode_data)
        @logger << "Current boot mode  = #{curr_boot_mode}\n" if @logger
        @logger << "Pending boot mode  = #{pend_boot_mode}\n" if @logger
      else
        @logger << "Unable to determine boot mode from CB wall..defaulting to BIOS mode\n" if @logger
        no_boot_mode = true
      end
      @logger << "create_vd: ircu doesn't support setting stripe size\n" if volume[:stripe_size] && @logger
      if (volume[:type] == :RAID10 and volume[:disks].length > MAX_RAID10_DISKS)
        numDisks = volume[:disks].length - 1
        if (numDisks and numDisks > MAX_RAID10_DISKS)
          volume[:disks].slice!(MAX_RAID10_DISKS, numDisks)
        end
      end
      disk_ids = []
      volume[:disks].each do |d|
        disk_ids << "#{d.enclosure}:#{d.slot}"
      end
      if (volume[:type] == :JBOD or !vol_type)
        @logger << "Not creating JBODs using sas2ircu...Exiting\n" if @logger
        return
      end
      size = get_array_size(volume) if (!volume[:size] or volume[:size] == "MAX")
      if ( (pend_boot_mode and pend_boot_mode == "bios") or (curr_boot_mode and curr_boot_mode == "bios") or (no_boot_mode == true))
        if (!size)
          size = "MAX"
        else
          size = max_size if (max_size < size)
        end
      end
      @logger << "Creating VD with size of #{size}\n" if @logger
      text = ""
      run_tool(0, nil, [cid, "create", vol_type, size, disk_ids.join(" "), "'#{name}'", "noprompt"]){ |f|
        text = f.readlines
      }
      @logger << text if @logger
      text.to_s.strip
    rescue
      @logger << "create returned: #{text}\n" if @logger
      raise
    end
def create_vd ( controller , volume ) max_size = ( Rebar :: RAID :: TERA * 2 - Rebar :: RAID :: MEGA ) / Rebar :: RAID :: MEGA size = nil curr_boot_mode = nil pend_boot_mode = nil vol_type = INV_MAP [ volume [ :type ] ] name = "" name = volume [ :name ] if volume [ :name ] cid = controller . controller_id no_boot_mode = false if ( @nodeinfo [ "rebar_wall" ] and @nodeinfo [ "rebar_wall" ] [ "track" ] and @nodeinfo [ "rebar_wall" ] [ "track" ] [ "bios_settings" ] and @nodeinfo [ "rebar_wall" ] [ "track" ] [ "bios_settings" ] [ "boot_mode" ] ) boot_mode_data = @nodeinfo [ "rebar_wall" ] [ "track" ] [ "bios_settings" ] [ "boot_mode" ] curr_boot_mode = boot_mode_data [ "current" ] . to_s if ( boot_mode_data ) pend_boot_mode = boot_mode_data [ "desired" ] . to_s if ( boot_mode_data ) @logger << "Current boot mode  = #{curr_boot_mode}\n" if @logger @logger << "Pending boot mode  = #{pend_boot_mode}\n" if @logger else @logger << "Unable to determine boot mode from CB wall..defaulting to BIOS mode\n" if @logger no_boot_mode = true end @logger << "create_vd: ircu doesn't support setting stripe size\n" if volume [ :stripe_size ] && @logger if ( volume [ :type ] == :RAID10 and volume [ :disks ] . length > MAX_RAID10_DISKS ) numDisks = volume [ :disks ] . length - 1 if ( numDisks and numDisks > MAX_RAID10_DISKS ) volume [ :disks ] . slice! ( MAX_RAID10_DISKS , numDisks ) end end disk_ids = [ ] volume [ :disks ] . each do | d | disk_ids << "#{d.enclosure}:#{d.slot}" end if ( volume [ :type ] == :JBOD or ! vol_type ) @logger << "Not creating JBODs using sas2ircu...Exiting\n" if @logger return end size = get_array_size ( volume ) if ( ! volume [ :size ] or volume [ :size ] == "MAX" ) if ( ( pend_boot_mode and pend_boot_mode == "bios" ) or ( curr_boot_mode and curr_boot_mode == "bios" ) or ( no_boot_mode == true ) ) if ( ! size ) size = "MAX" else size = max_size if ( max_size < size ) end end @logger << "Creating VD with size of #{size}\n" if @logger text = "" run_tool ( 0 , nil , [ cid , "create" , vol_type , size , disk_ids . join ( " " ) , "'#{name}'" , "noprompt" ] ) { | f | text = f . readlines } @logger << text if @logger text . to_s . strip rescue @logger << "create returned: #{text}\n" if @logger raise end
Issue the command to create a RAID volue:
The format of the CREATE command is
sas2ircu <controller #> create <volume type> <size>
<Encl:Bay> [Volume Name] [noprompt]
where <controller #> is:
A controller number between 0 and 255.
where <volume type> is:
The type of the volume to create and is either RAID1 (or)
RAID1E (or) RAID0 (or) RAID10.
Issue the command to create a RAID volue : The format of the CREATE command is sas2ircu <controller # > create <volume type > <size > <Encl : Bay > [ Volume Name ] [ noprompt ] where <controller # > is : A controller number between 0 and 255 . where <volume type > is : The type of the volume to create and is either RAID1 ( or ) RAID1E ( or ) RAID0 ( or ) RAID10 .
## build up the command... ## Limit the number of disks being used if it's a RAID 10 array
controller
<not_specific>
volume
<not_specific>