Revision f96e3c4f lib/bdev.py
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