Create libvirt connection on NovaProvider constructor
Before I58cefac9076db52333b41633bf2cbaa5441dc98c the Nova client
was created on nova_provider module and imported by other modules
as a single and shared instance, and it's libvirt connection was
created once during the agent.process_main function execution if
OpenStack was enabled.
Now with the Nova client being created on-demand during the agent
operation, the libvirt connection opening isn't behaving well inside
threads and is returning an empty object when called.
This commit makes the libvirt connection to be opened when the
NovaProvider instance is created and closed when it is destroyed,
and return to a similar behavior before the refactor, but now by
creating a singleton NovaProvider instance on the main thread
that will be used by other modules during the agent execution,
preventing unnecessary code execution during nova_provider import.
Test Plan:
PASS: Create an instance with SRIOV or PCI-PT and verify that
instance CPU cores are affined to the PCI device IRQs
PASS: Verify that log shows no more warnings and errors related
to domain information retrieval on libvirt
Reviewed: https:/ /review. opendev. org/c/starlingx /utilities/ +/827755 /opendev. org/starlingx/ utilities/ commit/ 5872b851ec2fc2f afabba7b9a35e6c a4ded586e7
Committed: https:/
Submitter: "Zuul (22348)"
Branch: master
commit 5872b851ec2fc2f afabba7b9a35e6c a4ded586e7
Author: Heitor Matsui <email address hidden>
Date: Thu Feb 3 15:33:55 2022 -0300
Create libvirt connection on NovaProvider constructor
Before I58cefac9076db5 2333b41633bf2cb aa5441dc98c the Nova client
was created on nova_provider module and imported by other modules
as a single and shared instance, and it's libvirt connection was
created once during the agent.process_main function execution if
OpenStack was enabled.
Now with the Nova client being created on-demand during the agent
operation, the libvirt connection opening isn't behaving well inside
threads and is returning an empty object when called.
This commit makes the libvirt connection to be opened when the
NovaProvider instance is created and closed when it is destroyed,
and return to a similar behavior before the refactor, but now by
creating a singleton NovaProvider instance on the main thread
that will be used by other modules during the agent execution,
preventing unnecessary code execution during nova_provider import.
Test Plan:
PASS: Create an instance with SRIOV or PCI-PT and verify that
instance CPU cores are affined to the PCI device IRQs
PASS: Verify that log shows no more warnings and errors related
to domain information retrieval on libvirt
Closes-bug: 1959925 984233703ed518f 26564d67dd7
Change-Id: Ie72ccca5b63e1a
Signed-off-by: Heitor Matsui <email address hidden>