[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Xen-users] Test tools for Xen


  • To: "trilok nuwal" <tc.nuwal@xxxxxxxxx>, "Xen list" <Xen-users@xxxxxxxxxxxxxxxxxxx>
  • From: "Kraska, Joe A \(US SSA\)" <joe.kraska@xxxxxxxxxxxxxx>
  • Date: Tue, 20 Feb 2007 08:37:14 -0800
  • Delivery-date: Tue, 20 Feb 2007 08:37:00 -0800
  • List-id: Xen user discussion <xen-users.lists.xensource.com>
  • Thread-index: AcdU8YeHqNfIinX9S+KYfxSfW5aVkgAGyGVg
  • Thread-topic: [Xen-users] Test tools for Xen

>I want to know the available automated test tools for xen.Â
>I know one test tool xm-test. Any other availabe tool ?


Rename the below file to pingpong.py

Replace the hosts entries with two ips of xen dom0 hosts.

Create a dom0 on one of the hosts.

Run the program on both hosts, by typing "python pingpong.py" from
the command line.

It will start migrating them back and forth in a game of ping pong. â

Only a small mutation to the code would randomly pick from hosts to
migrate to if there were more than two dom0âs.

Joe

----------------------

import commands
import string
import time
import socket

destination_host = None
n_migrations = 0

hosts = {
        "10.35.39.39" : None,
        "10.35.39.40" : None,
        }

def main():

        init_network()

        while( 1 ):

                time.sleep(2)
                maybe_migrate()

def init_network():

        global destination_host

        hostname = socket.gethostname( )        
        addr = socket.gethostbyname( hostname )
        del hosts[addr]
        for key in hosts.keys(): destination_host = key
        print "this host is %s, destination is %s" % ( addr, destination_host )

def maybe_migrate():

        global n_migrations

        status, output = commands.getstatusoutput ( "xm list" )

        lines = output.split('\n');

        if( len(lines) == 2 ):
                print "nothing to migrate"

        for line in lines:

                words = line.split()

                if ( words[0] == "Name" ) : continue
                if ( words[0] == "Domain-0" ) : continue

                print line

                name = words[0]
                id = words[1]
                mem = words[2]
                vcpus = words[3]
                state = words[4]
                time = words[5]

                if( state == "r-----" or state == "-b----" ):

                        command = "xm migrate --live %s %s" % ( id, 
destination_host )
                        print "%s (migrating) ..." % command
                        status, output = commands.getstatusoutput ( command )
                        n_migrations += 1
                        print "...migrated ( %d migrations total ) " % 
n_migrations

                else:

                        print "non migratable state for: %s %s " % ( id, state )
                        
if( __name__ == "__main__" ): main()


_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.