Creating a virtual test lab – part#3

If you’ve been following along, you now have a system installed and configured for creating virtual guests using cobbler. Additionally, cobbler-1.4.0 has been released. I recommend upgrading as there are numerous bug fixes and enhancements that will make life easier (and are required in my setup).

With this setup, you can do just about anything you like with your virtual guests.

  • Need a couple of dedicated systems to test some bodhi updates?
  • Check out the state of rawhide?
  • Want a disposable system to use for an upcoming Fedora Test Day?
  • Or testing out a new Fedora Live image?

I use the my cobbler setup to aid testing the installer, both manual and semi-automated. Let’s start with …

Manual Installs

In this scenario, I’ll configure my guests to boot the installer, but wait for me to manually walk through different use cases. For my installs, I’m going to use Fedora 10 x86_64 which I previously imported using cobbler. Also, I’ll reference the virtual system names created in a previous post (e.g. vguest1, vguest2, etc…).

  1. First, create a kickstart file which we will use only to provide a location for the installation source. The $tree variable will be filled in later by cobbler.
    # echo "url --url \$tree" > /var/lib/cobbler/kickstarts/manual.ks
  2. Next, let’s start fresh and remove any virtual guests that are running.
    # virsh destroy vguest1
    # virsh undefine vguest1
  3. Now, tell cobbler what we want to do …
    # cobbler system edit --name vguest1 \
    --profile F-10-GOLD-x86_64 \
    --kickstart /var/lib/cobbler/kickstarts/manual.ks

    Changing boot command-line arguments

    If you wish to pass any arguments to the installer, now is the time to make those changes. The –kopts option can be used to pass any kernel or installer tunables. For example, adding

    --kopts "serial console=ttyS0"

    would enable a text-mode install using ttyS0 on your guest. More information on acceptable boot options for the installer can be found at Anaconda/Options.

  4. Finally, using koan, start the install.
    # koan --server `hostname` --system vguest1 --virt
  5. If all goes well, you should be able to connect to the console of your guest.
    # virt-viewer vguest1

Using the above procedure, you can quickly initiate as many virtual installs as your system (cpu, memory and disk) can handle. Five installs at one time is about the maximum my brain can handle while remembering what I’m trying to accomplish on each system. I repeat the above steps so frequently, I include them in a small shell script for convenience.

Using my script, the above steps can be simplified with just:

# ./ -n vguest1 -p F-10-GOLD-x86_64 -k manual.ks 

Semi-Automated Installs

A bulk of installation testing lies in understanding and using kickstart. The quickest way to get started with kickstart, is to start with a known good kickstart file. From there you can adjust the kickstart to meet your needs.

For me, a great place to look for something to automate is in the Fedora 10 installion test plan. Looking at the test plan, I see that installation using ext4 file systems is not listed. Probably something we’ll want to test in the future. Let’s get started …

  1. On your cobbler server, copy the sample.ks kickstart template to a new filename.
    # cp /var/lib/cobbler/kickstarts/sample.ks /var/lib/cobbler/kickstarts/ext4.ks
  2. Now edit the new file and replace the following line:

    With something similar to the following lines:

    part /boot --fstype ext3 --size=200
    part swap --fstype swap --size=512 --grow --maxsize=2016 --recommended
    part / --fstype ext4 --size=1024 --grow
  3. That’s it! Let’s kick off an install on another install using our new cobbler kickstart template.
    # ./ -n vguest2 -p F-10-GOLD-x86_64 -k ext4.ks -c "ext4" 

    Mind the command-line

    Enabling ext4 file system partitioning in Fedora 10 requires booting with an additional kernel command-line. Be sure to add ext4 to your boot parameters.

I’ll leave modelling additional installs using cobbler kickstart templates for the reader. But hopefully this demonstrates how you can easily and quickly perform routine installs using cobbler kickstart templates. You may also wish to further modify your cobbler kickstart templates to meet your needs.

In my next post, I’ll outline how I use SNAKE kickstart templates in place of cobbler templates to allow for more robust kickstarts over time.

Stay tuned…

2 responses to “Creating a virtual test lab – part#3

  1. Nice post! (and look, I now have a LJ account)

    James already knows this, but I figured I’d add some cobbler comments for new folks:

    First off, users might not want to install their virt machines on their Cobbler server. If they don’t, they can just replace

    # koan –server `hostname` –system vguest1 –virt


    # koan –server –system vguest1 –virt

    It’s also not required to create system records for each virtual machine. The same also works:

    koan –server –profile F-10-i386 –virt

    And if installing a VM on a host that cobbler itself installed, you can leave off –server too, it already knows.

    koan is a client piece intended to talk to a remote cobbler server, though if you’re just testing, all on one box is ok too.

    If you’re looking for other sample kickstarts to use with cobbler, the default install has several in /var/lib/cobbler/kickstarts. “sample_end.ks” is the one you’ll want for F-10. The various other magic in there does things like James mentiones above. You’ll also see “snippets’ in there, which are ways of reusing pieces of kickstarts between various kickstart files.

    You can read more about snippets and kickstart templating as implemented in Cobbler at SNAKE takes this in a different direction (using pykickstart to generate templates instead of Cheetah), which is good too.

    I will stay tuned for the next article 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s