Revision dcb93971 lib/backend.py
b/lib/backend.py | ||
---|---|---|
260 | 260 |
return utils.ListVolumeGroups() |
261 | 261 |
|
262 | 262 |
|
263 |
def NodeVolumes(): |
|
264 |
"""List all volumes on this node. |
|
265 |
|
|
266 |
""" |
|
267 |
result = utils.RunCmd(["lvs", "--noheadings", "--units=m", "--nosuffix", |
|
268 |
"--separator=|", |
|
269 |
"--options=lv_name,lv_size,devices,vg_name"]) |
|
270 |
if result.failed: |
|
271 |
logger.Error("Failed to list logical volumes, lvs output: %s" % |
|
272 |
result.output) |
|
273 |
return {} |
|
274 |
|
|
275 |
def parse_dev(dev): |
|
276 |
if '(' in dev: |
|
277 |
return dev.split('(')[0] |
|
278 |
else: |
|
279 |
return dev |
|
280 |
|
|
281 |
def map_line(line): |
|
282 |
return { |
|
283 |
'name': line[0].strip(), |
|
284 |
'size': line[1].strip(), |
|
285 |
'dev': parse_dev(line[2].strip()), |
|
286 |
'vg': line[3].strip(), |
|
287 |
} |
|
288 |
|
|
289 |
return [map_line(line.split('|')) for line in result.output.splitlines()] |
|
290 |
|
|
291 |
|
|
263 | 292 |
def BridgesExist(bridges_list): |
264 | 293 |
"""Check if a list of bridges exist on the current node |
265 | 294 |
|
Also available in: Unified diff