#71 Update the documentation.
Merged 3 years ago by frantisekz. Opened 3 years ago by lruzicka.
lruzicka/testcloud feature/manpages  into  master

file modified
+1 -1
@@ -131,7 +131,7 @@ 

  # Add any paths that contain custom static files (such as style sheets) here,

  # relative to this directory. They are copied after the builtin static files,

  # so a file named "default.css" will overwrite the builtin "default.css".

- html_static_path = ['_static']

+ #html_static_path = ['_static']

  

  # Add any extra paths that contain custom files (such as robots.txt or

  # .htaccess) here, relative to this directory. These files are copied

@@ -0,0 +1,108 @@ 

+ .. _development:

+ 

+ =====================

+ Testcloud Development

+ =====================

+ 

+ To develop **testcloud**, you need to perform a more complicated process to install all its dependencies, download the source code and perform a set-up.

+ 

+ Prerequisites

+ =============

+ #. Install the dependencies for testcloud.

+ 

+     .. code-block:: bash

+             

+         $ sudo dnf install libvirt python3-libvirt libguestfs libguestfs-tools python3-requests python3-jinja2

+ 

+ #. Start ``libvirtd``.

+ 

+     .. code-block:: bash

+ 

+         $ sudo systemctl start libvirtd

+ 

+ #. Add the ``testcloud`` group to the system.

+ 

+     .. code-block:: bash

+ 

+         $ sudo groupadd testcloud

+ 

+ #. Add a user into the ``testcloud`` group.

+ 

+     .. code-block:: bash

+ 

+         $ sudo usermod -a -G testcloud $USER

+ 

+ #. Log out of the system and log in again to update the group information on your user or use a login shell on a different terminal.

+ 

+     .. code-block:: bash

+ 

+         $ su - $USER

+ 

+ Installation

+ ============

+ 

+ #. Clone the testcloud repository.

+ 

+     .. code-block:: bash

+ 

+         $ git clone https://pagure.io/testcloud.git

+ 

+ #. Create the application directories.

+ 

+     .. code-block:: bash

+ 

+         $ sudo mkdir -p -m 775 /var/lib/testcloud

+ 

+         $ sudo mkdir -p -m 775 /var/lib/testcloud/instances

+ 

+         $ sudo mkdir -p -m 775 /var/lib/testcloud/backingstores

+ 

+ #. Change ownership on these directories to enable their use with testcloud.

+ 

+     .. code-block:: bash 

+ 

+         $ sudo chown qemu:testcloud /var/lib/testcloud

+ 

+         $ sudo chown qemu:testcloud /var/lib/testcloud/instances

+ 

+         $ sudo chown qemu:testcloud /var/lib/testcloud/backingstores

+ 

+ #. Copy the ``.rules`` file to the ``polkit`` rules.

+ 

+     .. code-block:: bash

+ 

+         $ sudo cp conf/99-testcloud-nonroot-libvirt-access.rules /etc/polkit-1/rules.d/

+ 

+ 

+ Running testcloud

+ =================

+ 

+ #. Navigate to your testcloud git repository.

+ 

+     .. code-block:: bash 

+ 

+         $ cd testcloud

+ 

+ #. Execute the ``run_testcloud.py`` script to run the testcloud. You can use any options as with the regular installation, for example:

+ 

+     .. code-block:: bash

+ 

+         $ ./run_testcloud.py instance create ...

+ 

+ .. tip::

+ 

+     Alternatively, you can use **pip** to install testcloud onto the system and then use it like it has been installed normally.

+     To do it, use the ``pip3 install -e . --user`` command in the project directory.

+ 

+ 

+ Testing

+ =======

+ 

+ There is a small test suite that you can run using ``tox``, to start the tests:

+ 

+     .. code-block:: bash

+ 

+         $ tox

+ 

+ Thank you very much for contributions.

+ 

file modified
+160 -45
@@ -1,81 +1,194 @@ 

  .. testcloud documentation master file, created by

     sphinx-quickstart on Wed May 20 14:59:21 2015.

+    

+ .. Last updated on Fri Nov 13 13:56:10 2020.

  

  .. This work is licensed under the Creative Commons Attribution 4.0

     International License. To view a copy of this license, visit

     http://creativecommons.org/licenses/by/4.0/.

  

- ==================================================

- testcloud - the best pretend cloud you'll ever use

- ==================================================

+ ======================

+ Testcloud User's Guide

+ ======================

  

- testcloud is a relatively simple system which is capable of booting images

- designed for cloud systems on a local system with minimial configuration.

- testcloud is desiged to be (and remain) somewhat simple, trading fancy cloud

+ **testcloud** is a simple system which is capable of downloading images designed 

+ for cloud systems and booting them locally with minimial configuration needed.

