Skip to content

Commit

Permalink
Merge branch 'main' into modules_virt_volume
Browse files Browse the repository at this point in the history
* main:
  Improved domain definition handling
  Parse incoming XML instead of using regex to get name
  Refactor define command handling into separate function
  CI: add 2.14 tests, ignore-2.15 to avoid CI failing
  doc: set booleans to true/false for consistency
  Combine REVIEW_CHECKLIST.md and CONTRIBUTING.md and fix links
  CI: remove f35 from devel
  fix up failing pylint test, use before assignment
  Fix virt module to undefine a domain with nvram or other metadata (ansible-collections#136)
  Replace discouraged function listVolumes (ansible-collections#135)
  Replace functions listStoragePools and listDefinedStoragePools (ansible-collections#134)
  Update galaxy to next expected release (ansible-collections#133)
  Release 1.2.0 commit (ansible-collections#132)
  • Loading branch information
dseeley committed Oct 15, 2022
2 parents b80499d + c4fe158 commit 8436546
Show file tree
Hide file tree
Showing 19 changed files with 446 additions and 77 deletions.
51 changes: 49 additions & 2 deletions .azure-pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ stages:
- name: Units
test: 'devel/units/1'

- stage: Ansible_2_14
displayName: Sanity & Units 2.14
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
targets:
- name: Sanity
test: '2.14/sanity/1'
- name: Units
test: '2.14/units/1'

- stage: Ansible_2_13
displayName: Sanity & Units 2.13
dependsOn: []
Expand Down Expand Up @@ -126,8 +138,6 @@ stages:
targets:
- name: CentOS 7
test: centos7
- name: Fedora 35
test: fedora35
- name: Fedora 36
test: fedora36
- name: openSUSE 15 py3
Expand All @@ -137,6 +147,23 @@ stages:
- name: Ubuntu 22.04
test: ubuntu2204

- stage: Docker_2_14
displayName: Docker 2.14
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
testFormat: 2.14/linux/{0}/1
targets:
- name: CentOS 7
test: centos7
- name: Fedora 36
test: fedora36
- name: openSUSE 15 py3
test: opensuse15
- name: Ubuntu 20.04
test: ubuntu2004

- stage: Docker_2_13
displayName: Docker 2.13
dependsOn: []
Expand All @@ -149,6 +176,8 @@ stages:
test: centos7
- name: Fedora 34
test: fedora34
- name: Fedora 35
test: fedora35
- name: openSUSE 15 py2
test: opensuse15py2
- name: openSUSE 15 py3
Expand Down Expand Up @@ -276,6 +305,21 @@ stages:
- name: FreeBSD 13.1
test: freebsd/13.1

- stage: Remote_2_14
displayName: Remote 2.14
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
testFormat: '2.14/{0}/1'
targets:
- name: RHEL 9.0
test: rhel/9.0
- name: RHEL 8.6
test: rhel/8.6
- name: FreeBSD 13.1
test: freebsd/13.1

- stage: Remote_2_13
displayName: Remote 2.13
dependsOn: []
Expand Down Expand Up @@ -361,18 +405,21 @@ stages:
condition: succeededOrFailed()
dependsOn:
- Ansible_devel
- Ansible_2_14
- Ansible_2_13
- Ansible_2_12
- Ansible_2_11
- Ansible_2_10
- Ansible_2_9
- Docker_devel
- Docker_2_14
- Docker_2_13
- Docker_2_12
- Docker_2_11
- Docker_2_10
- Docker_2_9
- Remote_devel
- Remote_2_14
- Remote_2_13
- Remote_2_12
- Remote_2_11
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@ Community.Libvirt Release Notes
.. contents:: Topics


v1.2.0
======

Release Summary
---------------

This is the minor release of the ``community.libvirt`` collection.
This changelog contains all changes to the modules and plugins in this collection
that have been made after the previous release.

Minor Changes
-------------

- libvirt - add extra guest information to inventory (https://github.com/ansible-collections/community.libvirt/pull/113).
- libvirt - replace the calls to listDomainsID() and listDefinedDomains() with listAllDomains() in find_vm() (https://github.com/ansible-collections/community.libvirt/pull/117)

Bugfixes
--------

- virt_net - fix modify function which was not idempotent, depending on whether the network was active. See https://github.com/ansible-collections/community.libvirt/issues/107.
- virt_pool - crashed out if pool didn't contain a target path. Fix allows this not to be set. (https://github.com/ansible-collections/community.libvirt/issues/129).

v1.1.0
======

Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Contributing

Refer to the [Ansible Contributing guidelines](https://github.com/ansible/community-docs/blob/main/contributing.rst) to learn how to contribute to this collection.
Refer to the [Ansible Contributing guidelines](https://docs.ansible.com/ansible/devel/community/index.html) to learn how to contribute to this collection.

Refer to the [review checklist](https://docs.ansible.com/ansible/devel/community/collection_contributors/collection_reviewing.html) when triaging issues or reviewing PRs.
3 changes: 0 additions & 3 deletions REVIEW_CHECKLIST.md

This file was deleted.

23 changes: 23 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,26 @@ releases:
- 114_replace_distutils_spawn.yml
- 90_add_integration_test_for_virt_pool.yml
release_date: '2022-05-12'
1.2.0:
changes:
bugfixes:
- virt_net - fix modify function which was not idempotent, depending on whether
the network was active. See https://github.com/ansible-collections/community.libvirt/issues/107.
- virt_pool - crashed out if pool didn't contain a target path. Fix allows this
not to be set. (https://github.com/ansible-collections/community.libvirt/issues/129).
minor_changes:
- libvirt - add extra guest information to inventory (https://github.com/ansible-collections/community.libvirt/pull/113).
- libvirt - replace the calls to listDomainsID() and listDefinedDomains() with
listAllDomains() in find_vm() (https://github.com/ansible-collections/community.libvirt/pull/117)
release_summary: 'This is the minor release of the ``community.libvirt`` collection.
This changelog contains all changes to the modules and plugins in this collection
that have been made after the previous release.'
fragments:
- 1.2.0.yml
- 108_make_virt_net_modify_idempotent.yml
- 113_extra_inventory_info.yml
- 117_find_vms_update_calls.yml
- virt_pool_no_path.yml
release_date: '2022-08-04'
2 changes: 0 additions & 2 deletions changelogs/fragments/108_make_virt_net_modify_idempotent.yml

This file was deleted.

3 changes: 0 additions & 3 deletions changelogs/fragments/113_extra_inventory_info.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- virt_pool - replace discouraged functions ``listStoragePools`` and ``listDefinedStoragePools`` with ``listAllStoragePools`` to fix potential race conditions (https://github.com/ansible-collections/community.libvirt/pull/134).
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- virt_pool - replace discouraged function ``listAllVolumes`` with ``listAllVolumes`` to fix potential race conditions (https://github.com/ansible-collections/community.libvirt/pull/135).
2 changes: 2 additions & 0 deletions changelogs/fragments/136_fix_undefine_nvram.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- virt - fix virt module to undefine a domain with nvram, managed_save, snapshot_metadata or checkpoints_metadata (https://github.com/ansible-collections/community.libvirt/issues/40).
3 changes: 3 additions & 0 deletions changelogs/fragments/142_virt_define_improvements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- virt - support ``--diff`` for ``define`` command (https://github.com/ansible-collections/community.libvirt/pull/142/).
- virt - add `mutate_flags` parameter to enable XML mutation (add UUID, MAC addresses from existing domain) (https://github.com/ansible-collections/community.libvirt/pull/142/).
2 changes: 0 additions & 2 deletions changelogs/fragments/virt_pool_no_path.yml

This file was deleted.

2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace: community
name: libvirt
version: 1.1.1
version: 1.2.1
readme: README.md
authors:
- Ansible (https://github.com/ansible)
Expand Down
21 changes: 21 additions & 0 deletions plugins/doc_fragments/virt.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,24 @@ class ModuleDocFragment(object):
- Must be raw XML content using C(lookup). XML cannot be reference to a file.
type: str
"""

OPTIONS_MUTATE_FLAGS = r"""
options:
mutate_flags:
description:
- For each mutate_flag, we will modify the given XML in some way
- ADD_UUID will add an existing domain's UUID to the xml if it's missing
- ADD_MAC_ADDRESSES will look up interfaces in the existing domain with a
matching alias and copy the MAC address over. The matching interface
doesn't need to be of the same type or source network.
- ADD_MAC_ADDRESSES_FUZZY will try to match incoming interfaces with
interfaces of the existing domain sharing the same type and source
network/device. It may not always result in the expected outcome,
particularly if a domain has multiple interface attached to the same
host device and only some of those devices have <mac>s.
Use caution, do some testing for your particular use-case!
choices: [ ADD_UUID, ADD_MAC_ADDRESSES, ADD_MAC_ADDRESSES_FUZZY ]
type: list
elements: str
default: ['ADD_UUID']
"""
2 changes: 2 additions & 0 deletions plugins/inventory/libvirt.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def parse(self, inventory, loader, path, cache=True):
)

# This needs the guest powered on, 'qemu-guest-agent' installed and the org.qemu.guest_agent.0 channel configured.
domain_guestInfo = ''
try:
# type==0 returns all types (users, os, timezone, hostname, filesystem, disks, interfaces)
domain_guestInfo = domain.guestInfo(types=0)
Expand All @@ -173,6 +174,7 @@ def parse(self, inventory, loader, path, cache=True):
)

# This needs the guest powered on, 'qemu-guest-agent' installed and the org.qemu.guest_agent.0 channel configured.
domain_interfaceAddresses = ''
try:
domain_interfaceAddresses = domain.interfaceAddresses(source=libvirt.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT)
except libvirt.libvirtError as e:
Expand Down
Loading

0 comments on commit 8436546

Please sign in to comment.