source: trunk/packages/xen-3.1/xen-3.1/tools/xm-test/lib/XmTestLib/DomainTracking.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 Author: Dan Smith <danms@us.ibm.com>
5
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.
9
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.
14
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
18
19"""
20
21import atexit
22import Test
23import xapi
24
25# Tracking of managed domains
26_managedDomains = []
27_VMuuids = []
28registered = 0
29
30def addManagedDomain(name):
31    global registered
32    _managedDomains.append(name)
33    if not registered:
34        atexit.register(destroyManagedDomains)
35        registered = 1
36
37def delManagedDomain(name):
38    if name in _managedDomains:
39        del _managedDomains[_managedDomains.index(name)]
40
41def addXAPIDomain(uuid):
42    global registered
43    _VMuuids.append(uuid)
44    if not registered:
45        atexit.register(destroyManagedDomains)
46        registered = 1
47
48def delXAPIDomain(uuid):
49    _VMuuids.remove(uuid)
50
51def 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)
60
61
Note: See TracBrowser for help on using the repository browser.