Difference between revisions of "Vnx-examples"

From VNUML-WIKI
Jump to: navigation, search
Line 67: Line 67:
 
</ul>
 
</ul>
  
== root_fs_XXX.xml ==
+
=== root_fs_XXX.xml ===
  
 
To modify a root filesystem, for example, installing new software packages, just start the associated libvirt scenario with:
 
To modify a root filesystem, for example, installing new software packages, just start the associated libvirt scenario with:

Revision as of 19:04, 29 September 2010

VNX Example Scenarios

Several example scenarios are distributed together with VNX to allow easily testing its functionalities (see /usr/share/vnx/examples directory).

Three types of scenarios are included:

  • simple-XXX.xml, which are simple scenarios made of one virtual machine with one network interfaces.
    • simple_uml.xml: a single Linux virtual machine started using UML with address 10.0.0.2
    • simple_xp.xml: a single Windows XP virtual machine started using libvirt with address 10.0.0.3
    • simple_win7.xml: a single Windows 7 virtual machine started using libvirt with address 10.0.0.4
    • simple_ubuntu.xml: a single Ubuntu 10.04.1 server virtual machine started using libvirt with address 10.0.0.5
    • simple_ubuntu-gui.xml: a single Ubuntu 10.04.1 virtual machine with a minimal GNOME gui started using libvirt with address 10.0.0.6
    • simple_freebsd.xml: a single FreeBSD 8.1 server virtual machine started using libvirt with address 10.0.0.7
    • simple_freebsd-gui.xml: a single FreeBSD 8.1 virtual machine with a minimal GNOME gui started using libvirt with address 10.0.0.8
    • All scenarios share the same network (Net0, 10.0.0.0/24) to allow connectivity among all the virtual machines and the host (which has address 10.0.0.1)

  • tutorial_root1-XXXX.xml, which are virtual scenarios based on the VNUML tutorial scenario but starting virtual machines using other operating systems.
  • root_fs_XXX.xml, which are libvirt specifications to start virtual machines with Internet connection (through a NAT) using the different VNX root file-system. They are included to easily allow modifying root filesystems (for example, to install new software packages).

To test the scenarios:

  • Open a root shell from the graphical console of the host machine. If you are not sat in front of host's console you can access it using ssh with X-forwarding activated. For example, from a Unix machine you can use:
  •   ssh -X <host-addr>
    

    In this case, it is recommended to test that X-forwarding is working by launching a "xterm" or "xeyes" application and seeing that the application window is correctly launched.

    Es importante además que la conectividad entre la máquina cliente y el servidor donde se ejecuta VNX sea buena, ya que el acceso a las consolas de las máquinas virtuales se hace impracticable en caso contrario.

Simple scenarios (simple_XXXX.xml)

  • Start simple scenarios by means of:
  • vnx -f /usr/share/vnx/examples/simple_xp.xml -v -u root --create
    

    Just after the execution, you will see the console of the Windows XP machine starting. Once the machine has completely started, the autoconfiguration daemon will configure it (the name and network interfaces are configured in general; only the name in the simple example) and restart it for the changes to take effect.

    After the restart, the virtual machine will be available for interacting with it.

    Note: virt-viewer console application "captures" the mouse when interacting with the virtual machines. You have to type "Ctrl-Alt" to release the mouse.

  • To stop the scenario preserving the changes made:
  • vnx -f /usr/share/vnx/examples/simple_xp.xml -v -u root --shutdown
    
  • To stop the scenario discarding the changes made:
  • vnx -f /usr/share/vnx/examples/simple_xp.xml -v -u root --destroy
    

Tutorial scenarios (tutorial_root1_XXXX.xml)

  • To start the tutorial scenario with linux and XP machines just type:
  • vnx -f tutorial_root1_xp.xml -v -u root --create
    
  • Once the scenario has completely started (remenber that the XP machines have to be restarted for the autoconfiguration to complete), you can test the network connectivity, for example, accesing uml1 machine and tracing to uml5: traceroute -n 10.0.2.2
  • Para parar y rearrancar una máquina concreta sin perder las modificaciones realizadas: vnx -d examples/tutorial_root1_xp.xml -v -u root -M uml4 vnx -t examples/tutorial_root1_xp.xml -v -u root -M uml4
  • Para parar y rearrancar una máquina concreta creando una copia nueva desde el rootfs original: vnx -P examples/tutorial_root1_xp.xml -v -u root -M uml4 vnx -t examples/tutorial_root1_xp.xml -v -u root -M uml4

root_fs_XXX.xml

To modify a root filesystem, for example, installing new software packages, just start the associated libvirt scenario with:

virsh create root_fs_XXX.xml

And open the console using:

virt-viewer VMNAME

being VMNAME the name assigned to the virtual machine (you can get it with "virsh list" command or just looking for the <name> tag in root_fs_XXX.xml file).

To easy the process, you can use the following script that starts the virtual machine and opens the console:

#/bin/bash

XMLFILE=$1
echo $XMLFILE
# Find tag in the xml, convert tabs to spaces, remove leading spaces, remove the tag.
VMNAME=$( grep "<name>" $XMLFILE | \
        tr '\011' '\040' | \
        sed -e 's/^[ ]*//' \
            -e 's/^<.*>\([^<].*\)<.*>$/\1/' )
echo Starting $VMNAME virtual machine
virsh create $XMLFILE && virt-viewer $VMNAME &

Just copy the previous script to a file named vnx_modify_rootfs (or whatever you want) and invoke it with:

vnx_modify_rootfs root_fs_XXX.xml