Revision 84d7e26b lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
2399 | 2399 |
""" |
2400 | 2400 |
result = res_nodes, res_instances, res_missing = {}, [], {} |
2401 | 2401 |
|
2402 |
vg_name = self.cfg.GetVGName() |
|
2403 | 2402 |
nodes = utils.NiceSort(self.cfg.GetNodeList()) |
2404 | 2403 |
instances = [self.cfg.GetInstanceInfo(name) |
2405 | 2404 |
for name in self.cfg.GetInstanceList()] |
... | ... | |
2419 | 2418 |
if not nv_dict: |
2420 | 2419 |
return result |
2421 | 2420 |
|
2422 |
node_lvs = self.rpc.call_lv_list(nodes, vg_name) |
|
2421 |
vg_names = self.rpc.call_vg_list(nodes) |
|
2422 |
vg_names.Raise("Cannot get list of VGs") |
|
2423 | 2423 |
|
2424 | 2424 |
for node in nodes: |
2425 | 2425 |
# node_volume |
2426 |
node_res = node_lvs[node] |
|
2426 |
node_res = self.rpc.call_lv_list([node], |
|
2427 |
vg_names[node].payload.keys())[node] |
|
2427 | 2428 |
if node_res.offline: |
2428 | 2429 |
continue |
2429 | 2430 |
msg = node_res.fail_msg |
... | ... | |
7678 | 7679 |
_CheckNodesFreeDiskPerVG(self, nodenames, req_sizes) |
7679 | 7680 |
|
7680 | 7681 |
else: # instead, we must check the adoption data |
7681 |
all_lvs = set([i["adopt"] for i in self.disks]) |
|
7682 |
all_lvs = set([i["vg"] + "/" + i["adopt"] for i in self.disks])
|
|
7682 | 7683 |
if len(all_lvs) != len(self.disks): |
7683 | 7684 |
raise errors.OpPrereqError("Duplicate volume names given for adoption", |
7684 | 7685 |
errors.ECODE_INVAL) |
7685 | 7686 |
for lv_name in all_lvs: |
7686 | 7687 |
try: |
7687 |
# FIXME: VG must be provided here. Else all LVs with the
|
|
7688 |
# same name will be locked on all VGs.
|
|
7688 |
# FIXME: lv_name here is "vg/lv" need to ensure that other calls
|
|
7689 |
# to ReserveLV uses the same syntax
|
|
7689 | 7690 |
self.cfg.ReserveLV(lv_name, self.proc.GetECId()) |
7690 | 7691 |
except errors.ReservationError: |
7691 | 7692 |
raise errors.OpPrereqError("LV named %s used by another instance" % |
7692 | 7693 |
lv_name, errors.ECODE_NOTUNIQUE) |
7693 | 7694 |
|
7695 |
vg_names = self.rpc.call_vg_list([pnode.name]) |
|
7696 |
vg_names.Raise("Cannot get VG information from node %s" % pnode.name) |
|
7697 |
|
|
7694 | 7698 |
node_lvs = self.rpc.call_lv_list([pnode.name], |
7695 |
self.cfg.GetVGName())[pnode.name] |
|
7699 |
vg_names[pnode.name].payload.keys() |
|
7700 |
)[pnode.name] |
|
7696 | 7701 |
node_lvs.Raise("Cannot get LV information from node %s" % pnode.name) |
7697 | 7702 |
node_lvs = node_lvs.payload |
7703 |
|
|
7698 | 7704 |
delta = all_lvs.difference(node_lvs.keys()) |
7699 | 7705 |
if delta: |
7700 | 7706 |
raise errors.OpPrereqError("Missing logical volume(s): %s" % |
... | ... | |
7707 | 7713 |
errors.ECODE_STATE) |
7708 | 7714 |
# update the size of disk based on what is found |
7709 | 7715 |
for dsk in self.disks: |
7710 |
dsk["size"] = int(float(node_lvs[dsk["adopt"]][0])) |
|
7716 |
dsk["size"] = int(float(node_lvs[dsk["vg"] + "/" + dsk["adopt"]][0]))
|
|
7711 | 7717 |
|
7712 | 7718 |
_CheckHVParams(self, nodenames, self.op.hypervisor, self.op.hvparams) |
7713 | 7719 |
|
Also available in: Unified diff