Commit a0add446 authored by Iustin Pop's avatar Iustin Pop
Browse files

cleanup: fix IAllocator hypervisor usage

Two problems: the iallocator.hypervisor wasn't initialized to None in
the constructor, so pylint doesn't realize it's initialized later with
setattr.

Second, 'hypervisor' is a module, so we shouldn't use it as a variable.

Reviewed-by: amishchenko
parent 4504c3d6
......@@ -5913,6 +5913,7 @@ class IAllocator(object):
self.name = name
self.mem_size = self.disks = self.disk_template = None
self.os = self.tags = self.nics = self.vcpus = None
self.hypervisor = None
self.relocate_from = None
# computed fields
self.required_nodes = None
......@@ -5960,12 +5961,12 @@ class IAllocator(object):
node_list = cfg.GetNodeList()
if self.mode == constants.IALLOCATOR_MODE_ALLOC:
hypervisor = self.hypervisor
hypervisor_name = self.hypervisor
elif self.mode == constants.IALLOCATOR_MODE_RELOC:
hypervisor = cfg.GetInstanceInfo(self.name).hypervisor
hypervisor_name = cfg.GetInstanceInfo(self.name).hypervisor
node_data = self.lu.rpc.call_node_info(node_list, cfg.GetVGName(),
hypervisor)
hypervisor_name)
node_iinfo = self.lu.rpc.call_all_instances_info(node_list,
cluster_info.enabled_hypervisors)
for nname in node_list:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment