[iscsi] Deux baies, suite et fin
This commit is contained in:
parent
01eec6b164
commit
b843c80153
3 changed files with 11 additions and 7 deletions
|
@ -47,7 +47,7 @@ def get_mapping(baie_name):
|
|||
# -*- coding: utf-8 -*-
|
||||
# Fichier de mapping lun -> nom de volume
|
||||
#
|
||||
# Ce fichier est généré par %s
|
||||
# Ce fichier est généré par %s %s
|
||||
|
||||
map = {
|
||||
""" % (sys.argv[0], baie)).encode(coding))
|
||||
|
|
|
@ -15,8 +15,8 @@ import os
|
|||
sys.path.append("/usr/scripts/gestion")
|
||||
from config import ISCSI_MAP_FILE
|
||||
|
||||
def getname(device):
|
||||
map_file = ISCSI_MAP_FILE
|
||||
def getname(device, baie):
|
||||
map_file = ISCSI_MAP_FILE % (baie,)
|
||||
|
||||
if not device.isalpha():
|
||||
block = "".join([i for i in device if i.isalpha()])
|
||||
|
|
|
@ -27,9 +27,13 @@ def store_iscsi_volumes():
|
|||
for line in state:
|
||||
line = line.replace('\n', '')
|
||||
if line.startswith('ip-'):
|
||||
if "storage.p2000g3" in line:
|
||||
baie = "nols"
|
||||
else:
|
||||
baie = "slon"
|
||||
device = os.readlink(PATH+line) # de la forme ../../sdb42
|
||||
device = device.rsplit('/', 1)[1]
|
||||
symlink = 'iscsi_' + ugin.getname(device)
|
||||
symlink = 'iscsi_' + ugin.getname(device, baie)
|
||||
if line.rsplit('-', 1)[1][0:4] == "part":
|
||||
lun = line.rsplit('-', 2)[1]
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue