<?xml version="1.0"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
        "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
<chapter id="feature-ovirtvirtualmachines">
    <title>oVirt Virtual Machines</title>

    <para>Cockpit can connect to <ulink url="https://ovirt.org/">oVirt</ulink> REST API to extend
        <link linkend="feature-virtualmachines">Virtual Machines</link> for oVirt-specifics, namely
        <itemizedlist>
            <listitem><para>Active operations</para></listitem>
            <listitem><para>Extended virtual machine's details</para></listitem>
            <listitem><para>Migration</para></listitem>
            <listitem><para>VDSM configuration</para></listitem>
        </itemizedlist>
    </para>

    <para>Required oVirt version: <emphasis>4.1.0</emphasis></para>

    <para>The machine running Cockpit must be configured as a <emphasis>host within the oVirt cluster.</emphasis></para>

    <para>CORS (Cross Origin Resource Sharing) must be enabled on oVirt engine (not done by default):
        <programlisting>
$ <command>ssh root@[ENGINE_FQDN]</command> # log as `root` user in the oVirt engine machine
# <command>engine-config -s CORSSupport=true</command> # to turn on the CORS support for REST API
# <command>engine-config -s CORSAllowDefaultOrigins=true</command> # to allow CORS for all configured hosts
# <command>systemctl restart ovirt-engine</command> # to take effect
        </programlisting>
    </para>

    <para>The <emphasis>URL of oVirt</emphasis> (or RHV - Red Hat Virtualization) API server must be manually provided,
        since it can't be determined automatically from a host.</para>

    <para>To do so, please <emphasis>either</emphasis>
        <itemizedlist>
            <listitem><para>log into Cockpit as <emphasis>root</emphasis></para></listitem>
            <listitem><para>visit <emphasis>Virtual Machines</emphasis> page</para></listitem>
            <listitem><para>provide <emphasis>oVirt's engine URL</emphasis> within the shown dialog</para></listitem>
        </itemizedlist>
        <emphasis>or</emphasis>
        <itemizedlist>
            <listitem><para>run as <emphasis>root</emphasis> in shell:</para>
                <programlisting>
# <command>/usr/share/cockpit/ovirt/install.sh https://[FQDN]/ovirt-engine</command>
                </programlisting>
            </listitem>
        </itemizedlist>
    </para>

    <para>By any of the actions above, following files are generated:
        <itemizedlist>
            <listitem><para>/etc/cockpit/machines-ovirt.config - feel free to adjust</para></listitem>
            <listitem><para>/usr/share/cockpit/ovirt/override.json - to ease Content Security Policy towards oVirt's REST API</para></listitem>
        </itemizedlist>
    </para>
</chapter>
