Difference between revisions of "Vnx-examples"

From VNX
Jump to: navigation, search
Line 5: Line 5:
 
Each simple scenario includes just one virtual machine connected to a Network (Net0, 10.0.0.0/24), where the hosts has also a virtual network interface connected (10.0.0.1).
 
Each simple scenario includes just one virtual machine connected to a Network (Net0, 10.0.0.0/24), where the hosts has also a virtual network interface connected (10.0.0.1).
  
The simple scenarios are prepared to be started and tested individually or to be started all together to for the scenario shown in Figure 1.  
+
The simple scenarios are prepared to be started and tested individually or to be started all together to for the compound scenario shown in Figure 1.  
  
 
<center>
 
<center>
[[Image:Simple.png|800px]]
+
[[Image:Simple.png|800px]<div align=center>
 +
'''Figure 1: simple scenarios topology'''</div>]
 
</center>
 
</center>
  

Revision as of 13:55, 27 July 2011

VNX Simple Scenarios

Several simple example scenarios are included in VNX distribution to allow testing the tool functionalities with the different types of virtual machines supported (see /usr/share/vnx/examples/simple_*.xml files).

Each simple scenario includes just one virtual machine connected to a Network (Net0, 10.0.0.0/24), where the hosts has also a virtual network interface connected (10.0.0.1).

The simple scenarios are prepared to be started and tested individually or to be started all together to for the compound scenario shown in Figure 1.

[[Image:Simple.png|800px]
Figure 1: simple scenarios topology
]


Three types of scenarios are included:

  • simple-XXXX.xml, which are a set of simple scenarios made of one virtual machine with one network interface.
    • 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)


For example, the simple_ubuntu-gui.xml scenario:




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. Besides, as the access to the virtual machine consoles is tipically made using virt-viewer application (VNC protocol), you need a good connectivity between your machine and the host were VNX runs.

Simple scenarios (simple_XXXX.xml)

  • Start simple scenarios by means of:
  • sudo vnx -f /usr/share/vnx/examples/simple_XXXX.xml -v --create
    

    For example, to start an XP virtual machine type:

    sudo vnx -f /usr/share/vnx/examples/simple_xp.xml -v --create
    

    Just after the execution, you will see the console of the Windows XP machine starting. Once the machine has completely started, the VNX autoconfiguration daemon will configure its name and the network interfaces and restart the machine 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.

  • Once started, you can test the network connectivity form the host to the virtual machine:
    root@tutatis:/usr/share/vnx/examples# ping -c 4 10.0.0.3
    PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data.
    64 bytes from 10.0.0.3: icmp_seq=1 ttl=128 time=0.312 ms
    64 bytes from 10.0.0.3: icmp_seq=2 ttl=128 time=0.376 ms
    64 bytes from 10.0.0.3: icmp_seq=3 ttl=128 time=0.249 ms
    64 bytes from 10.0.0.3: icmp_seq=4 ttl=128 time=0.260 ms
    
    --- 10.0.0.3 ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 2999ms
    rtt min/avg/max/mdev = 0.249/0.299/0.376/0.051 ms
    
  • You can also execute commands on the virtual machine from the host. For example, you can start the calculator on the Windows XP machine by issuing:
  • sudo vnx -f /usr/share/vnx/examples/simple_xp.xml -v --exe calc
    

    This command has been specified inside the simple_xp.xml file in the line:

    <exec seq="calc" type="verbatim" mode="system">calc.exe</exec>
    

    Note: the previous command does not end till you close the calc application.

    You can also copy a text file from the host to the virtual machine and show it using Notepad by issuing:

    sudo vnx -f /usr/share/vnx/examples/simple_xp.xml -v --exe vnxtxt
    

    This command is specified using the following two lines:

    <filetree seq="vnxtxt" root="c:\temp">conf/txtfile</filetree>
    <exec seq="vnxtxt" type="verbatim" mode="system">start /max notepad c:\temp\vnx.txt</exec>
    
  • You can start a Linux Ubuntu server with:
  • sudo vnx -f /usr/share/vnx/examples/simple_ubuntu.xml -v --create
    

    And start a web server inside it with:

    sudo vnx -f /usr/share/vnx/examples/simple_ubuntu.xml -v --exe start-www
    

    And test the web server access from the XP virtual machine by manually opening a web navigator and loading URL http://10.0.0.4.

    Vnx-simple xp.png

  • You can find more example commands by having a look at <exec> and <filetree> tags in simple_XXXX.xml files.
  • To stop the scenario preserving the changes made:
  • sudo vnx -f /usr/share/vnx/examples/simple_xp.xml -v --shutdown
    

    You can later restart the scenario with:

    sudo vnx -f /usr/share/vnx/examples/simple_xp.xml -v --create
    
  • To stop the scenario discarding the changes made:
  • sudo vnx -f /usr/share/vnx/examples/simple_xp.xml -v --destroy
    

Tutorial scenarios (tutorial_root1_XXXX.xml)

  • To start the tutorial scenario with linux, FreeBSD, XP and Win7 virtual machines just type:
  • sudo vnx -f tutorial_root1_all.xml -v --create
    
  • Once the scenario has completely started (remenber that libvirt machines have to be restarted for the autoconfiguration to complete), you should see all the virtual machine consoles:
  • Vnx-tutorial root1 all-s.png

  • You can test the network connectivity, for example, accesing h1 machine and tracing to h4: traceroute -n 10.0.2.3
  • To stop and restart a virtual machine without loosing the modifications you have made you can type:: sudo vnx -f tutorial_root1_all.xml -v --shutdown -M uml4 sudo vnx -f tutorial_root1_all.xml -v --create -M uml4
  • The same but loosing the changes made and returning to a fresh virtual machine state: sudo vnx -f tutorial_root1_all.xml -v --destroy -M uml4 sudo vnx -f tutorial_root1_all.xml -v --create -M uml4

Other interesting options

You can see a graphical map of the virtual scenario using the --show-map option:

 sudo vnx -f tutorial_root1_all.xml -v --show-map

Modify root filesystem scenarios (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 vnx_modify_rootfs simple script that starts the virtual machine and opens the console:

/usr/share/vnx/bin/vnx_modify_rootfs root_fs_XXX.xml