Merge remote-tracking branch 'qubesos/pr/149'
* qubesos/pr/149: lvm->init_cache: fix incorrect max splits Fix service qubesd not working with some locales
This commit is contained in:
commit
86681ba996
@ -142,7 +142,7 @@ class ThinPool(qubes.storage.Pool):
|
||||
def init_cache(log=logging.getLogger('qubes.storage.lvm')):
|
||||
cmd = ['lvs', '--noheadings', '-o',
|
||||
'vg_name,pool_lv,name,lv_size,data_percent,lv_attr,origin',
|
||||
'--units', 'b', '--separator', ',']
|
||||
'--units', 'b', '--separator', ';']
|
||||
if os.getuid() != 0:
|
||||
cmd.insert(0, 'sudo')
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||
@ -159,11 +159,11 @@ def init_cache(log=logging.getLogger('qubes.storage.lvm')):
|
||||
for line in out.splitlines():
|
||||
line = line.decode().strip()
|
||||
pool_name, pool_lv, name, size, usage_percent, attr, \
|
||||
origin = line.split(',', 6)
|
||||
origin = line.split(';', 6)
|
||||
if '' in [pool_name, pool_lv, name, size, usage_percent]:
|
||||
continue
|
||||
name = pool_name + "/" + name
|
||||
size = int(size[:-1])
|
||||
size = int(size[:-1]) # Remove 'B' suffix
|
||||
usage = int(size / 100 * float(usage_percent))
|
||||
result[name] = {'size': size, 'usage': usage, 'pool_lv': pool_lv,
|
||||
'attr': attr, 'origin': origin}
|
||||
|
Loading…
Reference in New Issue
Block a user