Commit c260fa25 authored by Iustin Pop's avatar Iustin Pop
Browse files

Make _GenerateDRBD8Branch accept different VG names



This is a small change to make this function take a list of VG names,
instead of a single one.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 1d39e245
...@@ -6527,17 +6527,18 @@ def _GenerateUniqueNames(lu, exts): ...@@ -6527,17 +6527,18 @@ def _GenerateUniqueNames(lu, exts):
return results return results
def _GenerateDRBD8Branch(lu, primary, secondary, size, vgname, names, iv_name, def _GenerateDRBD8Branch(lu, primary, secondary, size, vgnames, names,
p_minor, s_minor): iv_name, p_minor, s_minor):
"""Generate a drbd8 device complete with its children. """Generate a drbd8 device complete with its children.
""" """
assert len(vgnames) == len(names) == 2
port = lu.cfg.AllocatePort() port = lu.cfg.AllocatePort()
shared_secret = lu.cfg.GenerateDRBDSecret(lu.proc.GetECId()) shared_secret = lu.cfg.GenerateDRBDSecret(lu.proc.GetECId())
dev_data = objects.Disk(dev_type=constants.LD_LV, size=size, dev_data = objects.Disk(dev_type=constants.LD_LV, size=size,
logical_id=(vgname, names[0])) logical_id=(vgnames[0], names[0]))
dev_meta = objects.Disk(dev_type=constants.LD_LV, size=128, dev_meta = objects.Disk(dev_type=constants.LD_LV, size=128,
logical_id=(vgname, names[1])) logical_id=(vgnames[1], names[1]))
drbd_dev = objects.Disk(dev_type=constants.LD_DRBD8, size=size, drbd_dev = objects.Disk(dev_type=constants.LD_DRBD8, size=size,
logical_id=(primary, secondary, port, logical_id=(primary, secondary, port,
p_minor, s_minor, p_minor, s_minor,
...@@ -6593,7 +6594,8 @@ def _GenerateDiskTemplate(lu, template_name, ...@@ -6593,7 +6594,8 @@ def _GenerateDiskTemplate(lu, template_name,
disk_index = idx + base_index disk_index = idx + base_index
vg = disk.get("vg", vgname) vg = disk.get("vg", vgname)
disk_dev = _GenerateDRBD8Branch(lu, primary_node, remote_node, disk_dev = _GenerateDRBD8Branch(lu, primary_node, remote_node,
disk["size"], vg, names[idx*2:idx*2+2], disk["size"], [vg, vg],
names[idx*2:idx*2+2],
"disk/%d" % disk_index, "disk/%d" % disk_index,
minors[idx*2], minors[idx*2+1]) minors[idx*2], minors[idx*2+1])
disk_dev.mode = disk["mode"] disk_dev.mode = disk["mode"]
......
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