Revision f96e3c4f
b/lib/backend.py | ||
---|---|---|
1117 | 1117 |
children.append(cdev) |
1118 | 1118 |
|
1119 | 1119 |
if as_primary or disk.AssembleOnSecondary(): |
1120 |
r_dev = bdev.AttachOrAssemble(disk.dev_type, disk.physical_id, children)
|
|
1120 |
r_dev = bdev.Assemble(disk.dev_type, disk.physical_id, children) |
|
1121 | 1121 |
r_dev.SetSyncSpeed(constants.SYNC_SPEED) |
1122 | 1122 |
result = r_dev |
1123 | 1123 |
if as_primary or disk.OpenOnSecondary(): |
b/lib/bdev.py | ||
---|---|---|
1680 | 1680 |
return device |
1681 | 1681 |
|
1682 | 1682 |
|
1683 |
def AttachOrAssemble(dev_type, unique_id, children):
|
|
1683 |
def Assemble(dev_type, unique_id, children): |
|
1684 | 1684 |
"""Try to attach or assemble an existing device. |
1685 | 1685 |
|
1686 |
This will attach to an existing assembled device or will assemble
|
|
1687 |
the device, as needed, to bring it fully up.
|
|
1686 |
This will attach to assemble the device, as needed, to bring it
|
|
1687 |
fully up. It must be safe to run on already-assembled devices.
|
|
1688 | 1688 |
|
1689 | 1689 |
""" |
1690 | 1690 |
if dev_type not in DEV_MAP: |
1691 | 1691 |
raise errors.ProgrammerError("Invalid block device type '%s'" % dev_type) |
1692 | 1692 |
device = DEV_MAP[dev_type](unique_id, children) |
1693 |
if not device.attached: |
|
1694 |
device.Assemble() |
|
1695 |
if not device.attached: |
|
1696 |
raise errors.BlockDeviceError("Can't find a valid block device for" |
|
1697 |
" %s/%s/%s" % |
|
1698 |
(dev_type, unique_id, children)) |
|
1693 |
if not device.Assemble(): |
|
1694 |
raise errors.BlockDeviceError("Can't find a valid block device for" |
|
1695 |
" %s/%s/%s" % |
|
1696 |
(dev_type, unique_id, children)) |
|
1699 | 1697 |
return device |
1700 | 1698 |
|
1701 | 1699 |
|
Also available in: Unified diff