+ **testcloud** is designed to be simple and lean, trading fancy cloud

  system features for ease of use and sanity in development.

  

+ At this time, only *Fedora qcow2* images are supported. This might change in the

+ future.

  

- Installing testcloud

- ====================

  

- testcloud is available from the Fedora repositories for F23 and later.

+ Installation

+ ============

+ 

+ To install **testcloud** on a production system:

+ 

+     #. Install the testcloud package.

+ 

+         .. code-block:: bash

+         

+             $ sudo dnf install testcloud

+ 

+     #. Add yourself to the testcloud group.

+ 

+         .. code-block:: bash

+ 

+             $ sudo usermod -a -G testcloud $USER

  

-   dnf install testcloud

+     #. Restart your user session to update the group privileges, or use ``su -`` to get a login shell for that particular user where the group settings will be updated.

  

+         .. code-block:: bash

+ 

+             $ su -i $USER

+ 

+     Now, you are ready to use testcloud.

+ 

+ For development purposes, see the :ref:`development` section below.

  

  Using testcloud

  ===============

  

- The main testcloud interface uses the terminal and the binary named

- ``testcloud``. testcloud operations can be split into two major categories:

- image commands and instance commands.

+ Creating a new instance

+ -----------------------

+ 

+ To create a new instance, **testcloud** must be given an image location URL from where it will download the image to create the instance. Currently, the image must be a *qcow2* image. If you do not have an image location of your own, you can use one of the images from the `Fedora Cloud download pages <https://alt.fedoraproject.org/cloud/>`_.

+ 

+ To create a new instance with the cloud image:

+ 

+ .. code-block:: bash

+ 

+     $ testcloud instance create <instance name> -u <qcow2-image-url>

+ 

+ **testcloud** will download the qcow2 image and save it in the ``/var/lib/testcloud/backingstores/<qcow2-filename>``. It will use this image a backing store for the newly created instance in ``/var/tmp/instances/<instance-name>``. When the image has been already downloaded, **testcloud** will use the previously download image to create the instance instead.

+ 

+ Available options to create an instance

+ ---------------------------------------

+ 

+ There are several options (most of them optional) that can be used to create a new instance using **testcloud**.

+ 

+ --ram RAM

+ 

+     To set the amount of RAM that will be available to the virtual machine (in MiB).

+ --no-graphic

+ 

+     This turns off the graphical display of the virtual machine.

+ --vnc

+ 

+     To open a VNC connection at the :1 display of the instance.

+ -u, --url URL

+ 

+     The URL from where the qcow2 image should be downloaded. This option is **compulsory**.

+ --timeout TIMEOUT

+ 

+     A time (in seconds) to wait for boot to complete. Setting to 0 (default) will disable this functionality.

+ --disksize DISKSIZE

+ 

+     To set the disk size of the virtual machine (in GiB)

+ 

+ 

+ Working with instances

+ ----------------------

+ 

+ Instances can be manipulated using the ``instance`` command and specifying a single operation with a subcommand.

+ 

+     #. To list running instances:

  

- Image Commands

- --------------

+         .. code-block:: bash

  

- ``testcloud image list``

-   List all of the images currently cached by testcloud

+             $ testcloud instance list

  

- ``testcloud image remove <image name>``

-   Remove the image named ``<image name>`` from the local image backing store. Make sure

-   to replace ``<image name>`` with the name of an image which is currently

-   cached.

+     #. To list all available instances:

  

- Instance Commands

- -----------------

+         .. code-block:: bash

  

- ``testcloud instance list``

-   List all of the instances currently running and spawned by testcloud. Adding

-   the ``--all`` flag will list all instances spawned by testcloud whether the

-   instance is currently running or not

+             $ testcloud instance list --all

  

+     #. To start the instance:

  

- ``testcloud instance create <instance name> -u <image url>``

-   Create a new testcloud instance using the name ``<instance name>`` and the

-   image stored at the url ``<image url>``. Currently supported image url types

-   are ``http(s)://`` and ``file://``. Run ``testcloud instance create --help``

-   for information on other options for image creation.

+         .. code-block:: bash

  

+             $ testcloud instance start <instance-name>

  

- ``testcloud instance stop <instance name>``

-   Stop the instance with name ``<instance name>``

+     #. To stop the instance:

  

- ``testcloud instance start <instance name>``

-   Start the instance with name ``<instance name>``

+         .. code-block:: bash

  

- ``testcloud instance remove <instance name>``

-   Remove the instance with name ``<instance name>``. This command will fail if

-   the instance is not currently stopped

+             $ testcloud instance stop <instance-name>

  

+     #. To remove a stopped instance:

+ 

+         .. code-block:: bash

+ 

+             $ testcloud instance remove <instance-name>

+ 

+     #. To remove a running instance:

+ 

