Revision 7181fba0 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
8200 | 8200 |
self._GoReconnect(False) |
8201 | 8201 |
self._WaitUntilSync() |
8202 | 8202 |
|
8203 |
# If the instance's disk template is `rbd' and there was a successful |
|
8204 |
# migration, unmap the device from the source node. |
|
8205 |
if self.instance.disk_template == constants.DT_RBD: |
|
8206 |
disks = _ExpandCheckDisks(instance, instance.disks) |
|
8207 |
self.feedback_fn("* unmapping instance's disks from %s" % source_node) |
|
8208 |
for disk in disks: |
|
8209 |
result = self.rpc.call_blockdev_shutdown(source_node, disk) |
|
8210 |
msg = result.fail_msg |
|
8211 |
if msg: |
|
8212 |
logging.error("Migration was successful, but couldn't unmap the" |
|
8213 |
" block device %s on source node %s: %s", |
|
8214 |
disk.iv_name, source_node, msg) |
|
8215 |
logging.error("You need to unmap the device %s manually on %s", |
|
8216 |
disk.iv_name, source_node) |
|
8217 |
|
|
8203 | 8218 |
self.feedback_fn("* done") |
8204 | 8219 |
|
8205 | 8220 |
def _ExecFailover(self): |
... | ... | |
8467 | 8482 |
elif disk_template == constants.DT_BLOCK: |
8468 | 8483 |
result.append(constants.DISK_LD_DEFAULTS[constants.LD_BLOCKDEV]) |
8469 | 8484 |
|
8485 |
elif disk_template == constants.DT_RBD: |
|
8486 |
params = { |
|
8487 |
constants.LDP_POOL: dt_params[constants.RBD_POOL] |
|
8488 |
} |
|
8489 |
params = \ |
|
8490 |
objects.FillDict(constants.DISK_LD_DEFAULTS[constants.LD_RBD], |
|
8491 |
params) |
|
8492 |
result.append(params) |
|
8493 |
|
|
8470 | 8494 |
return result |
8471 | 8495 |
|
8472 | 8496 |
|
... | ... | |
8603 | 8627 |
mode=disk[constants.IDISK_MODE], |
8604 | 8628 |
params=ld_params[0]) |
8605 | 8629 |
disks.append(disk_dev) |
8630 |
elif template_name == constants.DT_RBD: |
|
8631 |
if secondary_nodes: |
|
8632 |
raise errors.ProgrammerError("Wrong template configuration") |
|
8633 |
|
|
8634 |
names = _GenerateUniqueNames(lu, [".rbd.disk%d" % (base_index + i) |
|
8635 |
for i in range(disk_count)]) |
|
8636 |
|
|
8637 |
for idx, disk in enumerate(disk_info): |
|
8638 |
disk_index = idx + base_index |
|
8639 |
disk_dev = objects.Disk(dev_type=constants.LD_RBD, |
|
8640 |
size=disk[constants.IDISK_SIZE], |
|
8641 |
logical_id=("rbd", names[idx]), |
|
8642 |
iv_name="disk/%d" % disk_index, |
|
8643 |
mode=disk[constants.IDISK_MODE], |
|
8644 |
params=ld_params[0]) |
|
8645 |
disks.append(disk_dev) |
|
8606 | 8646 |
|
8607 | 8647 |
else: |
8608 | 8648 |
raise errors.ProgrammerError("Invalid disk template '%s'" % template_name) |
... | ... | |
8843 | 8883 |
constants.DT_FILE: None, |
8844 | 8884 |
constants.DT_SHARED_FILE: 0, |
8845 | 8885 |
constants.DT_BLOCK: 0, |
8886 |
constants.DT_RBD: 0, |
|
8846 | 8887 |
} |
8847 | 8888 |
|
8848 | 8889 |
if disk_template not in req_size_dict: |
... | ... | |
9677 | 9718 |
self.diskparams = group_info.diskparams |
9678 | 9719 |
|
9679 | 9720 |
if not self.adopt_disks: |
9680 |
# Check lv size requirements, if not adopting |
|
9681 |
req_sizes = _ComputeDiskSizePerVG(self.op.disk_template, self.disks) |
|
9682 |
_CheckNodesFreeDiskPerVG(self, nodenames, req_sizes) |
|
9721 |
if self.op.disk_template == constants.DT_RBD: |
|
9722 |
# _CheckRADOSFreeSpace() is just a placeholder. |
|
9723 |
# Any function that checks prerequisites can be placed here. |
|
9724 |
# Check if there is enough space on the RADOS cluster. |
|
9725 |
_CheckRADOSFreeSpace() |
|
9726 |
else: |
|
9727 |
# Check lv size requirements, if not adopting |
|
9728 |
req_sizes = _ComputeDiskSizePerVG(self.op.disk_template, self.disks) |
|
9729 |
_CheckNodesFreeDiskPerVG(self, nodenames, req_sizes) |
|
9683 | 9730 |
|
9684 | 9731 |
elif self.op.disk_template == constants.DT_PLAIN: # Check the adoption data |
9685 | 9732 |
all_lvs = set(["%s/%s" % (disk[constants.IDISK_VG], |
... | ... | |
9992 | 10039 |
return list(iobj.all_nodes) |
9993 | 10040 |
|
9994 | 10041 |
|
10042 |
def _CheckRADOSFreeSpace(): |
|
10043 |
"""Compute disk size requirements inside the RADOS cluster. |
|
10044 |
|
|
10045 |
""" |
|
10046 |
# For the RADOS cluster we assume there is always enough space. |
|
10047 |
pass |
|
10048 |
|
|
10049 |
|
|
9995 | 10050 |
class LUInstanceConsole(NoHooksLU): |
9996 | 10051 |
"""Connect to an instance's console. |
9997 | 10052 |
|
... | ... | |
11347 | 11402 |
self.disk = instance.FindDisk(self.op.disk) |
11348 | 11403 |
|
11349 | 11404 |
if instance.disk_template not in (constants.DT_FILE, |
11350 |
constants.DT_SHARED_FILE): |
|
11405 |
constants.DT_SHARED_FILE, |
|
11406 |
constants.DT_RBD): |
|
11351 | 11407 |
# TODO: check the free disk space for file, when that feature will be |
11352 | 11408 |
# supported |
11353 | 11409 |
_CheckNodesFreeDiskPerVG(self, nodenames, |
Also available in: Unified diff