Metadata-Version: 2.5
Name: trytond_strings_xo_infrastructure
Version: 8.0.0.3
Summary: Xen Orchestra Infrastructure Inventory
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: inventory,orchestra,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<8.1,>=8.0
Requires-Dist: trytond<8.1,>=8.0
Provides-Extra: test
Description-Content-Type: text/x-rst

Xen Orchestra Infrastructure
============================

The ``strings_xo_infrastructure`` module mirrors the infrastructure
inventory of a Xen Orchestra (XO) instance into Tryton: the pools, the
hosts, the networks, the physical interfaces, the storage attachments,
the storage repositories and the virtual disk images of the ``/pools``,
``/hosts``, ``/networks``, ``/pifs``, ``/pbds``, ``/srs`` and
``/vdis`` collections are kept in sync as read-only records.

Features
--------

- **Pools**: name, description, master host, high availability state,
  CPU sockets and cores, memory total and default SR.
- **Hosts**: name, management address, power state, enabled flag, CPU
  sockets and cores, memory total and usage, hypervisor version and
  build, BIOS, product and pool membership.
- **Networks**: name, description, MTU, bridge, VLAN, default locking
  mode, purpose, bonding flag, tags and attached PIFs.
- **PIFs**: device and adapter model, host, attached network, IPv4 and
  IPv6 configuration, VLAN, MTU, link speed and state, management flag
  and bond membership.
- **PBDs**: host, attached storage repository, attached flag, device
  configuration and other configuration.
- **Storage repositories (SR)**: name, description, type (LVM, NFS,
  iSCSI, ZFS, ...), content type, size, used and physical used space,
  shared and default flags, allocation strategy, maintenance mode,
  tags, attached hosts, health, pool, other and storage manager
  configuration.
- **VDIs**: name, description, storage repository, size, virtual size,
  used and chain physical usage, type, image format, missing and CBT
  flags, snapshots, tags and other configuration.
- **Network actions**: a network is created on an interface, as a bonded
  network or confined to a pool, in every pool of the selection, and a
  network is deleted in-line; the addresses of an interface and the MTU
  of the network it is attached to are configured as well.  The values
  are validated against the toolstack before anything is posted — the
  interface of a network, the interfaces of a bond, their host, their
  VLAN and the pool they belong to — so that a network is never left
  half created, and the operations reconfiguring the networking or the
  reachability of a host are confirmed by the user.
- **Storage actions**: a storage repository is created on a host from
  the type and the device configuration its storage manager driver
  expects, attached to and detached from its host, and set as the
  default repository of its pool; an image is moved from one repository
  to another, refused on a repository in maintenance mode, on the one
  the image already lies on, on a repository of another server and on a
  repository without enough free space for the image.  A created
  repository is mirrored right away, and the destructive operations are
  confirmed by the user.
- **Read-only synchronisation**: an idempotent upsert keyed on the
  ``(server, uuid)`` pair, driven from the Xen Orchestra REST API v0
  through the ``strings_xo`` client and the generic synchronisation
  framework of the ``strings_xo`` base module.  Records that are no
  longer reported by Xen Orchestra are deactivated instead of being
  deleted.
- **Relationships**: a pool owns its hosts and points at its master
  host; a host owns its PIFs and PBDs; a network owns its PIFs; a PIF
  belongs to a host, is attached to a network and references its bond
  master; a storage repository belongs to a pool, is attached to the
  hosts of its PBDs and owns its VDIs; a VDI is located on a storage
  repository.
- **Security**: dedicated access rights reusing the ``strings_xo``
  groups, with read-only access for Xen Orchestra users and full
  access for the Xen Orchestra administration group.

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

After installing the module, open *Xen Orchestra > Servers* and use the
*Sync Infrastructure* button on a server to pull its inventory.  The
synchronised inventory is available under *Xen Orchestra >
Infrastructure*.

Dependencies
------------

- Tryton modules: ``ir``, ``res``, ``company``, ``strings_xo``.

Models
------

- ``xo.pool`` — ``XOPool``: a Xen Orchestra resource pool.
- ``xo.host`` — ``XOHost``: a XenServer / XCP-ng host.
- ``xo.network`` — ``XONetwork``: a Xen Orchestra network.
- ``xo.pif`` — ``XOPif``: a physical interface of a host.
- ``xo.pbd`` — ``XOPbd``: a storage attachment of a host.
- ``xo.sr`` — ``XOSR``: a storage repository.
- ``xo.vdi`` — ``XOVDI``: a virtual disk image.

The actions of the module extend these mirror models rather than
defining new ones: ``xo.network`` gains the *Delete Network* button and
``xo.pool`` the *Create Network* wizard, ``xo.pif`` the *Configure
Interface* wizard, ``xo.host`` the *Create Storage Repository* wizard,
``xo.pbd`` the *Attach* and *Detach* buttons, ``xo.sr`` the *Set as
Default* button and ``xo.vdi`` the *Migrate Virtual Disk Image* wizard.
Every operation is restricted to the administration groups, so that the
read access of a Xen Orchestra user never lets an operation through.

Cron Jobs
---------

The module plugs into the generic *Xen Orchestra: Synchronise*
(``xo.server|sync_cron``) scheduled action of the ``strings_xo`` base
module, which synchronises the infrastructure of every active server.

The tasks the maintenance, network and storage operations start are
polled by the ``xo.task|poll_cron`` scheduled action of the base module,
which mirrors their state on the record each of them acts upon.  No
scheduled action is added for the operations themselves: they are always
started on demand.

Wizards
-------

The module plugs into the generic *Manual Sync* wizard of the
``strings_xo`` base module.  The *Sync Infrastructure* button of a
server is kept for backwards compatibility.

The maintenance operations of a host are gathered by the *Disable or
Evacuate Hosts*, *Reboot or Shut Down Hosts* and *Rolling Pool
Operation* wizards; the network and the storage operations are gathered
by four wizards of their own:

- *Create Network* — create a network on an interface, a bonded network
  or a network confined to a pool, in every selected pool.  The wizard
  validates the kinds, the interfaces, the VLAN and the MTU before
  anything is posted, and refuses a selection holding a pool that
  cannot carry the network as a whole;
- *Configure Interface* — reconfigure the IPv4 and IPv6 addresses and
  the MTU of a single interface, whose current configuration is
  defaulted from the interface itself.  Only the values changed are
  posted, and the addresses of the management interface are confirmed
  before they are applied;
- *Create Storage Repository* — create a storage repository on a single
  selected host, from the type and the device configuration its storage
  manager driver expects.  Only the configuration fields of the
  selected type are shown, and the created repository is mirrored right
  away;
- *Migrate Virtual Disk Image* — move the selected images to another
  repository of their server, defaulted to the default repository of
  their pool.  Every image is checked — active, not missing, on another
  repository, with enough free space — before any task is started, so
  that a selection holding an image that cannot be moved is refused as
  a whole.
