Always disable libvirt default network

Currently, autostart for libvirt default network is disabled only when
this network is active during nova playbook execution.
It's an incorrect behavior because in some cases this network may not be
active from the beginning.
Autostart should be always disabled to ensure that this network will not
be unexpectedly marked as active in the future(during package upgrade,
host reboot etc.).

Closes-Bug: #2042369
Change-Id: I697234bda1601b534ce1b6ab186fa98f83179ee8
This commit is contained in:
Damian Dabrowski 2023-11-01 00:38:01 +01:00
parent f372c88a09
commit feb15af75b

View File

@ -13,16 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Check for libvirt default network
shell: "virsh net-list | awk '/default/'"
- name: Get information about libvirt default network
command: "virsh net-info default"
changed_when: false
register: default_net
register: default_net_info
- name: Disable libvirt default network # noqa: no-changed-when
command: "virsh net-autostart default --disable"
failed_when: false
when: default_net.stdout.find('default') != -1
when: default_net_info.stdout | regex_search('Autostart:\s+yes')
- name: Destroy libvirt default network # noqa: no-changed-when
command: "virsh net-destroy default"
when: default_net.stdout.find('default') != -1
when: default_net_info.stdout | regex_search('Active:\s+yes')