Welcome to the ovirt-register!

ovirt-register project provides the tool ovirt-register and the python
module (ovirt_register) to register supported Linux distro like:
Fedora, ovirt-node, RHEL, CentOS as hypervisor of oVirt Engine. 

Additionally, the spec file generates python-ovirt-register (python2) or 
python3-ovirt-register (python3) according with the distro generating the rpm.

Installing in Fedora:
========================

    If you running python3 use:
    $ sudo dnf install python3-ovirt-register

CentOS EPEL6 or EPEL7:
========================

    $ sudo yum install python-ovirt-register

Which version of python my distro is running?
=================================================

    See in the release notes of your favorite distro
    or 
    $ ls -la path/to/python

Building and Installing manually the rpm:
=================================================

    $ git clone this-repo
    $ cd ovirt-register

    If you are running python3
    $ ./autogen.sh

    If you are running python2
    $ ./autogen.sh --without-python3

    $ make dist
    $ cp python-ovirt-register-NVR.tar.gz ~/rpmbuild/SOURCES
    $ rpmbuild -ba python-ovirt-register.spec

    Fedora:
    # dnf install ~/rpmbuild/RPMS/noarch/python3-ovirt-register-NVR.noarch.rpm

    Centos:
    # yum install ~/rpmbuild/RPMS/noarch/python-ovirt-register-NVR.noarch.rpm

Syntax of tool:
========================

    # ovirt-register --engine-fqdn engine.localdomain

    Please NOTE:
    The tool uses the configured FQDN of node to register against engine,
    use --node-fqdn to use different fqdn or ip address.

Required options:

    --engine-fqdn ENGINE_FQDN
        Engine FQDN (See also: --check-fqdn)

Optional options:

    --node-fqdn NODE_FQDN
        Node FQDN or IP address
  
    --node-name NODE_NAME
        Define a node name
  
    --ssh-user SSH_USER
        SSH username to establish the connection with Engine.
        If not provided, the user which is executing the script
        will be catch/used
  
    --ssh-port SSH_PORT
        SSH port to establish the connection with Engine If not provided,
        the script will use the default SSH port 22
  
    --nocheck-fqdn CHECK_FQDN
        Disable check for Engine CA, this option is enabled by default
  
    --fingerprint FINGERPRINT
        Specify an existing fingerprint to be validated against
        Engine CA fingerprint
  
    --log LOGFILE
        Specify a file to redirect the log
  
    --cafile CAFILE 
        Specify the full path for the CA file, it will be created
        if doesn't exist.
  
    --vdsm-port VDSM_PORT
        The port to be used in the communication between the node agent
        and Engine, if not provided will be used the default port 54321
  
    --force-uuid UUID
        Force the UUID of machine. Its useful for machines that provides
        duplicate UUID.
  
    --nopersist-uuid
        Do not persist UUID in the disk (/etc/vdsm/vdsm.id)

FAQ:
========================

   * How it works?

     ovirt-register uses http protocol to register the host into
     oVirt Engine and saves the public key into authorized_keys.
     If oVirt admin approves the host, oVirt Engine will connect
     into the host and install all required packages with host-deploy.

   * Does it support non root user register the host?
  
     Yes. Please keep in mind:

        - The non root user must have the permission to execute sudo
          commands without asking passwords. (For package installation)

        - Your non root user might not have permission to write into
          /etc/vdsm/vdsm.id which will save the Universally unique identifier.
          To skip, you might consider: --nopersist-uuid

        - oVirt Engine admin still requires to approve the host
          via Admin Portal, REST or SDK.

    * What about vdsm-reg project which oVirt Node uses? Is it get deprecated?

      Yes.

    * Do you have an example of python module usage?

      Download this git repo and see the source code: ovirt-register

Logging:
========================

    The ovirt-register tool uses journal or syslog (/var/log/messages), it
    depends what the system is running. If you would like to save the logging
    output in a file instead of keeping it into the system, use
    --log my_log_file

    Example of reading journal (last 50 lines):
    # journalctl -n50 -x --no-pager

    Example of reading messages:
    # tail -f /var/log/messages

    Example setting a log file:
    # ovirt-register --engine-fqdn engine.local --log /tmp/ovirt-register.log

Troubleshooting:
========================

    After approval with a non root user, I see:

        M: Unexpected error during execution: sudo: a password is required 
        A: The non root user must have the permission to execute sudo
           commands without asking the password.

        M: sudo: sorry, you must have a tty to run sudo
        A: Some distros still makes sudo require a TTY to execute commands. 
           More info: see sudoers man page. (requiretty option)

        M: Unexpected error during execution: reset: standard error:
           Inappropriate ioctl for device
        A: Verify if the user that oVirt Engine is trying to connect into the
           node has proper shell assigned. Generally it's possible to see
           the shell assigned to user in the /etc/passwd file.


    Trying to run the tool:

        M: ImportError: No module named ovirt_register.register
        A: Might be that you have installed python3-ovirt-register package
           and is trying to run the tool using python2 interpreter?
           Depeding of the distro /usr/bin/python is a symbol link to python2

           If it's the case you can run: # python3 /path/ovirt-register

    Fedora 22

        Message: ssh_dispatch_run_fatal: no matching key exchange method found
        See: https://bugzilla.redhat.com/show_bug.cgi?id=1225531
