debuggers.hg

view tools/xm-test/lib/XmTestLib/DomainTracking.py @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children
line source
1 #!/usr/bin/python
2 """
3 Copyright (C) International Business Machines Corp., 2005
4 Author: Dan Smith <danms@us.ibm.com>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; under version 2 of the License.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 """
21 import atexit
22 import Test
23 import xapi
25 # Tracking of managed domains
26 _managedDomains = []
27 _VMuuids = []
28 registered = 0
30 def addManagedDomain(name):
31 global registered
32 _managedDomains.append(name)
33 if not registered:
34 atexit.register(destroyManagedDomains)
35 registered = 1
37 def delManagedDomain(name):
38 if name in _managedDomains:
39 del _managedDomains[_managedDomains.index(name)]
41 def addXAPIDomain(uuid):
42 global registered
43 _VMuuids.append(uuid)
44 if not registered:
45 atexit.register(destroyManagedDomains)
46 registered = 1
48 def delXAPIDomain(uuid):
49 _VMuuids.remove(uuid)
51 def destroyManagedDomains():
52 if len(_managedDomains) > 0:
53 for m in _managedDomains:
54 Test.traceCommand("xm destroy %s" % m)
55 Test.traceCommand("xm delete %s" % m)
56 if len(_VMuuids) > 0:
57 for uuid in _VMuuids:
58 Test.traceCommand("xm destroy %s" % uuid)
59 Test.traceCommand("xm delete %s" % uuid)