Ovirt vm numa backport (#67700)

* ovirt_vm: correct numa nodes (#67611)

* init commit

* update docs

* update numa function name

* correct whitespaces

* add backport
pull/67986/head
Martin Nečas 5 years ago committed by GitHub
parent a0c3d890c3
commit ad4cad43ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- "ovirt_vm: correct numa nodes and update documentation"

@ -723,16 +723,21 @@ options:
suboptions: suboptions:
index: index:
description: description:
- "The index of this NUMA node (mandatory)." - "The index of this NUMA node."
required: True
memory: memory:
description: description:
- "Memory size of the NUMA node in MiB (mandatory)." - "Memory size of the NUMA node in MiB."
required: True
cores: cores:
description: description:
- "list of VM CPU cores indexes to be included in this NUMA node (mandatory)." - "List of VM CPU cores indexes to be included in this NUMA node."
type: list
required: True
numa_node_pins: numa_node_pins:
description: description:
- "list of physical NUMA node indexes to pin this virtual NUMA node to." - "List of physical NUMA node indexes to pin this virtual NUMA node to."
type: list
version_added: "2.6" version_added: "2.6"
rng_device: rng_device:
description: description:
@ -1887,17 +1892,20 @@ class VmsModule(BaseModule):
) )
) )
def __get_numa_serialized(self, numa):
return sorted([(x.index,
[y.index for y in x.cpu.cores] if x.cpu else [],
x.memory,
[y.index for y in x.numa_node_pins] if x.numa_node_pins else []
) for x in numa], key=lambda x: x[0])
def __attach_numa_nodes(self, entity): def __attach_numa_nodes(self, entity):
updated = False
numa_nodes_service = self._service.service(entity.id).numa_nodes_service() numa_nodes_service = self._service.service(entity.id).numa_nodes_service()
existed_numa_nodes = numa_nodes_service.list()
if len(self.param('numa_nodes')) > 0: if len(self.param('numa_nodes')) > 0:
# Remove all existing virtual numa nodes before adding new ones # Remove all existing virtual numa nodes before adding new ones
existed_numa_nodes = numa_nodes_service.list() for current_numa_node in sorted(existed_numa_nodes, reverse=True, key=lambda x: x.index):
existed_numa_nodes.sort(reverse=len(existed_numa_nodes) > 1 and existed_numa_nodes[1].index > existed_numa_nodes[0].index)
for current_numa_node in existed_numa_nodes:
numa_nodes_service.node_service(current_numa_node.id).remove() numa_nodes_service.node_service(current_numa_node.id).remove()
updated = True
for numa_node in self.param('numa_nodes'): for numa_node in self.param('numa_nodes'):
if numa_node is None or numa_node.get('index') is None or numa_node.get('cores') is None or numa_node.get('memory') is None: if numa_node is None or numa_node.get('index') is None or numa_node.get('cores') is None or numa_node.get('memory') is None:
@ -1921,9 +1929,7 @@ class VmsModule(BaseModule):
] if numa_node.get('numa_node_pins') is not None else None, ] if numa_node.get('numa_node_pins') is not None else None,
) )
) )
updated = True return self.__get_numa_serialized(numa_nodes_service.list()) != self.__get_numa_serialized(existed_numa_nodes)
return updated
def __attach_watchdog(self, entity): def __attach_watchdog(self, entity):
watchdogs_service = self._service.service(entity.id).watchdogs_service() watchdogs_service = self._service.service(entity.id).watchdogs_service()

Loading…
Cancel
Save