source: trunk/packages/xen-3.1/xen-3.1/tools/xm-test/tests/vcpu-pin/01_vcpu-pin_basic_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.2 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# 1) Make sure we have a multi cpu system
7# 2) Create a test domain and pin its VCPU0 to CPU 0 and then 1
8
9import sys;
10import re;
11
12from XmTestLib import *
13
14# Verify that we can run this test on this host
15if smpConcurrencyLevel() <= 1:
16    print "*** NOTE: This machine does not have more than one physical"
17    print "          or logical cpu.  The vcpu-pin test cannot be run!"
18    SKIP("Host not capable of running test")
19
20domain = XmTestDomain()
21
22try:
23    domain.start(noConsole=True)
24except DomainError, e:
25    if verbose:
26        print "Failed to create test domain because:"
27        print e.extra
28    FAIL(str(e))
29
30status, output = traceCommand("xm vcpu-pin %s 0 0" % domain.getName())
31
32if status != 0:
33    FAIL("xm vcpu-pin returned invalid %i != 0" % status)
34
35cpu = getVcpuInfo(domain.getName())[0]
36
37if cpu != 0:
38    FAIL("failed to switch VCPU 0 to CPU 0")
39
40status, output = traceCommand("xm vcpu-pin %s 0 1" % domain.getName())
41
42if status != 0:
43    FAIL("xm vcpu-pin returned invalid %i != 0" % status)
44
45cpu = getVcpuInfo(domain.getName())[0]
46
47if cpu != 1:
48    FAIL("failed to switch VCPU 0 to CPU 1")
49
50domain.stop()
Note: See TracBrowser for help on using the repository browser.