Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Squelch output related to "domain is not running" #153

Open
LnxGnome opened this issue May 3, 2023 · 1 comment
Open

Squelch output related to "domain is not running" #153

LnxGnome opened this issue May 3, 2023 · 1 comment

Comments

@LnxGnome
Copy link

LnxGnome commented May 3, 2023

SUMMARY

Output of community.libvirt plugin is too noisy when it encounters guest machines that are shutdown

ISSUE TYPE
  • Bug Report
COMPONENT NAME

connection/libvirt_qemu.py

ANSIBLE VERSION
ansible 2.9.27
  config file = /home/svc.ansible/.ansible.cfg
  configured module search path = ['/home/svc.ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Sep 13 2022, 09:40:27) [GCC 8.5.0 20210514 (Red Hat 8.5.0-10.1.0.1)]
COLLECTION VERSION
ansible-galaxy collection: error: argument COLLECTION_ACTION: invalid choice: 'list' (choose from 'init', 'build', 'publish', 'install')

hmm, reinstalling it won't hurt since I just installed it this week.

ansible-galaxy collection install -v -f community.libvirt
Using /home/svc.ansible/.ansible.cfg as config file
Process install dependency map
Starting collection install process
Installing 'community.libvirt:1.2.0' to '/home/svc.ansible/.ansible/collections/ansible_collections/community/libvirt'
CONFIGURATION
DEFAULT_HOST_LIST(/home/svc.ansible/.ansible.cfg) = ['/home/svc.ansible/ansible_config/hosts']
DEFAULT_LOAD_CALLBACK_PLUGINS(/home/svc.ansible/.ansible.cfg) = True
DEFAULT_STDOUT_CALLBACK(/home/svc.ansible/.ansible.cfg) = yaml
DEFAULT_TIMEOUT(/home/svc.ansible/.ansible.cfg) = 30
HOST_KEY_CHECKING(/home/svc.ansible/.ansible.cfg) = False
INTERPRETER_PYTHON(/home/svc.ansible/.ansible.cfg) = auto_silent
INVENTORY_CACHE_ENABLED(/home/svc.ansible/.ansible.cfg) = True
INVENTORY_CACHE_PLUGIN(/home/svc.ansible/.ansible.cfg) = yaml
INVENTORY_ENABLED(/home/svc.ansible/.ansible.cfg) = ['host_list', 'script', 'yaml', 'ini', 'toml', 'community.libvirt.libvirt', 'auto']
PERSISTENT_COMMAND_TIMEOUT(/home/svc.ansible/.ansible.cfg) = 120
OS / ENVIRONMENT

Ansible controller: Oracle Linux Server 8.6
Target: CentOS 7.9.2009 (fully patched two days ago)
centos-release-qemu-ev-1.0-4.el7.centos.noarch
libvirt-daemon-driver-qemu-4.5.0-36.el7_9.5.x86_64
qemu-guest-agent-2.12.0-3.el7.x86_64
qemu-img-ev-2.12.0-44.1.el7_8.1.x86_64
qemu-kvm-common-ev-2.12.0-44.1.el7_8.1.x86_64
qemu-kvm-ev-2.12.0-44.1.el7_8.1.x86_64

STEPS TO REPRODUCE

Add to .ansible.cfg

[inventory]
enable_plugins = host_list, script, yaml, ini, toml, community.libvirt.libvirt, auto
cache=True
cache_plugin=yaml

running with ansible-playbook -i svc/inventory.yaml svc/do-something-with-libvirt-inventory.yaml

following is svc/inventory.yaml

---
# Connect to qemu
plugin: community.libvirt.libvirt
uri: "qemu+ssh://[email protected]/system"
inventory_hostname: name

following is svc/do-something-with-libvirt-inventory.yaml

---
- name: do something with community.libvirt plugin

  hosts: all
  become: true

  tasks:
    - name: RedHat systems
      when: ansible_os_family == "RedHat"
      block:
        - name: update
          ansible.builtin.yum:
            name: '*'
            state: latest
          register: update
          notify: "reboot"

EXPECTED RESULTS

Current output is too verbose. Handle these (down vm) errors more quietly. i.e. Errors about a shutdown VM should not be displayed, because we know they are down and that's ok.

I'm not sure if the 418 errors below are due to the domain being down, or do to the UUIDs in the inventory.

ACTUAL RESULTS

The Tasks run fine on the VMs that are up.

without extra verbose -vvvv

libvirt: XML-RPC error : unknown procedure: 418
libvirt: XML-RPC error : unknown procedure: 418
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: XML-RPC error : unknown procedure: 418
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: XML-RPC error : unknown procedure: 418
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: XML-RPC error : unknown procedure: 418
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: XML-RPC error : unknown procedure: 418
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: XML-RPC error : unknown procedure: 418
libvirt: XML-RPC error : unknown procedure: 418
libvirt: XML-RPC error : unknown procedure: 418
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: XML-RPC error : unknown procedure: 418
libvirt: Domain Config error : Requested operation is not valid: domain is not running

PLAY [do something with community.libvirt plugin] *********************************************************************************************

TASK [Gathering Facts] 
*********************************************************************************************
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: Domain Config error : Requested operation is not valid: domain is not running
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: libvirt.libvirtError: Requested operation is not valid: domain is not running
fatal: [downhost1]: FAILED! => 
  msg: Unexpected failure during module execution.
  stdout: ''
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: Domain Config error : Requested operation is not valid: domain is not running
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: libvirt.libvirtError: Requested operation is not valid: domain is not running
fatal: [downhost2]: FAILED! => 
  msg: Unexpected failure during module execution.
  stdout: ''
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: libvirt.libvirtError: Requested operation is not valid: domain is not running
fatal: [downhost3]: FAILED! => 
  msg: Unexpected failure during module execution.
  stdout: ''
libvirt: Domain Config error : Requested operation is not valid: domain is not running
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: libvirt.libvirtError: Requested operation is not valid: domain is not running
fatal: [downhost4]: FAILED! => 
  msg: Unexpected failure during module execution.
  stdout: ''
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: libvirt.libvirtError: Requested operation is not valid: domain is not running
fatal: [downhost5]: FAILED! => 
  msg: Unexpected failure during module execution.
  stdout: ''
libvirt: Domain Config error : Requested operation is not valid: domain is not running
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: libvirt.libvirtError: Requested operation is not valid: domain is not running
fatal: [downhost6]: FAILED! => 
  msg: Unexpected failure during module execution.
  stdout: ''
libvirt: Domain Config error : Requested operation is not valid: domain is not running
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: libvirt.libvirtError: Requested operation is not valid: domain is not running
fatal: [downhost7]: FAILED! => 
  msg: Unexpected failure during module execution.
  stdout: ''

TASK [yum] 
*********************************************************************************************
ok: [upvm1]
ok: [upvm2]
ok: [upvm3]

interesting bits with -vvvv

Not replacing invalid character(s) "{'6', '-'}" in group name (670808f6-b7ca-490f-8767-f74fb8b5d7ff)
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details

libvirt: XML-RPC error : unknown procedure: 418
Not replacing invalid character(s) "{'-'}" in group name (a4795992-2541-4201-897f-2e2ed7645d06)

and this gets repeated for each shutdown vm, likely part of FIND DOMAIN

The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/ansible/executor/task_executor.py", line 147, in run
    res = self._execute()
  File "/usr/lib/python3.6/site-packages/ansible/executor/task_executor.py", line 665, in _execute
    result = self._handler.run(task_vars=variables)
  File "/usr/lib/python3.6/site-packages/ansible/plugins/action/gather_facts.py", line 79, in run
    res = self._execute_module(module_name=fact_module, module_args=mod_args, task_vars=task_vars, wrap_async=False)
  File "/usr/lib/python3.6/site-packages/ansible/plugins/action/__init__.py", line 790, in _execute_module
    self._make_tmp_path()
  File "/usr/lib/python3.6/site-packages/ansible/plugins/action/__init__.py", line 353, in _make_tmp_path
    tmpdir = self._remote_expand_user(self.get_shell_option('remote_tmp', default='~/.ansible/tmp'), sudoable=False)
  File "/usr/lib/python3.6/site-packages/ansible/plugins/action/__init__.py", line 674, in _remote_expand_user
    data = self._low_level_execute_command(cmd, sudoable=False)
  File "/usr/lib/python3.6/site-packages/ansible/plugins/action/__init__.py", line 1085, in _low_level_execute_command
    rc, stdout, stderr = self._connection.exec_command(cmd, in_data=in_data, sudoable=sudoable)
  File "/home/svc.ansible/.ansible/collections/ansible_collections/community/libvirt/plugins/connection/libvirt_qemu.py", line 151, in exec_command
    super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable)
  File "/usr/lib/python3.6/site-packages/ansible/plugins/connection/__init__.py", line 34, in wrapped
    self._connect()
  File "/home/svc.ansible/.ansible/collections/ansible_collections/community/libvirt/plugins/connection/libvirt_qemu.py", line 135, in _connect
    response_cap = json.loads(libvirt_qemu.qemuAgentCommand(self.domain, request_cap, 5, 0))
  File "/usr/lib64/python3.6/site-packages/libvirt_qemu.py", line 78, in qemuAgentCommand
    raise libvirt.libvirtError('virDomainQemuAgentCommand() failed')
libvirt.libvirtError: Requested operation is not valid: domain is not running
fatal: [downhost1]: FAILED! => 
  msg: Unexpected failure during module execution.
  stdout: ''
@csmart
Copy link
Collaborator

csmart commented May 3, 2023

Hi @LnxGnome, thanks for putting in the issue with the output. When I get a chance I'll take a look and see what can be done to clean it up. Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants