Skip to content

kashyapc/virt-scripts

Repository files navigation

Simple virt scripts for daily use (mostly for a developer/test
engineer):

    - Create unattended Fedora guests using virt-install (RAW/QCOW2)
    - Creating JEOS(Just Enough Operating System) with Oz.
    - Simple guestfish script to do post install operations.

Eventually try to add more cleaner scripts.
      
NOTE: To speed up you installs, please change the value of
      location{1,2} to your nearest Fedora mirrors.


Creating unattended guests
==========================

Using virt-install
------------------

To create (this uses `virt-install`) a minimal (@core only) 10G qcow2
disk, 2 vMEM, 2 vCPU, unattended Fedora:

    $ git clone \
    https://github.com/kashyapc/virt-scripts.git

    $ cd virt-scripts

Assuming you want to create a Fedora 23 guest:

    $ ./create-guest-qcow2.bash f23-jeos f23 x86_64

Once finished, login using root (passwd: testpwd).


Using Oz 
--------

If you want to use Oz (an automated guest install creator w/ minimal
user input):


    Usage: ./oz-jeos.bash <guest-name> <distro>
            'distro': f20, f23
            Examples: oz-jeos.bash f23-jeos f23       # Create f23


Create a Fedora 23 guest:

    $ ./oz-jeos.bash f23-jeos f23

Once installation is finished, define the libvirt XML for the guest (in
this case 'f23-jeos'):

    $ virsh define $libvirt-XML-FROM-PREVIOUS-COMMAND

List all the guests:

    $ virsh list --all

Start it and connect to the guest's serial console:

    $ virsh start f23-jeos --console

Or

Connect to it via virt-viewer:

    $ virt-viewer f23-jeos


Oz notes
~~~~~~~~

Oz uses something called TDL (template descriptive language). For
example:

     ./stdout-examples/f23/f23.tdl


Contents of the above file:

    -------------
    <template>
      <name>f23-jeos</name>
      <os>
        <name>Fedora</name>
        <version>23</version>
        <arch>x86_64</arch>
        <install type='url'>
          <url>http://dl.fedoraproject.org/pub/fedora/linux/releases/23/Server/x86_64/os/</url>
        </install>
        <rootpw>testpwd</rootpw>
      </os>
      <description>Fedora 23</description>
      <disk>
        <size>10</size>
      </disk>
    </template>
    --------------

To invoke manually, dump the above contents into
'f23.tdl' in the current directory, and do:

    $ oz-install ./f23.tdl

Root password is defined in the <rootpw> attribute of the TDL.

About

KVM Virtualization scripts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published