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

backend: rename AttachOrAssemble to Assemble

Since now the Assemble function is different than Attach, we rename this
backend function to show that the intent is to fully assemble the device
(and it's always allowed to modify the device).

Reviewed-by: ultrotter
parent 2d0c8319
......@@ -1117,7 +1117,7 @@ def _RecursiveAssembleBD(disk, owner, as_primary):
children.append(cdev)
if as_primary or disk.AssembleOnSecondary():
r_dev = bdev.AttachOrAssemble(disk.dev_type, disk.physical_id, children)
r_dev = bdev.Assemble(disk.dev_type, disk.physical_id, children)
r_dev.SetSyncSpeed(constants.SYNC_SPEED)
result = r_dev
if as_primary or disk.OpenOnSecondary():
......
......@@ -1680,22 +1680,20 @@ def FindDevice(dev_type, unique_id, children):
return device
def AttachOrAssemble(dev_type, unique_id, children):
def Assemble(dev_type, unique_id, children):
"""Try to attach or assemble an existing device.
This will attach to an existing assembled device or will assemble
the device, as needed, to bring it fully up.
This will attach to assemble the device, as needed, to bring it
fully up. It must be safe to run on already-assembled devices.
"""
if dev_type not in DEV_MAP:
raise errors.ProgrammerError("Invalid block device type '%s'" % dev_type)
device = DEV_MAP[dev_type](unique_id, children)
if not device.attached:
device.Assemble()
if not device.attached:
raise errors.BlockDeviceError("Can't find a valid block device for"
" %s/%s/%s" %
(dev_type, unique_id, children))
if not device.Assemble():
raise errors.BlockDeviceError("Can't find a valid block device for"
" %s/%s/%s" %
(dev_type, unique_id, children))
return device
......
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