+         .. code-block:: bash

+ 

+             $ testcloud instance remove -f <instance-name>

+ 

+     #. To reboot the instance:

+ 

+         .. code-block:: bash

+ 

+             $ testcloud instance reboot <instance-name>

+ 

+     #. To remove non-existing libvirt VMs from testcloud:

+ 

+         .. code-block:: bash

+ 

+             $ testcloud instance clean

+ 

+ Alternatively, the instances can also be viewed and manipulated using the **virt-manager** tool.

+ 

+ Logging into the instance

+ -------------------------

+ 

+ When the instance is created, **testcloud** will return its IP address that you can use to access the running instance via **ssh**. The login name is ``fedora`` and the password is ``passw0rd``.

+ 

+ To log onto the instance:

+ 

+ .. code-block:: bash

+ 

+     $ ssh fedora@<instance-IP>

+ 

+ The IP address of an instance is also shown when you list the instance using the **testcloud** instance list command. You can also control the instance using the **virt-manager** tool.

+ 

+ Configuration

+ -------------

+ 

+ The default configuration should work for many people but those defaults can be overridden through the use of a ``settings.py`` file containing the values to use when overriding default settings. The example file in ``conf/settings-example.py`` shows the possible configuration values which can be changed.

+ 

+ Note that in order for those new values to be picked up, the filename cannot differ from ``settings.py`` and that file must be placed in one of the following locations:

+ 

+ * ``conf/settings.py`` in the git checkout

+ * ``~/.config/testcloud/settings.py``

+ * ``/etc/testcloud/settings.py``

+ 

+ For example, if you wanted to set up an **ssh** accessible root account that uses an *ssh key* as the authentification method, you could provide the following to the ``~/.config/testcloud/settings.py``:

+ 

+ .. code-block:: python

+ 

+     USER_DATA = """#cloud-config 

+     users: 

+         - default 

+         - name: root 

+               password: %s 

+               chpasswd: { expire: False } 

+               ssh-authorized-keys: 

+         - <my ssh pub key> 

+     """ 

  

  Getting Help

  ============

  

  Self service methods for asking questions and filing tickets:

  

-  * `Source Repository <https://github.com/Rorosha/testcloud>`_

+  * `Source Repository <https://pagure.io/testcloud>`_

  

-  * `Currently Open Issues <https://phab.qadevel.cloud.fedoraproject.org/tag/testcloud/>`_

+  * `Currently Open Issues <https://pagure.io/testcloud/issues>`_

  

  For other questions, the best places to ask are:

  
@@ -86,20 +199,21 @@ 

  Licenses

  ========

  

- The testcloud library is licensed as `GNU General Public Licence v2.0 or later

+ The **testcloud** library is licensed as `GNU General Public Licence v2.0 or later

  <http://spdx.org/licenses/GPL-2.0+>`_.

  

- The documentation for testcloud is licensed under a `Creative Commons

+ The documentation for **testcloud** is licensed under a `Creative Commons

  Atribution-ShareAlike 4.0 International License <https://creativecommons.org/licenses/by-sa/4.0/>`_.

  

  

- Other Documentation

- ===================

+ Further reading

+ ===============

  

  .. toctree::

     :maxdepth: 2

  

     indepth

+    develop

     api

  

  ==================
@@ -110,3 +224,4 @@ 

  * :ref:`modindex`

  * :ref:`search`

  

+ 

file added
+127
@@ -0,0 +1,127 @@ 

+ .\" This is the manual page for testcloud.

+ .\" Contact lruzicka@redhat.com if you find an errors or a typo.

+ .TH TESTCLOUD 1 "11 Nov 2020" "1.0" "testcloud man page"

+ .SH NAME

+ testcloud \- download \fIqcow2\fR cloud images and boot them locally.

+ .SH SYNOPSIS

+ \fBtestcloud\fR [-h, --help] [COMMAND]... [OPTION]... [SUBCOMMAND]... [OPTION]...

+ .SH DESCRIPTION

+ .LP

+ \fBtestcloud\fR is a small helper script to download and boot cloud images on your machine locally. 

+ Currently, only Fedora \fBqcow2\fR images are supported.

+ .PP

+ To run \fBtestcloud\fR, you need to provide the \fBURL\fR of a cloud image to the script which

+ will be used for booting. If you do not have an image location of your own, you can use one

+ of the images from the \fBFedora Cloud\fR download pages at \fIhttps://alt.fedoraproject.org/cloud/\fR.

+ .PP

+ Then, \fBtestcloud\fR will download the image and save it in the \fI/var/lib/testcloud/backingstores/\fR.

+ It will use this image to create a backing store for a newly created instance which will be placed in

+ \fI/var/tmp/instances/\fR. When the same image has been previously downloaded, \fBtestcloud\fR will NOT

