diff --git a/lib/backend.py b/lib/backend.py index 7c4d2d763166fd2225f60d91d533469f46cee583..9ebab3b720c2a2393491d0d6e3d66b7abd0a322d 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -1106,7 +1106,7 @@ def BlockdevCreate(disk, size, owner, on_primary, info): try: crdev.Open() 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) return False, errmsg clist.append(crdev) diff --git a/lib/bdev.py b/lib/bdev.py index 49fd3e3f0b9944b4e3421b5660efb82e87951e3b..bb1b2bdad7137cc948cb95d21e11dd09e60bf587 100644 --- a/lib/bdev.py +++ b/lib/bdev.py @@ -1404,9 +1404,9 @@ class DRBD8(BaseDRBD): try: self._ShutdownNet(minor) except errors.BlockDeviceError, err: - _ThrowError("Device has correct local storage, wrong remote peer" - " and is unable to disconnect in order to attach to" - " the correct peer: %s", str(err)) + _ThrowError("drbd%d: device has correct local storage, wrong" + " remote peer and is unable to disconnect in order" + " to attach to the correct peer: %s", minor, str(err)) # note: _AssembleNet also handles the case when we don't want # local storage (i.e. one or more of the _[lr](host|port) is # None) @@ -1475,7 +1475,8 @@ class DRBD8(BaseDRBD): """ result = utils.RunCmd(["drbdsetup", cls._DevPath(minor), "down"]) 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): """Shutdown the DRBD device. @@ -1514,11 +1515,12 @@ class DRBD8(BaseDRBD): else: in_use = False 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.Assemble() 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._InitMeta(aminor, meta.dev_path) return cls(unique_id, children)