tripleo-quickstart-extras/roles/snapshot-libvirt
Bogdan Dobrelya b5083aff99 Specify backing format for restoring images
45de287447
provides a fix to autodect the backing format.

Until we have that fix in libguestfs, specify it explicitly.

Related: rhbz#1998820

Change-Id: Ibfbefcacd684f046c0798987483c48a97e222092
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
2021-12-14 15:30:23 +01:00
..
defaults Adopt yamllint strict linting 2018-11-26 12:37:21 +00:00
tasks Specify backing format for restoring images 2021-12-14 15:30:23 +01:00
README.md Adapt code to newer code style (linters) 2018-11-16 12:42:51 +00:00

README.md

snapshot-libvirt

An Ansible role for snapshotting a libvirt environment using external snapshots with backing files.

The role will shutdown all of the VMs specified in the overcloud_nodes list, then proceed with either creating or restoring a previous snapshot depending on the settings for snapshot_create and snapshot_restore. The default is to do nothing since both of these operations are potentially destructive.

When run with snapshot_create=true, the role will check if there is already a backing file. If one exists, it will commit all new changes to that backing file. If there is not already a backing file, the role will create one, and make an empty snapshot pointing to it.

When run with snapshot_restore=true, the role will delete the current snapshot and create an empty snapshot pointing to the backing file.

Limitations

  • This role does not currently support any "management" of snapshots, i.e. there is only one maintained.
  • The role uses qemu-img directly to create the snapshots, this means the snapshots will not show up with commands like virsh-snapshot
  • The role does not currently implement any method to remove the backing files. This means when starting over from scratch, these *.bak files will need to be manually deleted (if reusing the same libvirt_volume_path).

Example Usage

---
- name:  Create a snapshot (or update a snapshot)
  hosts: virthost
  gather_facts: true
  vars:
    - snapshot_create: true
    - libvirt_volume_path: /opt/vm_images
    - libvirt_uri: qemu:///system
    - overcloud_nodes:
      - name: subnode-0
      - name: subnode-1
  roles:
    - snapshot-libvirt
  become: true

- name:  Restore a snapshot
  hosts: virthost
  gather_facts: true
  vars:
    - snapshot_restore: true
    - libvirt_volume_path: /opt/vm_images
    - libvirt_uri: qemu:///system
    - overcloud_nodes:
      - name: subnode-0
      - name: subnode-1
  roles:
    - snapshot-libvirt
  become: true

License

Apache