Skip to content

jscotka/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,3} to your nearest Fedora mirrors.


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

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

To create (this uses virt-install) a minimal (@core only) 10G qcow
disk, 2 vMEM, 2 vCPU, nightly RHEL-7 unattended guest (takes 5 min):

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

    $ cd virt-scripts

Assuming you want to create Fedora 19 :

    $ ./create-guest-qcow2.bash f19-jeos f19 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, f19
            Examples: oz-jeos.bash f19-jeos f19       # create f19


Successful stdout of install is noted here:
stoudt-examples/f19/f19-jeosJul_04_2013-12


Create an F19 guest:

    $ ./oz-jeos.bash f19-jeos f19

Once install is done, define the libvirt XML for the guest (in this case
- 'f19-jeos'):
  

    $ virsh define stoudt-examples/f19/f19-jeosJul_04_2013-12

List all the guests

    $ virsh list --all

Start it and connect to the guest's serial console

    $ virsh start f19-jeos --console

Or

Connect to it via virt-viewer

    $ virt-viewer f19-jeos


Oz notes
~~~~~~~~

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

     ./stdout-examples/f19/f19.tdl


Contents of the above file:

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

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

    $ oz-install ./f19.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

Languages

  • Shell 92.1%
  • Python 7.9%