summaryrefslogtreecommitdiffstats
path: root/commands/storage/lmi/scripts/storage/lvm.py
diff options
context:
space:
mode:
authorJan Synacek <jsynacek@redhat.com>2014-02-26 13:58:07 +0100
committerJan Synacek <jsynacek@redhat.com>2014-02-26 14:04:21 +0100
commita4b523727df1cdba61fcd0a01c60a0359ef2c52f (patch)
treee93608d62c51715210a454fe3ee4cd3843da081c /commands/storage/lmi/scripts/storage/lvm.py
parent7e1e3f12432c27ad5433ac86e35ce0e482edd95b (diff)
downloadopenlmi-scripts-a4b523727df1cdba61fcd0a01c60a0359ef2c52f.tar.gz
openlmi-scripts-a4b523727df1cdba61fcd0a01c60a0359ef2c52f.tar.xz
openlmi-scripts-a4b523727df1cdba61fcd0a01c60a0359ef2c52f.zip
storage: dirty checks for thin provisioning support
Resolves trac tickets 276 and 277
Diffstat (limited to 'commands/storage/lmi/scripts/storage/lvm.py')
-rw-r--r--commands/storage/lmi/scripts/storage/lvm.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/commands/storage/lmi/scripts/storage/lvm.py b/commands/storage/lmi/scripts/storage/lvm.py
index 6c0a464..af76dcc 100644
--- a/commands/storage/lmi/scripts/storage/lvm.py
+++ b/commands/storage/lmi/scripts/storage/lvm.py
@@ -59,7 +59,11 @@ def get_lvs(ns, vgs=None):
else:
# No vgs supplied, list all LVs
for lv in ns.LMI_LVStorageExtent.instances():
- if not lv.ThinlyProvisioned:
+ # XXX workaround for https://fedorahosted.org/openlmi/ticket/277
+ supports_thin = 'ThinlyProvisioned' in lv.properties()
+ if not supports_thin:
+ yield lv
+ elif supports_thin and not lv.ThinlyProvisioned:
yield lv
def get_tlvs(ns, tps=None):
@@ -261,8 +265,13 @@ def get_vg_tps(ns, vg):
:param vg: Volume Group to examine.
:rtype: list of LMIInstance/CIM_StoragePool
"""
+ # XXX workaround for https://fedorahosted.org/openlmi/ticket/276
+ assoc_class = "LMI_VGAllocatedFromStoragePool"
+ if not assoc_class in ns.classes():
+ return []
+
vg = common.str2vg(ns, vg)
- return vg.associators(AssocClass="LMI_VGAllocatedFromStoragePool")
+ return vg.associators(AssocClass=assoc_class)
def get_tps(ns):
"""