Commit 0caf6485 authored by Iustin Pop's avatar Iustin Pop
Browse files

Improve out-of-minors handling

Currently, the out-of-minors handling is not very good: though both MD
and DRBD functions for finding an unused minor can return None, only the
DRBD code checks for this case.

This patch improves this by making the functions _FindUnusedMinor raise
an error instead of None, and gets rid of the one manual check for the
return value.

Reviewed-by: imsnah
parent 770fe0f9
......@@ -595,7 +595,7 @@ class MDRaid1(BlockDev):
i += 1
if i == 256:
logger.Error("Critical: Out of md minor numbers.")
return None
raise errors.BlockDeviceError("Can't find a free MD minor")
return i
......@@ -1022,8 +1022,7 @@ class DRBDev(BaseDRBD):
if match:
return int(
logger.Error("Error: no free drbd minors!")
return None
raise errors.BlockDeviceError("Can't find a free DRBD minor")
def _GetDevInfo(cls, minor):
......@@ -1296,8 +1295,6 @@ class DRBDev(BaseDRBD):
return result
minor = self._FindUnusedMinor()
if minor is None:
raise errors.BlockDeviceError("Not enough free minors for DRBD!")
need_localdev_teardown = False
if self._children[0]:
result = self._AssembleLocal(minor, self._children[0].dev_path,
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