def _CheckMetaSize(meta_device):
"""Check if the given meta device looks like a valid one.
- This currently only check the size, which must be around
+ This currently only checks the size, which must be around
128MiB.
"""
doesn't do anything to the supposed peer. If you need a fully
connected DRBD pair, you need to use this class on both hosts.
- The unique_id for the drbd device is the (local_ip, local_port,
- remote_ip, remote_port) tuple, and it must have two children: the
- data device and the meta_device. The meta device is checked for
- valid size and is zeroed on create.
+ The unique_id for the drbd device is a (local_ip, local_port,
+ remote_ip, remote_port, local_minor, secret) tuple, and it must have
+ two children: the data device and the meta_device. The meta device
+ is checked for valid size and is zeroed on create.
"""
_MAX_MINORS = 255
def _GetShowParser(cls):
"""Return a parser for `drbd show` output.
- This will either create or return an already-create parser for the
+ This will either create or return an already-created parser for the
output of the command `drbd show`.
"""
msg = ("Can't change syncer rate: %s - %s" %
(result.fail_reason, result.output))
logging.error(msg)
- return msg
+ return [msg]
return []
raise errors.ProgrammerError("Invalid block device type '%s'" % dev_type)
+def _VerifyDiskParams(disk):
+ """Verifies if all disk parameters are set.
+
+ """
+ missing = set(constants.DISK_LD_DEFAULTS[disk.dev_type]) - set(disk.params)
+ if missing:
+ raise errors.ProgrammerError("Block device is missing disk parameters: %s" %
+ missing)
+
+
def FindDevice(disk, children):
"""Search for an existing, assembled device.
"""
_VerifyDiskType(disk.dev_type)
- dev_params = objects.FillDict(constants.DISK_LD_DEFAULTS[disk.dev_type],
- disk.params)
device = DEV_MAP[disk.dev_type](disk.physical_id, children, disk.size,
- dev_params)
+ disk.params)
if not device.attached:
return None
return device
"""
_VerifyDiskType(disk.dev_type)
- dev_params = objects.FillDict(constants.DISK_LD_DEFAULTS[disk.dev_type],
- disk.params)
+ _VerifyDiskParams(disk)
device = DEV_MAP[disk.dev_type](disk.physical_id, children, disk.size,
- dev_params)
+ disk.params)
device.Assemble()
return device
"""
_VerifyDiskType(disk.dev_type)
- dev_params = objects.FillDict(constants.DISK_LD_DEFAULTS[disk.dev_type],
- disk.params)
+ _VerifyDiskParams(disk)
device = DEV_MAP[disk.dev_type].Create(disk.physical_id, children, disk.size,
- dev_params)
+ disk.params)
return device