Description
SUMMARY
When a libvirt guest is suspended (S3 state), there's no possibility to wake it up.
ISSUE TYPE
- Bug Report
COMPONENT NAME
virt
ANSIBLE VERSION
ansible [core 2.14.11]
config file = /home/randall/consulting/freexian/ftf/ansible.cfg
configured module search path = ['/home/randall/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /home/randall/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
COLLECTION VERSION
# /usr/lib/python3/dist-packages/ansible_collections
Collection Version
----------------- -------
community.libvirt 1.2.0
CONFIGURATION
$ ansible-config dump --only-changed
CONFIG_FILE() = None
EDITOR(env: EDITOR) = /usr/bin/vim
PAGER(env: PAGER) = less
OS / ENVIRONMENT
Guest in question is a Windows 11 VM that has been idle long enough for the idle suspend to kick in.
STEPS TO REPRODUCE
- Take any libvirt guest and suspend it to S3 from within the OS .
- Use the playbook below to attempt to get it into the running state
---
- hosts: localhost
tasks:
- name: virt
virt:
name: win11trial
state: running
EXPECTED RESULTS
Setting state: running
should get it into a running state, no matter the state it's currently in. Setting other variation with e.g. state: shutdown
will result in similar failures: libvirt.libvirtError: Requested operation is not valid: domain is not running
. It seems that once the VM is suspended, there's no way to administer it via the virt module.
$ ansible-playbook test.yml
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: Domain Config error : Requested operation is not valid: domain is not running
PLAY [localhost] **********************************************************************************************************************************************************************************************************************
TASK [virt] ***************************************************************************************************************************************************************************************************************************
changed: [localhost]
PLAY RECAP ****************************************************************************************************************************************************************************************************************************
localhost : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
ACTUAL RESULTS
$ ansible-playbook test.yml
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: Domain Config error : Requested operation is not valid: domain is not running
libvirt: QEMU Driver error : Requested operation is not valid: domain is not running
libvirt: Domain Config error : Requested operation is not valid: domain is not running
PLAY [localhost] **********************************************************************************************************************************************************************************************************************
TASK [virt] ***************************************************************************************************************************************************************************************************************************
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 already running
fatal: [localhost]: FAILED! => changed=false
msg: 'Requested operation is not valid: domain is already running'
PLAY RECAP ****************************************************************************************************************************************************************************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0