Revision ed1ebc60
b/lib/cmdlib.py | ||
---|---|---|
2434 | 2434 |
" the primary node.") |
2435 | 2435 |
self.secondaries.append(snode_name) |
2436 | 2436 |
|
2437 |
# Check lv size requirements |
|
2438 |
nodenames = [pnode.name] + self.secondaries |
|
2439 |
nodeinfo = rpc.call_node_info(nodenames, self.cfg.GetVGName()) |
|
2440 |
|
|
2441 |
# Required free disk space as a function of disk and swap space |
|
2442 |
req_size_dict = { |
|
2443 |
constants.DT_DISKLESS: 0, |
|
2444 |
constants.DT_PLAIN: self.op.disk_size + self.op.swap_size, |
|
2445 |
constants.DT_LOCAL_RAID1: (self.op.disk_size + self.op.swap_size) * 2, |
|
2446 |
# 256 MB are added for drbd metadata, 128MB for each drbd device |
|
2447 |
constants.DT_REMOTE_RAID1: self.op.disk_size + self.op.swap_size + 256, |
|
2448 |
} |
|
2449 |
|
|
2450 |
if self.op.disk_template not in req_size_dict: |
|
2451 |
raise errors.ProgrammerError, ("Disk template '%s' size requirement" |
|
2452 |
" is unknown" % self.op.disk_template) |
|
2453 |
|
|
2454 |
req_size = req_size_dict[self.op.disk_template] |
|
2455 |
|
|
2456 |
for node in nodenames: |
|
2457 |
info = nodeinfo.get(node, None) |
|
2458 |
if not info: |
|
2459 |
raise errors.OpPrereqError, ("Cannot get current information" |
|
2460 |
" from node '%s'" % nodeinfo) |
|
2461 |
if req_size > info['vg_free']: |
|
2462 |
raise errors.OpPrereqError, ("Not enough disk space on target node %s." |
|
2463 |
" %d MB available, %d MB required" % |
|
2464 |
(node, info['vg_free'], req_size)) |
|
2465 |
|
|
2437 | 2466 |
# os verification |
2438 | 2467 |
os_obj = rpc.call_os_get([pnode.name], self.op.os_type)[pnode.name] |
2439 | 2468 |
if not isinstance(os_obj, objects.OS): |
Also available in: Unified diff