Revision de12473a
b/lib/cmdlib.py | ||
---|---|---|
3730 | 3730 |
if not force_create: |
3731 | 3731 |
return |
3732 | 3732 |
|
3733 |
_CreateSingleBlockDev(lu, node, instance, device, info, force_open) |
|
3734 |
|
|
3735 |
|
|
3736 |
def _CreateSingleBlockDev(lu, node, instance, device, info, force_open): |
|
3737 |
"""Create a single block device on a given node. |
|
3738 |
|
|
3739 |
This will not recurse over children of the device, so they must be |
|
3740 |
created in advance. |
|
3741 |
|
|
3742 |
@param lu: the lu on whose behalf we execute |
|
3743 |
@param node: the node on which to create the device |
|
3744 |
@type instance: L{objects.Instance} |
|
3745 |
@param instance: the instance which owns the device |
|
3746 |
@type device: L{objects.Disk} |
|
3747 |
@param device: the device to create |
|
3748 |
@param info: the extra 'metadata' we should attach to the device |
|
3749 |
(this will be represented as a LVM tag) |
|
3750 |
@type force_open: boolean |
|
3751 |
@param force_open: this parameter will be passes to the |
|
3752 |
L{backend.CreateBlockDevice} function where it specifies |
|
3753 |
whether we run on primary or not, and it affects both |
|
3754 |
the child assembly and the device own Open() execution |
|
3755 |
|
|
3756 |
""" |
|
3733 | 3757 |
lu.cfg.SetDiskID(device, node) |
3734 | 3758 |
new_id = lu.rpc.call_blockdev_create(node, device, device.size, |
3735 | 3759 |
instance.name, force_open, info) |
3736 | 3760 |
if new_id.failed or not new_id.data: |
3737 | 3761 |
raise errors.OpExecError("Can't create block device %s on" |
3738 |
" node %s" % (device, node)) |
|
3762 |
" node %s for instance %s" % |
|
3763 |
(device, node, instance.name)) |
|
3739 | 3764 |
if device.physical_id is None: |
3740 | 3765 |
device.physical_id = new_id |
3741 | 3766 |
|
... | ... | |
5017 | 5042 |
logical_id=new_alone_id, |
5018 | 5043 |
children=dev.children) |
5019 | 5044 |
try: |
5020 |
_CreateBlockDev(self, new_node, instance, new_drbd, False,
|
|
5021 |
_GetInstanceInfoText(instance), False) |
|
5045 |
_CreateSingleBlockDev(self, new_node, instance, new_drbd,
|
|
5046 |
_GetInstanceInfoText(instance), False)
|
|
5022 | 5047 |
except error.BlockDeviceError: |
5023 | 5048 |
self.cfg.ReleaseDRBDMinors(instance.name) |
5024 | 5049 |
raise |
Also available in: Unified diff