From Fedora Project Wiki

Revision as of 08:24, 19 November 2010 by Kparal (talk | contribs) (no more default cron tasks)

This guide will help you if you need to add many autotest clients in the form of virtual machines and you want to automate the process as much as possible.

The process will automate these things for you:

  1. Create new virtual machine with libvirt
  2. Generate a proper kickstart file according to your preferences
  3. Automatically install Fedora, set up desired setting (serial console redirection, etc)
  4. Automatically add required repositories and install required packages
If you need to install bare-metal clients, we don't have any handy script for you, but you can always use the kickstart generator described below. But be aware not all options from our kickstart may suit your needs - for example full disk erase.

Get the tools

We have created several scripts which you can use. They are not stabilized yet, so you have to retrieve them from our git:

$ git clone 'git://git.fedorahosted.org/autoqa.git'
$ cd autoqa
$ git checkout -b aqc origin/aqc
$ cd utils

In the current directory you can now see aqc-create.py script and aqc-ks/ directory (aqc is an acronym for AutoQA client). aqc-create.py is the main script you will want to use for AutoQA client installation, aqc-ks/ is a small web application for generating appropriate kickstarts.

You also need to have libvirt installed:

# yum install libvirt

Install the virtual AutoQA client

Just run

# ./aqc-create.py --help

to have an idea what can be done with this script.

A simple example would be:

# ./aqc-create.py --name client1 --fedora 13

That will create virtual machine with Fedora 13, your architecture, 512 MB RAM and storage in /dev/vg_autoqa/client1. A lot of default values have been used here, you can change anything to your needs.

When you're not working for Red Hat
Currently this works out-of-the-box just for people inside the Red Hat intranet, because the kickstart generator web application is hosted there. If you are not in the Red Hat intranet, you will have to host the kickstart generator yourself and point to it with --ks option. Read more at #Hosting the kickstart generator.

Let's see a more complex example:

# ./aqc-create.py --name client2 --fedora 12 --arch i386 --ram 1024 --disk /tmp/client2.img --ks http://myserver/myks.cfg

This will create virtual machine with Fedora 12, i386 architecture, 1024 MB RAM and storage in a file /tmp/client2.img (not logical volume). Kickstart used for installation is retrieved from http://myserver/myks.cfg. Your kickstart must of course match provided options (correct repositories for chosen Fedora release, etc).

A few more important options are --verbose for increased verbosity, --detach for not attaching you to client's serial console during installation and --dry for not really executing anything, just simulating.

The script will print you some helpful messages before you connect and after you disconnect from client's serial console. Be sure not to miss them.

Hosting the kickstart generator

The default kickstart generator is currently hosted inside Red Hat intranet:
http://test1173.test.redhat.com/wsgi/aqc-ks/aqc-ks

You may want to host your own, either because you are not inside Red Hat intranet, or you may want to do some changes. It is simple:

  1. Install httpd and mod_wsgi.
  2. Ensure your /etc/httpd/conf.d/wsgi.conf looks something like this:
    LoadModule wsgi_module modules/mod_wsgi.so
    
    <IfModule mod_wsgi.c>
            WSGIScriptAlias /wsgi /var/www/wsgi/
            <Directory /var/www/wsgi>
                    AllowOverride FileInfo
                    Options ExecCGI MultiViews Indexes FollowSymlinks
                    MultiviewsMatch Handlers
                    AddHandler wsgi-script .wsgi
                    AddHandler wsgi-script .py
    
                    Order allow,deny
                    Allow from all
            </Directory>
    </IfModule>
    
  3. Create directory /var/www/wsgi.
  4. Copy aqc-ks/ directory to /var/www/wsgi.
  5. Restart httpd service.
  6. Access your kickstart generator at http://your_host/wsgi/aqc-ks/aqc-ks.

Now you can use your own kickstart generator together with aqc-create.py like this:

# ./aqc-create.py ... --ks 'http://your_host/wsgi/aqc-ks/aqc-ks?release=%(fedora)s&arch=%(arch)s' ...