[Baie de disques] On remplace slon par nols là où c'est bien.
Ignore-this: 26bbaee2a355c1c1b8170d1fa58aea59 darcs-hash:20120807200036-ab199-cfb522d47031cd8ecca7c8961f430d9034df6315.gz
This commit is contained in:
parent
9e4d3f9ab4
commit
209719cfc1
3 changed files with 197 additions and 2 deletions
54
gestion/iscsi/nols-get-volume-mapping.py
Executable file
54
gestion/iscsi/nols-get-volume-mapping.py
Executable file
|
@ -0,0 +1,54 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# nols-get-volume-mapping.py
|
||||
# --------------------------
|
||||
# Qui taper si ça marche pas : Pierre-Elliott Bécue <peb@crans.org>
|
||||
# Merci à : Jérémie Dimino <jeremie@dimino.org>, je n'ai fait que s/slon/nols/ sur ce script.
|
||||
# Licence : BSD3
|
||||
|
||||
u'''Outil pour récupérer le mapping lun/volume depuis la baie de
|
||||
stockage'''
|
||||
|
||||
import nolslib, re, sys
|
||||
|
||||
sys.path.append("/usr/scripts/gestion")
|
||||
from config import ISCSI_MAP_FILE
|
||||
import affich_tools
|
||||
|
||||
print u"Connexion à la baie de stockage..."
|
||||
|
||||
nols = nolslib.Nols()
|
||||
|
||||
print u"Récupération des informations..."
|
||||
|
||||
map = nols.volume_map().items()
|
||||
map.sort()
|
||||
|
||||
print u"Déconnexion..."
|
||||
|
||||
nols.logout()
|
||||
|
||||
print u"Enregistrement des informations..."
|
||||
|
||||
f = open(ISCSI_MAP_FILE, "w")
|
||||
f.write((u"""\
|
||||
# -*- coding: utf-8 -*-
|
||||
# Fichier de mapping lun -> nom de volume
|
||||
#
|
||||
# Ce fichier est généré par %s
|
||||
|
||||
map = {
|
||||
""" % sys.argv[0]).encode("UTF-8"))
|
||||
|
||||
for lun, name in map:
|
||||
f.write(' %d : "%s",\n' % (lun, name))
|
||||
|
||||
f.write("}\n")
|
||||
|
||||
f.close()
|
||||
|
||||
print u"Terminé, mapping enregistré dans %s" % ISCSI_MAP_FILE
|
||||
|
||||
print u"Le mapping actuel est:"
|
||||
print affich_tools.tableau(titre = ["lun", "nom"], data = map, alignement = ["g", "c"])
|
Loading…
Add table
Add a link
Reference in a new issue