source: trunk/packages/xen-3.1/xen-3.1/tools/xm-test/tests/create/11_create_concurrent_pos.py @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

  • Property svn:mime-type set to text/script
File size: 1.7 KB
Line 
1#!/usr/bin/python
2
3# Copyright (C) International Business Machines Corp., 2005
4# Authors: Dan Smith <danms@us.ibm.com>
5
6from XmTestLib import *
7
8import time
9import random
10
11if ENABLE_HVM_SUPPORT:
12    MAX_DOMS = getMaxHVMDomains()
13    if MAX_DOMS > 50:
14        MAX_DOMS = 50
15else:
16    MAX_DOMS = 50
17
18MIN_DOMS    = 5
19MEM_PER_DOM = minSafeMem()
20
21domains = []
22console = []
23
24free_mem = int(getInfo("free_memory"))
25
26NUM_DOMS = free_mem / MEM_PER_DOM
27
28if NUM_DOMS < MIN_DOMS:
29    SKIP("Need %i MB of RAM to start %i@%iMB domains! (%i MB avail)" %
30         (MIN_DOMS * MEM_PER_DOM, MIN_DOMS, MEM_PER_DOM,
31          free_mem))
32
33if NUM_DOMS > MAX_DOMS:
34    if verbose:
35        print "*** %i doms is too many: capping at %i" % (NUM_DOMS, MAX_DOMS)
36    NUM_DOMS = MAX_DOMS
37
38if verbose:
39    print "Watch out!  I'm trying to create %i DomUs!" % NUM_DOMS
40
41for d in range(0, NUM_DOMS):
42    dom = XmTestDomain(name="11_create_%i" % d,
43                       extraConfig={"memory":MEM_PER_DOM})
44
45    try:
46        cons = dom.start()
47    except DomainError, e:
48        if verbose:
49            print str(e)
50        FAIL("[%i] Failed to create domain" % d)
51
52    try:
53        cons.runCmd("ls")
54    except ConsoleError, e:
55        FAIL("[%i] Failed to attach console to %s" % (d, dom.getName()))
56
57    domains.append(dom)
58    console.append(cons)
59   
60    if verbose:
61        print "[%i] Started %s" % (d, dom.getName())
62
63
64# If we make it here, we will test several of the DomUs consoles
65
66for i in range(0,5):
67    c = random.randint(0, NUM_DOMS-1)
68
69    if verbose:
70        print "Testing console of %s" % domains[c].getName()
71
72    try:
73        run = console[c].runCmd("ls")
74    except ConsoleError, e:
75        FAIL(str(e))
76
77    if run["return"] != 0:
78        FAIL("'ls' returned invalid %i != 0" % run["return"])
Note: See TracBrowser for help on using the repository browser.