This RFE is a result of testing / iterating on the CI squad's 12th sprint:
https://trello.com/c/JEGLSVh6/51-reproduce-ci-jobs-with-libvirt
https://trello.com/c/3aSQKPt6/69-add-snapshotting-capabilites-to-the-workflow#comment-5ae8ce37b2bd1af5775bd35b
---
A few (minor) things I noticed we might address in a future sprint. None IMHO should to be addressed in sprint 12.
If neither snapshot_create nor snapshot_restore is specified, the role should bail early and do nothing. Presently it'll reboot the VM's.
the README has the volume path variable defined and preloaded to default /opt/vm_images) but the sample playbook omits it. This causes the role to fail, but only after it's shut down VM's.
TASK [snapshot-libvirt : Commit any changes if a snapshot already exists]
fatal: [127.0.0.2]: FAILED! => {"failed": true, "msg": "The task includes an option with an undefined variable. The error was: 'libvirt_volume_path' is undefined\n\nThe error appears to have been in '/home/somedev/s12/validate-fs010/tripleo-quickstart-extras/roles/snapshot-libvirt/tasks/main.yml': line 27, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Commit any changes if a snapshot already exists\n ^ here\n\nexception type: <class 'ansible.errors.AnsibleUndefinedVariable'>\nexception: 'libvirt_volume_path' is undefined"}
If libvirt_volume_path is defined but points to a location that doesn't exist, or one that doesn't contain snapshots (in the restore case), we fail, but again only after the VM's have been shut down, and we then leave them off as the playbook fails.
TASK [snapshot-libvirt : Create snapshot]
failed: [127.0.0.2] (item={u'name': u'subnode-0'}) => {"changed": true, "cmd": "mv /opt/vm_images/subnode-0.qcow2 /opt/vm_images/subnode-0.qcow2.bak\n qemu-img create -f qcow2 -b /opt/vm_images/subnode-0.qcow2.bak /opt/vm_images/subnode-0.qcow2", "delta": "0:00:00.024475", "end": "2018-05-01 18:11:28.406737", "failed": true, "item": {"name": "subnode-0"}, "msg": "non-zero return code", "rc": 1, "start": "2018-05-01 18:11:28.382262", "stderr": "mv: cannot stat '/opt/vm_images/subnode-0.qcow2': No such file or directory\nqemu-img: /opt/vm_images/subnode-0.qcow2: Could not open '/opt/vm_images/subnode-0.qcow2.bak': No such file or directory\nCould not open backing image to determine size.", "stderr_lines": ["mv: cannot stat '/opt/vm_images/subnode-0.qcow2': No such file or directory", "qemu-img: /opt/vm_images/subnode-0.qcow2: Could not open '/opt/vm_images/subnode-0.qcow2.bak': No such file or directory", "Could not open backing image to determine size."], "stdout": "", "stdout_lines": []}
failed: [127.0.0.2] (item={u'name': u'subnode-1'}) => {"changed": true, "cmd": "mv /opt/vm_images/subnode-1.qcow2 /opt/vm_images/subnode-1.qcow2.bak\n qemu-img create -f qcow2 -b /opt/vm_images/subnode-1.qcow2.bak /opt/vm_images/subnode-1.qcow2", "delta": "0:00:00.016167", "end": "2018-05-01 18:11:29.004991", "failed": true, "item": {"name": "subnode-1"}, "msg": "non-zero return code", "rc": 1, "start": "2018-05-01 18:11:28.988824", "stderr": "mv: cannot stat '/opt/vm_images/subnode-1.qcow2': No such file or directory\nqemu-img: /opt/vm_images/subnode-1.qcow2: Could not open '/opt/vm_images/subnode-1.qcow2.bak': No such file or directory\nCould not open backing image to determine size.", "stderr_lines": ["mv: cannot stat '/opt/vm_images/subnode-1.qcow2': No such file or directory", "qemu-img: /opt/vm_images/subnode-1.qcow2: Could not open '/opt/vm_images/subnode-1.qcow2.bak': No such file or directory", "Could not open backing image to determine size."], "stdout": "", "stdout_lines": []}
Is this still being worked on?