Commit 33bc6f01 authored by Iustin Pop's avatar Iustin Pop
Browse files

Some error message cleanups

Reviewed-by: imsnah
parent 9c793cfb
...@@ -1106,7 +1106,7 @@ def BlockdevCreate(disk, size, owner, on_primary, info): ...@@ -1106,7 +1106,7 @@ def BlockdevCreate(disk, size, owner, on_primary, info):
try: try:
crdev.Open() crdev.Open()
except errors.BlockDeviceError, err: except errors.BlockDeviceError, err:
errmsg = "Can't make child '%s' read-write: %s" (child, err) errmsg = "Can't make child '%s' read-write: %s" % (child, err)
logging.error(errmsg) logging.error(errmsg)
return False, errmsg return False, errmsg
clist.append(crdev) clist.append(crdev)
......
...@@ -1404,9 +1404,9 @@ class DRBD8(BaseDRBD): ...@@ -1404,9 +1404,9 @@ class DRBD8(BaseDRBD):
try: try:
self._ShutdownNet(minor) self._ShutdownNet(minor)
except errors.BlockDeviceError, err: except errors.BlockDeviceError, err:
_ThrowError("Device has correct local storage, wrong remote peer" _ThrowError("drbd%d: device has correct local storage, wrong"
" and is unable to disconnect in order to attach to" " remote peer and is unable to disconnect in order"
" the correct peer: %s", str(err)) " to attach to the correct peer: %s", minor, str(err))
# note: _AssembleNet also handles the case when we don't want # note: _AssembleNet also handles the case when we don't want
# local storage (i.e. one or more of the _[lr](host|port) is # local storage (i.e. one or more of the _[lr](host|port) is
# None) # None)
...@@ -1475,7 +1475,8 @@ class DRBD8(BaseDRBD): ...@@ -1475,7 +1475,8 @@ class DRBD8(BaseDRBD):
""" """
result = utils.RunCmd(["drbdsetup", cls._DevPath(minor), "down"]) result = utils.RunCmd(["drbdsetup", cls._DevPath(minor), "down"])
if result.failed: if result.failed:
_ThrowError("Can't shutdown drbd device: %s", result.output) _ThrowError("drbd%d: can't shutdown drbd device: %s",
minor, result.output)
def Shutdown(self): def Shutdown(self):
"""Shutdown the DRBD device. """Shutdown the DRBD device.
...@@ -1514,11 +1515,12 @@ class DRBD8(BaseDRBD): ...@@ -1514,11 +1515,12 @@ class DRBD8(BaseDRBD):
else: else:
in_use = False in_use = False
if in_use: if in_use:
_ThrowError("DRBD minor %d already in use at Create() time", aminor) _ThrowError("drbd%d: minor is already in use at Create() time", aminor)
meta = children[1] meta = children[1]
meta.Assemble() meta.Assemble()
if not meta.Attach(): if not meta.Attach():
raise errors.BlockDeviceError("Can't attach to meta device") _ThrowError("drbd%d: can't attach to meta device '%s'",
aminor, meta)
cls._CheckMetaSize(meta.dev_path) cls._CheckMetaSize(meta.dev_path)
cls._InitMeta(aminor, meta.dev_path) cls._InitMeta(aminor, meta.dev_path)
return cls(unique_id, children) return cls(unique_id, children)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment