Metadata-Version: 2.5
Name: trytond_strings_xo_snapshot
Version: 8.0.0.3
Summary: Xen Orchestra Snapshots
Author: Clemens Hupka
Maintainer-email: Clemens Hupka <clemens.hupka@backend.at>
License-Expression: GPL-3.0-or-later
License-File: COPYRIGHT
License-File: LICENSE
Keywords: orchestra,snapshot,tryton,virtualization,xcp-ng,xen
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Environment :: Plugins
Classifier: Framework :: Tryton
Classifier: Topic :: Office/Business
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.10
Requires-Dist: trytond-company<8.1,>=8.0
Requires-Dist: trytond-strings-xo-compute<8.1,>=8.0
Requires-Dist: trytond-strings-xo<8.1,>=8.0
Requires-Dist: trytond<8.1,>=8.0
Provides-Extra: test
Description-Content-Type: text/x-rst

Xen Orchestra Snapshots
=======================

The ``strings_xo_snapshot`` module manages the snapshots of the virtual
machines mirrored by ``strings_xo_compute``.  Xen Orchestra remains the
authority on the snapshots: the module mirrors them into a Tryton-side
catalogue, from which they are taken, listed, reverted and destroyed,
and runs the recurring snapshots described by the snapshot schedules.

Snapshot catalogue
------------------

The ``xo.snapshot`` model mirrors the ``vm-snapshots`` collection of a
server: a snapshot is related to the machine it was taken from, and the
mode, the date and the power state recorded by Xen Orchestra are stored
with it.  The catalogue is synchronised with the rest of the inventory
of the server.

A snapshot is taken from the *Take Snapshot* button of a machine, which
offers a name label, an optional description and the mode of the
snapshot.  A machine is reverted to a snapshot with the *Rollback*
button of the catalogue, which discards its current state after the user
has confirmed it, and the standard delete of Tryton destroys the
snapshot in Xen Orchestra as well.

Snapshot schedules
------------------

A schedule describes *what* to snapshot, *when* and *how many* snapshots
to keep: it targets a single machine or every machine of a server
carrying a tag, and a scheduled ``ir.cron`` takes a snapshot of each of
its machines and prunes the snapshots it created beyond its retention.

Features
--------

- **Catalogue**: the snapshots of every synchronised server are mirrored
  in Tryton, related to their machine, and searchable and filterable;
  Xen Orchestra stays the authority and every operation is executed by
  it.
- **Create**: a snapshot of the disk alone, or of the disk and the
  memory of the guest, with a name label and an optional description.
- **Rollback and delete**: a machine is reverted to one of its
  snapshots, discarding its current state, and a snapshot is destroyed
  in Xen Orchestra; both operations are confirmed or guarded.
- **Guards**: the memory of a halted machine is never saved, and the
  snapshot of an unknown or inactive machine is never reverted to.
- **Retention hook**: a module enforcing a retention, the backup module
  of the suite in particular, protects the snapshots it needs from being
  destroyed by overriding ``is_protected``.
- **Per-machine or per-tag schedules**: a schedule targets a single
  virtual machine or every active machine of a server carrying a tag,
  so that a whole population of machines is snapshotted without
  describing each of them.
- **Interval and retention**: each schedule declares the interval
  between two runs, in minutes, hours or days, and the number of
  snapshots it keeps per machine; the older ones are destroyed.
- **Disk or disk and RAM mode**: the mode of a schedule tells whether
  the snapshot holds the disk alone or also the memory of the guest, a
  *checkpoint*.  Both modes are scheduled: the disk alone is snapshotted
  with the REST API, a checkpoint with the historical JSON-RPC API.  A
  checkpoint is heavier, Xen Orchestra attaching to it a suspend disk
  holding the memory of the guest, and the memory of a machine that does
  not run can never be saved: such a machine is skipped and the failure
  recorded for it, while the remaining machines are still snapshotted.
  A server that does not expose the memory save is reported as well, the
  mode never being silently lowered to a snapshot of the disk alone.
- **Scheduled execution**: a scheduled ``ir.cron`` runs every active
  schedule whose interval has elapsed; a schedule can also be run at
  once from its *Run Now* button.
- **Safe retention**: only the snapshots created by a schedule are
  pruned.  They are recognised by the prefix of their name label, so a
  snapshot taken by hand, by another schedule or by a backup job is
  never destroyed.
- **Failure isolation**: the failure of a machine never leaves the
  remaining ones unsnapshotted, and the outcome of every run is stored
  on the schedule and logged.
- **Security**: dedicated access groups, model access rights and
  permissions on the buttons restricting the operations to the
  administration groups.

Configuration
-------------

After installing the module, open *Xen Orchestra > Snapshots > Schedules*
to describe the schedules, and *Xen Orchestra > Snapshots > Snapshots* to
browse the catalogue.  The catalogue is also listed on the *Snapshots*
page of a virtual machine and of a server.

The module reads the ``[strings_xo_snapshot]`` section of the trytond
configuration file:

.. code-block:: ini

    [strings_xo_snapshot]
    schedule_cron = True
    snapshot_name_max = 50

``schedule_cron``
    whether the scheduled run of the schedules is enabled; defaults to
    ``True``.
``snapshot_name_max``
    the maximum number of characters of the name label given to a
    snapshot; defaults to ``50``.  The timestamp of a run is always
    preserved in the label.

The scheduled action ticks at a base granularity of five minutes and
every schedule skips itself while its own interval has not elapsed, so
the effective interval is controlled by the schedule itself.  The run
can also be suspended by deactivating the scheduled action record.
