WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

RE: [Xen-users] Test tools for Xen

To: "trilok nuwal" <tc.nuwal@xxxxxxxxx>, "Xen list" <Xen-users@xxxxxxxxxxxxxxxxxxx>
Subject: RE: [Xen-users] Test tools for Xen
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
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <f58fc26d0702200517q3c6da07eq92103edb41f64f8d@xxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
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
<Prev in Thread] Current Thread [Next in Thread>