_get_capacity_info fails when using long mount names or large storage due to multi-line df output
Bug #1336238 reported by
Maurice Leeflang
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Glance |
Fix Released
|
Undecided
|
Maurice Leeflang |
Bug Description
Glance version = 0.12.0 / 2014.1
In python package /usr/lib/
_get_capacity_
To determine the free space of a store, the python script executes df with option "--block-size=1", in later version (I noticed), this was changed into "-k" to work with kbytes, but in both situations, when the mountpoint name is too long, or the size is to big, the output of df will be multilined, resulting in an IndexError, because only one line is being searched for values.
Fix:
When adding the option -P (or in long form --portability), the output is Posix formatted, resulting in one line per filesystem output.
Regards,
Maurice Leeflang
Changed in glance: | |
assignee: | nobody → Maurice Leeflang (malicure) |
Changed in glance: | |
milestone: | none → juno-2 |
status: | Fix Committed → Fix Released |
Changed in glance: | |
milestone: | juno-2 → 2014.2 |
To post a comment you must log in.
diff --git a/glance/ store/filesyste m.py b/glance/ store/filesyste m.py store/filesyste m.py store/filesyste m.py store.base. Store):
index 5ad67f1..6c8ce66 100644
--- a/glance/
+++ b/glance/
@@ -356,7 +356,7 @@ class Store(glance.
"""
#Calculate total available space execute( "df", "-k", execute( "df", "-k","-P",
mount_point) [0].strip( "'\n'")
total_ available_ space = int(df. split(' \n')[1] .split( )[3]) * units.Ki
- df = processutils.
+ df = processutils.