Revision df4c2628 lib/backend.py
b/lib/backend.py | ||
---|---|---|
258 | 258 |
result.output) |
259 | 259 |
return result.output |
260 | 260 |
|
261 |
valid_line_re = re.compile("^ *([^|]+)\|([0-9.]+)\|([^|]{6})\|?$") |
|
261 | 262 |
for line in result.stdout.splitlines(): |
262 |
line = line.strip().rstrip(sep) |
|
263 |
name, size, attr = line.split(sep) |
|
264 |
if len(attr) != 6: |
|
265 |
attr = '------' |
|
263 |
line = line.strip() |
|
264 |
match = valid_line_re.match(line) |
|
265 |
if not match: |
|
266 |
logger.Error("Invalid line returned from lvs output: '%s'" % line) |
|
267 |
continue |
|
268 |
name, size, attr = match.groups() |
|
266 | 269 |
inactive = attr[4] == '-' |
267 | 270 |
online = attr[5] == 'o' |
268 | 271 |
lvs[name] = (size, inactive, online) |
Also available in: Unified diff