+ download it again and it will use the current image to create the instance.

+ .PP

+ When the new instance is created, \fBtestcloud\fR will show its IP address that you can use to

+ access the running instance via \fIssh\fR. The login name is \fBfedora\fR and the password is 

+ \fBpassw0rd\fR. The IP address of an instance is shown when you list the instance (see COMMANDS).

+ .PP

+ The instance can also be manipulated and controlled with \fBvirt-manager\fR.

+ .SH CONFIGURATION

+ The default configuration should work for many people. However, if you need to override the

+ default settings, you can do it in the \fIsettings.py\fR file. The example file in

+ \fIconf/settings-example.py\fR shows the available configuration values which you can

+ alter to suit your needs.

+ .PP

+ The configuration file must be placed in one of the following locations in order to be

+ recognized.

+ .IP 

+ \fIconf/settings.py\fR in the git checkout

+ .IP 

+ \fI~/.config/testcloud/settings.py\fR

+ .IP

+ \fI/etc/testcloud/settings.py\fR

+ .SH COMMANDS

+ \fBinstance\fR

+         Control and manipulate the instances (see OPTIONS) for more details.

+ 

+ \fBimage\fR

+         Control and manipulate the images (see OPTIONS) for more details.

+ .SH OPTIONS

+ \fB-h, --help\fR

+         Shows the help message and exits.

+ 

+ \fB-c CONNECTION, --connection CONNECTION\fR

+         Provide the URL of a remote libvirt instance to be used instead of the local one. This option can be used with the \fBinstance\fR command only.

+ 

+ .SH SUBCOMMANDS

+ \fBcreate\fR

+         Create a new instance. See the INSTANCE CREATE OPTIONS section for more details.

+ 

+ \fBlist\fR

+         List available running instances and images. Use the \fB--all\fR options to list all instances.

+ 

+ \fBstart\fR

+         Start an existing instance.

+  

+ \fBstop\fR

+         Stop a running instance.

+ 

+ \fBreboot\fR

+         Force the instance to reboot.

+ 

+ \fBremove\fR

+         Remove an instance or image. If an instance is running, it cannot be removed without the \fB-f\fR option.

+ 

+ \fBdestroy\fR

+         Remove an instance or image. Deprecated, do not use.

+  

+ \fBclean\fR

+         Remove non-existing or unsynced libvirt VMs from testcloud.

+ 

+ .SH INSTANCE CREATE OPTIONS

+ \fB-u, --url URL\fR

+         Specify the URL from where testcloud should download the instance qcow2 image. \fBThis option is compulsory\fR.

+ 

+ \fB--ram RAM\fR

+         Set the amount of RAM that will be available to the instance's VM (in MiB).

+ 

+ \fB--disksize DISKSIZE\fR

+         Set the disk size of the instance VM (in GiB).

+ 

+ \fB--vnc\fR

+         Open a VNC connection to the \fB:1\fR display of the instance VM.

+ 

+ \fB--no-graphic\fR

+         Turn off the instance VM's graphical display.

+ 

+ \fB--timeout TIMEOUT\fR

+         Specify the time (in seconds) to wait for the instance boot to complete. To disable waiting time (default behaviour) set to \fB0\fR.

+ 

+ .SH EXAMPLES

+ .PP

+ Create a new instance:

+ .IP

+ \fBtestcloud instance create <instance_name> -u <URL>\fR

+ .PP

+ List all available instances:

+ .IP

+ \fBtestcloud instance list --all\fR

+ .PP

+ Start an existing instance:

+ .IP

+ \fBtestcloud instance start <instance_name>\fR

+ .PP

+ Stop an existing instance:

+ .IP

+ \fBtestcloud instance stop <instance_name>\fR

+ .PP

+ Remove a running instance:

+ .IP

+ \fBtestcloud instance remove -f <instance_name>\fR

+ 

+ .SH SEE ALSO

+ 

+ \fBtestcloud's help\fR and the Project's \fBREADME.md\fR file

+ 

+ .SH BUGS

+ No known bugs. If you have found a bug, please report it at \fIhttps://bugzilla.redhat.com\fR.

+ .SH AUTHOR

+ Mike Ruckman (roshi@fedoraproject.org)

  1. Update the reST documentation.
  2. Create a standalone file for man pages.
  3. Generate the current documentation into html.

Note: When we will have agreed on the final content, we can delete the html output if one wishes.

1 new commit added

  • Remove generated docs.
3 years ago

1 new commit added

  • Fix warning
3 years ago

1 new commit added

  • Change title.
3 years ago

1 new commit added

  • Make fixes based on lbrabec's review.
3 years ago

rebased onto 94ab2ef

3 years ago

I have squashed the commit to make the history better this time.

Pull-Request has been merged by frantisekz

3 years ago