Revision 8d75db10
b/lib/cmdlib.py | ||
---|---|---|
2962 | 2962 |
" the primary node.") |
2963 | 2963 |
self.secondaries.append(snode_name) |
2964 | 2964 |
|
2965 |
# Check lv size requirements |
|
2966 |
nodenames = [pnode.name] + self.secondaries |
|
2967 |
nodeinfo = rpc.call_node_info(nodenames, self.cfg.GetVGName()) |
|
2968 |
|
|
2969 | 2965 |
# Required free disk space as a function of disk and swap space |
2970 | 2966 |
req_size_dict = { |
2971 |
constants.DT_DISKLESS: 0,
|
|
2967 |
constants.DT_DISKLESS: None,
|
|
2972 | 2968 |
constants.DT_PLAIN: self.op.disk_size + self.op.swap_size, |
2973 | 2969 |
constants.DT_LOCAL_RAID1: (self.op.disk_size + self.op.swap_size) * 2, |
2974 | 2970 |
# 256 MB are added for drbd metadata, 128MB for each drbd device |
... | ... | |
2982 | 2978 |
|
2983 | 2979 |
req_size = req_size_dict[self.op.disk_template] |
2984 | 2980 |
|
2985 |
for node in nodenames: |
|
2986 |
info = nodeinfo.get(node, None) |
|
2987 |
if not info: |
|
2988 |
raise errors.OpPrereqError("Cannot get current information" |
|
2989 |
" from node '%s'" % nodeinfo) |
|
2990 |
if req_size > info['vg_free']: |
|
2991 |
raise errors.OpPrereqError("Not enough disk space on target node %s." |
|
2992 |
" %d MB available, %d MB required" % |
|
2993 |
(node, info['vg_free'], req_size)) |
|
2981 |
# Check lv size requirements |
|
2982 |
if req_size is not None: |
|
2983 |
nodenames = [pnode.name] + self.secondaries |
|
2984 |
nodeinfo = rpc.call_node_info(nodenames, self.cfg.GetVGName()) |
|
2985 |
for node in nodenames: |
|
2986 |
info = nodeinfo.get(node, None) |
|
2987 |
if not info: |
|
2988 |
raise errors.OpPrereqError("Cannot get current information" |
|
2989 |
" from node '%s'" % nodeinfo) |
|
2990 |
vg_free = info.get('vg_free', None) |
|
2991 |
if not isinstance(vg_free, int): |
|
2992 |
raise errors.OpPrereqError("Can't compute free disk space on" |
|
2993 |
" node %s" % node) |
|
2994 |
if req_size > info['vg_free']: |
|
2995 |
raise errors.OpPrereqError("Not enough disk space on target node %s." |
|
2996 |
" %d MB available, %d MB required" % |
|
2997 |
(node, info['vg_free'], req_size)) |
|
2994 | 2998 |
|
2995 | 2999 |
# os verification |
2996 | 3000 |
os_obj = rpc.call_os_get(pnode.name, self.op.os_type) |
Also available in: Unified diff