Revision 6c896e2f lib/bdev.py
b/lib/bdev.py | ||
---|---|---|
308 | 308 |
result = utils.RunCmd(["lvcreate", "-L%dm" % size, "-n%s" % lv_name, |
309 | 309 |
vg_name] + pvlist) |
310 | 310 |
if result.failed: |
311 |
raise errors.BlockDeviceError(result.fail_reason) |
|
311 |
raise errors.BlockDeviceError("%s - %s" % (result.fail_reason, |
|
312 |
result.output)) |
|
312 | 313 |
return LogicalVolume(unique_id, children) |
313 | 314 |
|
314 | 315 |
@staticmethod |
... | ... | |
327 | 328 |
"--separator=:"] |
328 | 329 |
result = utils.RunCmd(command) |
329 | 330 |
if result.failed: |
330 |
logger.Error("Can't get the PV information: %s" % result.fail_reason) |
|
331 |
logger.Error("Can't get the PV information: %s - %s" % |
|
332 |
(result.fail_reason, result.output)) |
|
331 | 333 |
return None |
332 | 334 |
data = [] |
333 | 335 |
for line in result.stdout.splitlines(): |
... | ... | |
352 | 354 |
result = utils.RunCmd(["lvremove", "-f", "%s/%s" % |
353 | 355 |
(self._vg_name, self._lv_name)]) |
354 | 356 |
if result.failed: |
355 |
logger.Error("Can't lvremove: %s" % result.fail_reason) |
|
357 |
logger.Error("Can't lvremove: %s - %s" % |
|
358 |
(result.fail_reason, result.output)) |
|
356 | 359 |
|
357 | 360 |
return not result.failed |
358 | 361 |
|
... | ... | |
441 | 444 |
""" |
442 | 445 |
result = utils.RunCmd(["lvs", "--noheadings", "-olv_attr", self.dev_path]) |
443 | 446 |
if result.failed: |
444 |
logger.Error("Can't display lv: %s" % result.fail_reason) |
|
447 |
logger.Error("Can't display lv: %s - %s" % |
|
448 |
(result.fail_reason, result.output)) |
|
445 | 449 |
return None, None, True, True |
446 | 450 |
out = result.stdout.strip() |
447 | 451 |
# format: type/permissions/alloc/fixed_minor/state/open |
... | ... | |
492 | 496 |
result = utils.RunCmd(["lvcreate", "-L%dm" % size, "-s", |
493 | 497 |
"-n%s" % snap_name, self.dev_path]) |
494 | 498 |
if result.failed: |
495 |
raise errors.BlockDeviceError("command: %s error: %s" % |
|
496 |
(result.cmd, result.fail_reason)) |
|
499 |
raise errors.BlockDeviceError("command: %s error: %s - %s" % |
|
500 |
(result.cmd, result.fail_reason, |
|
501 |
result.output)) |
|
497 | 502 |
|
498 | 503 |
return snap_name |
499 | 504 |
|
... | ... | |
513 | 518 |
result = utils.RunCmd(["lvchange", "--addtag", text, |
514 | 519 |
self.dev_path]) |
515 | 520 |
if result.failed: |
516 |
raise errors.BlockDeviceError("Command: %s error: %s" % |
|
517 |
(result.cmd, result.fail_reason)) |
|
521 |
raise errors.BlockDeviceError("Command: %s error: %s - %s" % |
|
522 |
(result.cmd, result.fail_reason, |
|
523 |
result.output)) |
|
518 | 524 |
|
519 | 525 |
|
520 | 526 |
class MDRaid1(BlockDev): |
... | ... | |
572 | 578 |
""" |
573 | 579 |
result = utils.RunCmd(["mdadm", "-D", "/dev/md%d" % minor]) |
574 | 580 |
if result.failed: |
575 |
logger.Error("Can't display md: %s" % result.fail_reason) |
|
581 |
logger.Error("Can't display md: %s - %s" % |
|
582 |
(result.fail_reason, result.output)) |
|
576 | 583 |
return None |
577 | 584 |
retval = {} |
578 | 585 |
for line in result.stdout.splitlines(): |
... | ... | |
826 | 833 |
|
827 | 834 |
result = utils.RunCmd(["mdadm", "--stop", "/dev/md%d" % self.minor]) |
828 | 835 |
if result.failed: |
829 |
logger.Error("Can't stop MD array: %s" % result.fail_reason) |
|
836 |
logger.Error("Can't stop MD array: %s - %s" % |
|
837 |
(result.fail_reason, result.output)) |
|
830 | 838 |
return False |
831 | 839 |
self.minor = None |
832 | 840 |
self.dev_path = None |
... | ... | |
1048 | 1056 |
""" |
1049 | 1057 |
result = utils.RunCmd(["blockdev", "--getsize", meta_device]) |
1050 | 1058 |
if result.failed: |
1051 |
logger.Error("Failed to get device size: %s" % result.fail_reason) |
|
1059 |
logger.Error("Failed to get device size: %s - %s" % |
|
1060 |
(result.fail_reason, result.output)) |
|
1052 | 1061 |
return False |
1053 | 1062 |
try: |
1054 | 1063 |
sectors = int(result.stdout) |
... | ... | |
1128 | 1137 |
data = {} |
1129 | 1138 |
result = utils.RunCmd(["drbdsetup", cls._DevPath(minor), "show"]) |
1130 | 1139 |
if result.failed: |
1131 |
logger.Error("Can't display the drbd config: %s" % result.fail_reason) |
|
1140 |
logger.Error("Can't display the drbd config: %s - %s" % |
|
1141 |
(result.fail_reason, result.output)) |
|
1132 | 1142 |
return data |
1133 | 1143 |
out = result.stdout |
1134 | 1144 |
if out == "Not configured\n": |
... | ... | |
1278 | 1288 |
"%s:%s" % (lhost, lport), "%s:%s" % (rhost, rport), |
1279 | 1289 |
protocol]) |
1280 | 1290 |
if result.failed: |
1281 |
logger.Error("Can't setup network for dbrd device: %s" % |
|
1282 |
result.fail_reason)
|
|
1291 |
logger.Error("Can't setup network for dbrd device: %s - %s" %
|
|
1292 |
(result.fail_reason, result.output))
|
|
1283 | 1293 |
return False |
1284 | 1294 |
|
1285 | 1295 |
timeout = time.time() + 10 |
... | ... | |
1450 | 1460 |
result = utils.RunCmd(["drbdsetup", self.dev_path, "syncer", "-r", "%d" % |
1451 | 1461 |
kbytes]) |
1452 | 1462 |
if result.failed: |
1453 |
logger.Error("Can't change syncer rate: %s " % result.fail_reason) |
|
1463 |
logger.Error("Can't change syncer rate: %s - %s" % |
|
1464 |
(result.fail_reason, result.output)) |
|
1454 | 1465 |
return not result.failed and children_result |
1455 | 1466 |
|
1456 | 1467 |
def GetSyncStatus(self): |
... | ... | |
1685 | 1696 |
""" |
1686 | 1697 |
result = utils.RunCmd(["drbdsetup", cls._DevPath(minor), "show"]) |
1687 | 1698 |
if result.failed: |
1688 |
logger.Error("Can't display the drbd config: %s" % result.fail_reason) |
|
1699 |
logger.Error("Can't display the drbd config: %s - %s" % |
|
1700 |
(result.fail_reason, result.output)) |
|
1689 | 1701 |
return None |
1690 | 1702 |
return result.stdout |
1691 | 1703 |
|
... | ... | |
1825 | 1837 |
args.extend(["-a", hmac, "-x", secret]) |
1826 | 1838 |
result = utils.RunCmd(args) |
1827 | 1839 |
if result.failed: |
1828 |
logger.Error("Can't setup network for dbrd device: %s" % |
|
1829 |
result.fail_reason)
|
|
1840 |
logger.Error("Can't setup network for dbrd device: %s - %s" %
|
|
1841 |
(result.fail_reason, result.output))
|
|
1830 | 1842 |
return False |
1831 | 1843 |
|
1832 | 1844 |
timeout = time.time() + 10 |
... | ... | |
1913 | 1925 |
result = utils.RunCmd(["drbdsetup", self.dev_path, "syncer", "-r", "%d" % |
1914 | 1926 |
kbytes]) |
1915 | 1927 |
if result.failed: |
1916 |
logger.Error("Can't change syncer rate: %s " % result.fail_reason) |
|
1928 |
logger.Error("Can't change syncer rate: %s - %s" % |
|
1929 |
(result.fail_reason, result.output)) |
|
1917 | 1930 |
return not result.failed and children_result |
1918 | 1931 |
|
1919 | 1932 |
def GetSyncStatus(self): |
Also available in: Unified diff