Skip to content

Commit

Permalink
Update README and Oz script
Browse files Browse the repository at this point in the history
  • Loading branch information
kashyapc committed Mar 17, 2016
1 parent 3281f10 commit 05f4066
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 36 deletions.
34 changes: 17 additions & 17 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ disk, 2 vMEM, 2 vCPU, unattended Fedora:

$ cd virt-scripts

Assuming you want to create a Fedora 21 guest:
Assuming you want to create a Fedora 23 guest:

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

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

Expand All @@ -40,16 +40,16 @@ user input):


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


Create a Fedora 21 guest:
Create a Fedora 23 guest:

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

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

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

Expand All @@ -59,13 +59,13 @@ List all the guests:

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

$ virsh start 21-jeos --console
$ virsh start f23-jeos --console

Or

Connect to it via virt-viewer:

$ virt-viewer f21-jeos
$ virt-viewer f23-jeos


Oz notes
Expand All @@ -74,34 +74,34 @@ Oz notes
Oz uses something called TDL (template descriptive language). For
example:

./stdout-examples/f21/f21.tdl
./stdout-examples/f23/f23.tdl


Contents of the above file:

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

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

$ oz-install ./f21.tdl
$ oz-install ./f23.tdl

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

41 changes: 22 additions & 19 deletions oz/oz-jeos.bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
# A script to create JEOS(Just Enough Operating System)
#
# Purpose: A script to create JEOS (Just Enough Operating System) guest
#
# Copyright (C) 2015-2016 Red Hat Inc.
# NOTE: Once the `oz-install` command is finished, define the xml file
# and start the guest
#
Expand All @@ -21,12 +23,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.

set -x

# Usage
if [ $# -ne 2 ]; then
echo "Usage: $0 <guest-name> <distro>
'distro': f20, f19
Examples: `basename $0` f20-jeos f20 # create f20 guest"
'distro': f23, f22
Examples: `basename $0` f23-vm1 f23 # Create a F23 guest"
exit 1
fi

Expand All @@ -51,8 +54,9 @@ cat /proc/sys/net/ipv4/ip_forward
echo "IP forwarding enabled"
fi

# A few checks so that oz-install won't go crazy with iptables. (Just
# deals with the default virt-network)
# A few checks so that `oz-install` won't go crazy with iptables. (Just
# deals with the default libvirt network)

run_command() {
echo "# $@"
eval "$@"
Expand All @@ -65,54 +69,53 @@ run_command /usr/bin/virsh net-list --all
run_command cat /proc/sys/net/ipv4/ip_forward
) >& $LOGFILE2

if [ "$distro" = f20 ]; then
if [ "$distro" = f23 ]; then

# Create the TDL (Template Description Language) file

# Create the tdl file(note:the below url will be automatically redirected
# to our local tree))
function _make_tdl_fed() {
cat << EOF > $TDLFILE
<template>
<name>$NAME</name>
<os>
<name>Fedora</name>
<version>4</version>
<version>23</version>
<arch>x86_64</arch>
<install type='url'>
<url>http://dl.fedoraproject.org/pub/fedora/linux/releases/20/Fedora/x86_64/os</url>
<url>http://dl.fedoraproject.org/pub/fedora/linux/releases/23/Server/x86_64/os</url>
</install>
<rootpw>fedora</rootpw>
</os>
<description>Fedora 20</description>
<description>Fedora 23</description>
</template>
EOF
}

elif [ "$distro" = f19 ]; then
elif [ "$distro" = f22 ]; then

function _make_tdl_fed() {
cat << EOF > $TDLFILE
<template>
<name>$NAME</name>
<os>
<name>Fedora</name>
<version>19</version>
<version>f22</version>
<arch>x86_64</arch>
<install type='url'>
<url>http://dl.fedoraproject.org/pub/fedora/linux/releases/19/Fedora/x86_64/os/</url>
<url>http://dl.fedoraproject.org/pub/fedora/linux/releases/22/Fedora/x86_64/os/</url>
</install>
<rootpw>fedora</rootpw>
</os>
<description>Fedora 19</description>
<description>Fedora 22</description>
</template>
EOF
}

fi

# Create the TDL file
_make_tdl_fed

fi
sleep 2

#run the oz script as root
# Invoke `oz-install`, as root
/usr/bin/oz-install -d 4 $TDLFILE 2>&1 | tee $LOGFILE

0 comments on commit 05f4066

Please sign in to comment.