[iscsi] Deux baies pour le prix d'une
This commit is contained in:
parent
d0d7f71576
commit
01eec6b164
7 changed files with 91 additions and 148 deletions
|
@ -1,10 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# baie_lib.py
|
||||
# nolslib.py
|
||||
# Ce script est inspiré de slonlib.py, développé par
|
||||
# Jérémie Dimino en 2008.
|
||||
# Développé pour communiquer en telnet avec une baie MSA 2012a (modèle à
|
||||
# vérifier), il a été adapté pour communiquer avec une MSA P2000, qui sait
|
||||
# retourner des sorties compatibles avec des api.
|
||||
# ----------
|
||||
# Type à taper si ça chie : Pierre-Elliott Bécue <peb@crans.org>
|
||||
# Licence : WTFPL
|
||||
# Auteur : Pierre-Elliott Bécue <peb@crans.org>
|
||||
# Licence : GPLv3
|
||||
|
||||
'''Bibliothèque pour accéder à la baie de stockage nols, récupère les données
|
||||
formatées en XML'''
|
||||
|
@ -109,40 +114,14 @@ class Nols(object):
|
|||
root = fromstring(XML_map)
|
||||
tree = ElementTree(root)
|
||||
|
||||
## Cf juste en dessous
|
||||
Objects = tree.findall("OBJECT")
|
||||
#Objects = tree.findall("OBJECT[@name='volume-view']")
|
||||
## Fin cf juste en dessous
|
||||
# XML c'est trobyien
|
||||
Objects = tree.findall("OBJECT[@name='volume-view']")
|
||||
|
||||
for Object in Objects:
|
||||
name = None
|
||||
lun = None
|
||||
# Quand on passera à wheezy, décommenter ces lignes, et virer
|
||||
# la merde que j'ai fait juste après.
|
||||
#name = Object.findall("PROPERTY[@name='volume-name']")[0].text
|
||||
#lun = Object.findall("OBJECT/PROPERTY[@name='lun']")[0].text
|
||||
|
||||
######## Début merde que j'ai faite juste après ###########
|
||||
if not (Object.attrib['name'] == "volume-view"):
|
||||
pass
|
||||
|
||||
properties = Object.findall("PROPERTY")
|
||||
for property in properties:
|
||||
if property.attrib['name'] == "volume-name":
|
||||
name = property.text
|
||||
else:
|
||||
pass
|
||||
|
||||
subObjects = Object.findall("OBJECT")
|
||||
for subObject in subObjects:
|
||||
properties = subObject.findall("PROPERTY")
|
||||
for property in properties:
|
||||
if property.attrib['name'] == "lun":
|
||||
lun = property.text
|
||||
else:
|
||||
pass
|
||||
####### Fin merde que j'ai faite juste après #############
|
||||
|
||||
name = Object.findall("PROPERTY[@name='volume-name']")[0].text
|
||||
lun = Object.findall("OBJECT/PROPERTY[@name='lun']")[0].text
|
||||
|
||||
if lun is None:
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue