Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Операционные системы » UNIX » Solaris COMSTAR и SCSI Target Mode Framework

Модерирует : ShriEkeR

 Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

Открыть новую тему     Написать ответ в эту тему

LevT



Platinum Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору

Since it is laborious to repeat this process multiple times for all the different combinations of host groups, zvols, and target groups necessary, it can be automated somewhat by setting the appropriate shell variables and running this script:
 
Automation Script for Adding Groups and Modifying Views

Цитата:
 
 #!/usr/bin/bash
#
# iscsiviewmod v0.1: Automation Script for Adding iSCSI Host/Target  
#                    Groups and Modifying View Entries on OpenSolaris
#
# Copyright (C) 2011  Chaz Chandler
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#                
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#                                
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
 
if [ $# -lt 6 ]; then
  echo "Usage: `/usr/bin/basename $0` targetgroup iscsitarget zvollunname zvollunnumber hostgroup iscsiinitiator0 [iscsiinitiator1 ... ]"
  exit 1
fi
 
# the new target group name to be created
targetgroup=$1  
shift
 
# the iscsi target name to be added
iscsitarget=$1  
shift
 
# the 32-digit name of the zvol (i.e., 600144F07132440000004D28127B0001)
zvollunname=$1
shift
 
# the LUN number of that zvol (shown by list-view of the above name)
zvollunnumber=$1  
shift
 
# the name of the host group that should be able to see the zvol
hostgroup=$1  
shift
 
# contains the the IQN(s) of the iSCSI initiator(s) to be added to the new host group
iscsiinitiators=$*
 
stmfadm="/usr/sbin/stmfadm"
 
# create the tg if it doesn't already exist and add the tgt to it
$stmfadm list-tg $targetgroup 2>/dev/null || $stmfadm create-tg $targetgroup
$stmfadm list-tg -v $targetgroup | /usr/bin/grep "Member: $iscsitarget" || {
  $stmfadm offline-target $iscsitarget
  $stmfadm add-tg-member -g $targetgroup $iscsitarget
  $stmfadm online-target $iscsitarget
}
 
# create the hg if it doesn't already exist and add given hosts to it
$stmfadm list-hg $hostgroup 2>/dev/null || $stmfadm create-hg $hostgroup
for initiator in $iscsiinitiators; do
  $stmfadm add-hg-member -g $hostgroup $initiator
done
$stmfadm remove-view -l $zvolluname 0
$stmfadm add-view -h $hostgroup -t $targetgroup -n $zvollunnumber $zvolluname
 
echo "Success:"
$stmfadm list-view -l $zvolluname
$stmfadm list-hg -v $hostgroup    
$stmfadm list-tg -v $targetgroup  
 

 
 
In case it wasn’t clear from the script, the arguments/shell vars should be:
 
$targetgroup is the new target group name to be created  
$iscsitarget the IQN of the iSCSI target to be added to the new target group  
$zvolluname is the 32-digit name of the zvol (i.e., 600144F07132440000004D28127B0001)  
$zvollunnumber is the LUN number of that zvol (shown by list-view of the above name)  
$hostgroup is the name of the host group that should be able to see the zvol  
$iscsiinitiators contains the the IQN(s) of the iSCSI initiator(s) to be added to the new host group  
The reader is encouraged to modify this script for their specific goals!
 
To continue the scenario, we want blade2’s BIOS to be able to access the boot zvol, and both ESXi hosts to be able to access both the boot zvol (to continue the boot process one the kernel is loaded from the BIOS’s iSCSI bootloader) and the shared VMFS zvol.
 
Using iscsiviewmod to create the set of groups and view entries# ./iscsiviewmod blade-boot-targets iqn.2011-01.local.chaznet:bladecenter-esxi-boot 600144F07132440000004D27127C0001 2 blade-boot-blade2 iqn.2011-01.local.chaznet:bladecenter-blade2-bios  
Success:
View Entry: 0
    Host group   : blade-boot-blade2
    Target group : blade-boot-targets
    LUN          : 2
Host Group: blade-boot-blade2
        Member: iqn.2011-01.local.chaznet:bladecenter-blade2-bios
Target Group: blade-boot-targets
        Member: iqn.2011-01.local.chaznet:bladecenter-esxi-boot
# ./iscsiviewmod blade-vmfs-targets iqn.2011-01.local.chaznet:bladecenter-esxi-vmfs 600144F07132440000004D275F7A0001 0 blade-esxi-hypervisors iqn.2011-01.local.chaznet:bladecenter-blade1-esxi iqn.2011-01.local.chaznet:bladecenter-blade2-esxi
Success:
View Entry: 0
    Host group   : blade-esxi-hypervisors
    Target group : blade-vmfs-targets
    LUN          : 0
Host Group: blade-esxi-hypervisors
        Member: iqn.2011-01.local.chaznet:bladecenter-blade1-esxi
        Member: iqn.2011-01.local.chaznet:bladecenter-blade2-esxi
Target Group: blade-vmfs-targets
        Member: iqn.2011-01.local.chaznet:bladecenter-esxi-vmfsFinally, we need two more view entries to allow the hypervisors to see their ESXi boot targets:
 
Adding the last view entry# stmfadm -h blade-esxi-hypervisors -t blade-boot-targets 600144F07132440000004D27127C0001
# stmfadm list-view -l 600144F07132440000004D27127C0001
View Entry: 0
    Host group   : blade-boot-blade2
    Target group : blade-boot-targets
    LUN          : 2
View Entry: 1
    Host group   : blade-esxi-hypervisors
    Target group : blade-boot-targets
    LUN          : 2
# stmfadm -h blade-esxi-hypervisors -t blade-boot-targets 600144F07132440000004D28127B0001
# stmfadm list-view -l 600144F07132440000004D28127B0001
View Entry: 0
    Host group   : blade-boot-blade1
    Target group : blade-boot-targets
    LUN          : 1
View Entry: 1
    Host group   : blade-esxi-hypervisors
    Target group : blade-boot-targets
    LUN          : 1

Всего записей: 17168 | Зарегистр. 14-10-2001 | Отправлено: 18:58 10-03-2012 | Исправлено: LevT, 19:42 10-03-2012
Открыть новую тему     Написать ответ в эту тему

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Операционные системы » UNIX » Solaris COMSTAR и SCSI Target Mode Framework


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru