From VNX
Jump to: navigation, search

EDIV Tutorial: deploying virtual scenarios over VNX clusters

The use of EDIV tool to manage distributed virtual scenarios is very similar to VNX. The most common options used, for example, to start (-t), stop (-d or -P) or execute commands (-x) are the same in both tools. This document will show how to start the example tutorial_ubuntu-dynamips.xml over a cluster made of two hosts (host1 and host2); you can experiment with any other example (use tutorial_ubuntu.xml in case you do not have CISCO images for dynamips routers).

Before starting a virtual scenario, you can check how the distribution will be done using "--seg-info" option. For example:

# cd /usr/share/vnx/examples
# ediv -f tutorial_ubuntu-dynamips.xml --seg-info
              ...some stuff deleted...
---- mode: seg-info
---- Showing vm's to host mapping for tutorial_ubuntu-dynamips.xml

 VM name         Type                    Host                
 h1              libvirt-kvm-linux       host1               
 r2              dynamips-3600           host2               
 h3              libvirt-kvm-linux       host1               
 h4              libvirt-kvm-linux       host2               
 h2              libvirt-kvm-linux       host2               
 r1              dynamips-3600           host1       

In this case we are using the simple round robin segmentation algorithm, so the virtual machines are equally distributed over the two hosts.

You can show the segmentation algorithms available with using "--seg-alg-info" option:

# ediv --seg-alg-info
              ...some stuff deleted...
---- mode: seg-alg-info
---- Showing segmentation algorithms available

     Algorithm name           --> Filename
     RoundRobin                   --> /usr/share/vnx/lib/seg-alg/round_robin.pm
     DynamicWeightedRoundRobin    --> /usr/share/vnx/lib/seg-alg/dynamic_weighted_round_robin.pm
     WeightedRoundRobin           --> /usr/share/vnx/lib/seg-alg/weighted_round_robin.pm

And test the distribution with another algorithm specifiying it with "-a" option:

# ediv -f tutorial_ubuntu-dynamips.xml  --seg-info -a WeightedRoundRobin
              ...some stuff deleted...
---- mode: seg-info
---- Showing vm's to host mapping for tutorial_ubuntu-dynamips.xml

 VM name         Type                    Host                
 h1              libvirt-kvm-linux       pasito              
 r2              dynamips-3600           pasito              
 h3              libvirt-kvm-linux       chopito             
 h4              libvirt-kvm-linux       chopito             
 h2              libvirt-kvm-linux       pasito              
 r1              dynamips-3600           pasito 

Before starting the scenario (as the error management of the tool is not well tuned yet) it is recommended to control each host log traces. To do that, in the controller just open one terminal window for each host and execute:

tail -f /var/log/vnx/<host_name>.log

changing <host_name> by the name of each cluster host.

Besides, it is also recomended to start the "ediv_monitor" simple tool that shows the scenarios and virtual machines deployed in each host:

ediv_monitor 2

To start the scenario just type:

ediv -f tutorial_ubuntu-dynamips.xml -t

If everything goes well, you will see the consoles of the six virtual machines being opened and the following tables at the end of command execution:

Scenario: tutorial_ubuntu-dynamips

Date: mar may 29 23:35:12 CEST 2012

 VM name                 Host                    Status              
 h1                      host1                   running             
 h2                      host2                   running             
 h3                      host1                   running             
 h4                      host2                   running             
 r1                      host1                   running             
 r2                      host2                   running             

-- Creating tunnels to access VM management interfaces
--   To access VM     at Host           use command
--  ---------------------------------------------------------------
--   h1               host1             ssh root@localhost -p 64000
--   h2               host2             ssh root@localhost -p 64001
--   r1               host1             telnet localhost 64002
--   r2               host2             telnet localhost 64003
--   h3               host1             ssh root@localhost -p 64004
--   h4               host2             ssh root@localhost -p 64005

If all the virtual machines do not reach the running state, the command will never finish. Just type ctrl-C to exit and have a look at host log files to investigate the cause of the problem.

Once the scenario is started, you can interact with the different virtual machines directly through the consoles or, alternatively, as this example scenario has the virtual machines management interfaces activated (see <vm_mgmt> tag), you can connect them from the controller using the ssh tunnels configured. For example:

ssh root@localhost -p 64000    # to connect with h1 Ubuntu VM
telnet localhost 64002         # to connect with dynamips r1 VM (remember to close r1 virtual console before connecting)

In case the virtual consoles are not opened automatically or if you close them, you can start them manually using the same parameters used in VNX (see VNX Console Management). For example:

ediv -f tutorial_ubuntu-dynamips.xml --console con0 -M h1

will open the graphical console of h1.

You also can execute commands over the virtual machines in the same way VNX does. For example, to start a web server on h3 and start a firefox web client in h1 that connects to h3 do:

ediv -f tutorial_ubuntu-dynamips.xml -x start-www -M h3
ediv -f tutorial_ubuntu-dynamips.xml -x www-h3 -M h1

You can restart a virtual machine conserving the changes made with:

ediv -f tutorial_ubuntu-dynamips.xml -d -M h2
ediv -f tutorial_ubuntu-dynamips.xml -t -M h2

Apart from the "-M" option used to specify a comma-separated list of virtual machines that restricts the execution of a command, EDIV includes a new option "-H" to specify a comma separated list of hosts and restrict command execution to hosts. For example, the following commands will restart all the virtual machines deployed to host2:

ediv -f tutorial_ubuntu-dynamips.xml -d -H host2
ediv -f tutorial_ubuntu-dynamips.xml -t -H host2

Finally, you can stop the whole scenario conserving virtual machine changes with:

ediv -f tutorial_ubuntu-dynamips.xml -d

Or deleting the changes with:

ediv -f tutorial_ubuntu-dynamips.xml -P

EDIV Cluster management commands

There are some useful EDIV commands you can use to manage the cluster:

  • --check-cluster: checks the status of each host in cluster and shows VNX version installed
  • --update-hosts: updates the VNX software in the cluster hosts (installs the version currently installed in the controller). By default, updates all cluster hosts. If '-H host_list' is used, only the hosts specified are updated. For example:
  • ediv --update-hosts             # updated all cluster hosts
    ediv --update-hosts -H host1    # updates only 'host1'
  • --clean-cluster: WARNING: use the following command with care. It completely resets the cluster state, destroying all virtual machines in hosts (libvirt, UML and dynamips), even those not started with VNX!. Besides, it completely deletes EDIV database content and VNX working directories in hosts, as well as restarting libvirt and dynamips dameons. It can be combined with -H option to restrict the command to a set of hosts. For example:
  • ediv --clean-cluster             # Restarts the whole cluster
    ediv --clean-cluster -H host1    # Restarts host1 (equivalent to execute 'vnx --clean-host' on host1)

    Confirmation is requested before proceeding.

  • --create-db: creates EDIV database
  • --reset-db: deletes EDIV database content:
    • with no aditional parameters, deletes the whole database content
    • if a scenario name or scenario XML file is specified, only the database entries belonging to that scenario are deleted. For example:
    • vnx --reset-db scenario1
      vnx --resed-db -f scenario1.xml
  • --delete-db: completely deletes EDIV database (content and structure)

Other EDIV Commands

  • --show-map: shows a map of the network scenarios build using graphviz. For example:
  • ediv -f tutorial_ubuntu-dynamips.xml --show-map
  • --exe-info: shows information about the commands available in a scenario. For example:
  • # ediv -f tutorial_ubuntu.xml --exe-info
         ...some stuff deleted...
    ---- mode: exe-info
    ---- Show info about scenario commands
    User-defined command sequences for scenario 'tutorial_ubuntu'