Mailing List Archive

merge.
# HG changeset patch
# User kaf24@firebug.cl.cam.ac.uk
# Node ID 592d8f74d23dc1753ccfc049cc08a368f7badf1b
# Parent 2e0700008a8703e532999ce02ff9331a367a5ca4
# Parent 5019c8d034c42bc343000ff450ef90476846c2c3
merge.

diff -r 2e0700008a87 -r 592d8f74d23d docs/man/xm.pod.1
--- a/docs/man/xm.pod.1 Wed Nov 16 10:32:19 2005
+++ b/docs/man/xm.pod.1 Wed Nov 16 10:33:13 2005
@@ -645,10 +645,6 @@

=item B<network-detach> I<domain-id> I<devid>

-=item B<network-limit> I<domain-id> I<vif> I<credit> I<period>
-
-Limit the transmission rate of a virtual network interface.
-
=item B<network-list> I<domain-id>

List virtual network interfaces for a domain. The returned output is
diff -r 2e0700008a87 -r 592d8f74d23d tools/python/xen/xend/XendClient.py
--- a/tools/python/xen/xend/XendClient.py Wed Nov 16 10:32:19 2005
+++ b/tools/python/xen/xend/XendClient.py Wed Nov 16 10:33:13 2005
@@ -301,13 +301,6 @@
return self.xendPost(self.domainurl(dom),
{'op' : 'set_vcpus',
'vcpus' : vcpus })
-
- def xend_domain_vif_limit(self, id, vif, credit, period):
- return self.xendPost(self.domainurl(id),
- { 'op' : 'vif_limit_set',
- 'vif' : vif,
- 'credit' : credit,
- 'period' : period })

def xend_domain_devices(self, id, type):
return self.xendPost(self.domainurl(id),
diff -r 2e0700008a87 -r 592d8f74d23d tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Wed Nov 16 10:32:19 2005
+++ b/tools/python/xen/xend/XendDomain.py Wed Nov 16 10:33:13 2005
@@ -466,17 +466,6 @@
except Exception, ex:
raise XendError(str(ex))

-
- def domain_vif_limit_set(self, domid, vif, credit, period):
- """Limit the vif's transmission rate
- """
- dominfo = self.domain_lookup(domid)
- dev = dominfo.getDevice('vif', vif)
- if not dev:
- raise XendError("invalid vif")
- return dev.setCreditLimit(credit, period)
-
-
def domain_maxmem_set(self, domid, mem):
"""Set the memory limit for a domain.

diff -r 2e0700008a87 -r 592d8f74d23d tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py Wed Nov 16 10:32:19 2005
+++ b/tools/python/xen/xm/main.py Wed Nov 16 10:33:13 2005
@@ -118,8 +118,6 @@
Create a new virtual network device
network-detach <DomId> <DevId> Destroy a domain's virtual network
device, where <DevId> is the device ID.
- network-limit <DomId> <Vif> <Credit> <Period>
- Limit the transmission rate of a virtual network interface
network-list <DomId> List virtual network interfaces for a domain

Vnet commands:
@@ -556,13 +554,6 @@
def xm_log(args):
from xen.xend.XendClient import server
print server.xend_node_log()
-
-def xm_network_limit(args):
- arg_check(args,4,"network-limit")
- dom = args[0]
- v = map(int, args[1:4])
- from xen.xend.XendClient import server
- server.xend_domain_vif_limit(dom, *v)

def xm_network_list(args):
arg_check(args,1,"network-list")
@@ -716,7 +707,6 @@
# network
"network-attach": xm_network_attach,
"network-detach": xm_network_detach,
- "network-limit": xm_network_limit,
"network-list": xm_network_list,
# vnet
"vnet-list": xm_vnet_list,
@@ -739,7 +729,6 @@
aliases = {
"balloon": "mem-set",
"vif-list": "network-list",
- "vif-limit": "network-limit",
"vbd-create": "block-create",
"vbd-destroy": "block-destroy",
"vbd-list": "block-list",

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog
Merge. [ In reply to ]
# HG changeset patch
# User sos22@douglas.cl.cam.ac.uk
# Node ID 9cc161c08b59ed78e405ac36fc67ec5d24dab37d
# Parent 52bddfb334ae233bc6c93f5d5ef89b8c14010e60
# Parent b6ebabe4658a0c08e17853431d1c0eba13664d6e
Merge.

Signed-off-by: Steven Smith, sos22@cam.ac.uk

diff -r 52bddfb334ae -r 9cc161c08b59 Config.mk
--- a/Config.mk Wed Nov 23 12:34:25 2005
+++ b/Config.mk Wed Nov 23 12:35:50 2005
@@ -8,7 +8,6 @@
# Tools to run on system hosting the build
HOSTCC = gcc
HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
-HOSTCFLAGS += -Wdeclaration-after-statement

AS = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)ld
@@ -39,7 +38,10 @@
EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBDIR)
endif

-CFLAGS += -Wdeclaration-after-statement
+test-gcc-flag = $(shell $(CC) -v --help 2>&1 | grep -q " $(1) " && echo $(1))
+
+HOSTCFLAGS += $(call test-gcc-flag,-Wdeclaration-after-statement)
+CFLAGS += $(call test-gcc-flag,-Wdeclaration-after-statement)

LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i))
CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
diff -r 52bddfb334ae -r 9cc161c08b59 xen/Rules.mk
--- a/xen/Rules.mk Wed Nov 23 12:34:25 2005
+++ b/xen/Rules.mk Wed Nov 23 12:35:50 2005
@@ -43,8 +43,6 @@
endif
ALL_OBJS += $(BASEDIR)/arch/$(TARGET_ARCH)/arch.o

-test-gcc-flag = $(shell $(CC) -v --help 2>&1 | grep -q " $(1) " && echo $(1))
-
include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk

ifneq ($(debug),y)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog
Merge. [ In reply to ]
# HG changeset patch
# User sos22@douglas.cl.cam.ac.uk
# Node ID 6d9ea03c1baa19dfefbbb6ccc7ab43cff2383206
# Parent 9cc161c08b59ed78e405ac36fc67ec5d24dab37d
# Parent 1d754a4ad3507bd94d441f5367fa8010c6f075f7
Merge.

Signed-off-by: Steven Smith, sos22@cam.ac.uk

diff -r 9cc161c08b59 -r 6d9ea03c1baa tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py Wed Nov 23 12:35:50 2005
+++ b/tools/python/xen/xm/main.py Wed Nov 23 12:38:34 2005
@@ -847,7 +847,8 @@

def usage(cmd=None):
if cmd == 'create':
- xm_subcommand("create", "--help")
+ mycmd = xm_lookup_cmd(cmd)
+ mycmd( ['--help'] )
sys.exit(1)
if help.has_key(cmd):
print " " + help[cmd]
diff -r 9cc161c08b59 -r 6d9ea03c1baa tools/xm-test/configure.ac
--- a/tools/xm-test/configure.ac Wed Nov 23 12:35:50 2005
+++ b/tools/xm-test/configure.ac Wed Nov 23 12:38:34 2005
@@ -50,6 +50,7 @@
tests/memmax/Makefile
tests/memset/Makefile
tests/migrate/Makefile
+ tests/network-attach/Makefile
tests/pause/Makefile
tests/reboot/Makefile
tests/restore/Makefile
diff -r 9cc161c08b59 -r 6d9ea03c1baa tools/xm-test/lib/XmTestLib/Test.py
--- a/tools/xm-test/lib/XmTestLib/Test.py Wed Nov 23 12:35:50 2005
+++ b/tools/xm-test/lib/XmTestLib/Test.py Wed Nov 23 12:38:34 2005
@@ -161,6 +161,29 @@
print "*** Test %s started at %s %s" % (name, t,
time.tzname[time.daylight])

+#
+# Try to start a domain and attach a console to it to see if
+# the console system is working
+#
+def isConsoleDead():
+
+ from XmTestLib import XmTestDomain, DomainError, XmConsole, ConsoleError
+
+ domain = XmTestDomain()
+
+ try:
+ domain.start()
+ console = XmConsole(domain.getName())
+ except DomainError, e:
+ return True
+ except ConsoleError, e:
+ return True
+
+ domain.destroy()
+
+ return False
+
+
if __name__ == "__main__":

timeStamp()
diff -r 9cc161c08b59 -r 6d9ea03c1baa tools/xm-test/tests/Makefile.am
--- a/tools/xm-test/tests/Makefile.am Wed Nov 23 12:35:50 2005
+++ b/tools/xm-test/tests/Makefile.am Wed Nov 23 12:38:34 2005
@@ -13,6 +13,7 @@
list \
memmax \
memset \
+ network-attach \
pause \
reboot \
sedf \
diff -r 9cc161c08b59 -r 6d9ea03c1baa tools/xm-test/tests/block-create/Makefile.am
--- a/tools/xm-test/tests/block-create/Makefile.am Wed Nov 23 12:35:50 2005
+++ b/tools/xm-test/tests/block-create/Makefile.am Wed Nov 23 12:38:34 2005
@@ -8,7 +8,9 @@
06_block_attach_baddomain_neg.test \
07_block_attach_baddevice_neg.test \
08_block_attach_bad_filedevice_neg.test \
- 09_block_attach_and_dettach_device_check_data_pos.test
+ 09_block_attach_and_dettach_device_check_data_pos.test \
+ 11_block_attach_shared_dom0.test \
+ 12_block_attach_shared_domU.test

DISABLED =

diff -r 9cc161c08b59 -r 6d9ea03c1baa tools/xm-test/tests/memset/04_memset_smallmem_pos.py
--- a/tools/xm-test/tests/memset/04_memset_smallmem_pos.py Wed Nov 23 12:35:50 2005
+++ b/tools/xm-test/tests/memset/04_memset_smallmem_pos.py Wed Nov 23 12:38:34 2005
@@ -30,7 +30,7 @@
FAIL("xm mem-set %s %i returned invalid %i != 0" %
(domain.getName(), domain.minSafeMem(), status))

-console.setLimit(8192)
+console.setLimit(65536)

try:
# See if this hits the byte limit
@@ -39,13 +39,15 @@
if e.reason == RUNAWAY:
# Need to stop the domain before we restart the console daemon
domain.destroy()
- if verbose:
+ if isConsoleDead():
print "*** Attempting restart of xenconsoled"
s, o = traceCommand("killall xenconsoled")
s, o = traceCommand("xenconsoled")
if s != 0:
print "*** Starting xenconsoled failed: %i" % s
- FAIL("Bug #380: I crashed the console system")
+ FAIL("Bug #380: I crashed the console system")
+ else:
+ FAIL("Bug #145: Ballooning DomU too low caused run-away")
else:
FAIL(str(e))

diff -r 9cc161c08b59 -r 6d9ea03c1baa xen/arch/x86/acpi/boot.c
--- a/xen/arch/x86/acpi/boot.c Wed Nov 23 12:35:50 2005
+++ b/xen/arch/x86/acpi/boot.c Wed Nov 23 12:38:34 2005
@@ -602,7 +602,8 @@
error = acpi_parse_madt_lapic_entries();
if (!error) {
acpi_lapic = 1;
-
+ generic_bigsmp_probe();
+
/*
* Parse MADT IO-APIC entries
*/
diff -r 9cc161c08b59 -r 6d9ea03c1baa xen/arch/x86/genapic/bigsmp.c
--- a/xen/arch/x86/genapic/bigsmp.c Wed Nov 23 12:35:50 2005
+++ b/xen/arch/x86/genapic/bigsmp.c Wed Nov 23 12:38:34 2005
@@ -45,7 +45,10 @@

static __init int probe_bigsmp(void)
{
- dmi_check_system(bigsmp_dmi_table);
+ if (def_to_bigsmp)
+ dmi_bigsmp = 1;
+ else
+ dmi_check_system(bigsmp_dmi_table);
return dmi_bigsmp;
}

diff -r 9cc161c08b59 -r 6d9ea03c1baa xen/arch/x86/genapic/probe.c
--- a/xen/arch/x86/genapic/probe.c Wed Nov 23 12:35:50 2005
+++ b/xen/arch/x86/genapic/probe.c Wed Nov 23 12:38:34 2005
@@ -29,6 +29,25 @@
NULL,
};

+static int cmdline_apic;
+
+void __init generic_bigsmp_probe(void)
+{
+ /*
+ * This routine is used to switch to bigsmp mode when
+ * - There is no apic= option specified by the user
+ * - generic_apic_probe() has choosen apic_default as the sub_arch
+ * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support
+ */
+
+ if (!cmdline_apic && genapic == &apic_default)
+ if (apic_bigsmp.probe()) {
+ genapic = &apic_bigsmp;
+ printk(KERN_INFO "Overriding APIC driver with %s\n",
+ genapic->name);
+ }
+}
+
static void __init genapic_apic_force(char *str)
{
int i;
@@ -41,7 +60,7 @@
void __init generic_apic_probe(void)
{
int i;
- int changed = (genapic != NULL);
+ int changed = cmdline_apic = (genapic != NULL);

for (i = 0; !changed && apic_probe[i]; i++) {
if (apic_probe[i]->probe()) {
diff -r 9cc161c08b59 -r 6d9ea03c1baa xen/arch/x86/mpparse.c
--- a/xen/arch/x86/mpparse.c Wed Nov 23 12:35:50 2005
+++ b/xen/arch/x86/mpparse.c Wed Nov 23 12:38:34 2005
@@ -62,6 +62,8 @@

int pic_mode;
unsigned long mp_lapic_addr;
+
+unsigned int def_to_bigsmp;

/* Processor that is doing the boot up */
unsigned int boot_cpu_physical_apicid = -1U;
@@ -213,6 +215,13 @@
ver = 0x10;
}
apic_version[m->mpc_apicid] = ver;
+ if ((num_processors > 8) &&
+ APIC_XAPIC(ver) &&
+ (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL))
+ def_to_bigsmp = 1;
+ else
+ def_to_bigsmp = 0;
+
bios_cpu_apicid[num_processors - 1] = m->mpc_apicid;
}

diff -r 9cc161c08b59 -r 6d9ea03c1baa xen/common/xmalloc.c
--- a/xen/common/xmalloc.c Wed Nov 23 12:35:50 2005
+++ b/xen/common/xmalloc.c Wed Nov 23 12:38:34 2005
@@ -111,9 +111,7 @@
unsigned long flags;

/* We currently always return cacheline aligned. */
-#ifndef __ia64__
BUG_ON(align > SMP_CACHE_BYTES);
-#endif

/* Add room for header, pad to align next header. */
size += sizeof(struct xmalloc_hdr);
diff -r 9cc161c08b59 -r 6d9ea03c1baa xen/include/asm-x86/apicdef.h
--- a/xen/include/asm-x86/apicdef.h Wed Nov 23 12:35:50 2005
+++ b/xen/include/asm-x86/apicdef.h Wed Nov 23 12:38:34 2005
@@ -16,6 +16,7 @@
#define GET_APIC_VERSION(x) ((x)&0xFF)
#define GET_APIC_MAXLVT(x) (((x)>>16)&0xFF)
#define APIC_INTEGRATED(x) ((x)&0xF0)
+#define APIC_XAPIC(x) ((x) >= 0x14)
#define APIC_TASKPRI 0x80
#define APIC_TPRI_MASK 0xFF
#define APIC_ARBPRI 0x90
diff -r 9cc161c08b59 -r 6d9ea03c1baa xen/include/asm-x86/mach-generic/mach_apic.h
--- a/xen/include/asm-x86/mach-generic/mach_apic.h Wed Nov 23 12:35:50 2005
+++ b/xen/include/asm-x86/mach-generic/mach_apic.h Wed Nov 23 12:38:34 2005
@@ -28,4 +28,6 @@
#define enable_apic_mode (genapic->enable_apic_mode)
#define phys_pkg_id (genapic->phys_pkg_id)

+extern void generic_bigsmp_probe(void);
+
#endif /* __ASM_MACH_APIC_H */
diff -r 9cc161c08b59 -r 6d9ea03c1baa xen/include/asm-x86/mpspec.h
--- a/xen/include/asm-x86/mpspec.h Wed Nov 23 12:35:50 2005
+++ b/xen/include/asm-x86/mpspec.h Wed Nov 23 12:38:34 2005
@@ -11,6 +11,7 @@
extern int quad_local_to_mp_bus_id [NR_CPUS/4][4];
extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES];

+extern unsigned int def_to_bigsmp;
extern unsigned int boot_cpu_physical_apicid;
extern int smp_found_config;
extern void find_smp_config (void);
diff -r 9cc161c08b59 -r 6d9ea03c1baa tools/xm-test/tests/block-create/11_block_attach_shared_dom0.py
--- /dev/null Wed Nov 23 12:35:50 2005
+++ b/tools/xm-test/tests/block-create/11_block_attach_shared_dom0.py Wed Nov 23 12:38:34 2005
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2005
+# Author: Dan Smith <danms@us.ibm.com>
+
+from XmTestLib import *
+
+# Mount /dev/ram0
+
+s, o = traceCommand("mkfs /dev/ram0")
+if s != 0:
+ FAIL("Unable to mkfs /dev/ram0")
+
+s, o = traceCommand("mkdir -p mnt");
+if s != 0:
+ FAIL("Unable to create ./mnt")
+
+s, o = traceCommand("mount /dev/ram0 mnt -o rw")
+if s != 0:
+ FAIL("Unable to mount /dev/ram0 on ./mnt")
+
+# Now try to start a DomU with write access to /dev/ram0
+
+domain = XmTestDomain();
+domain.configAddDisk("phy:/dev/ram0", "hda1", "w")
+
+try:
+ domain.start()
+ s, o = traceCommand("umount mnt")
+ FAIL("Bug #331: Started a DomU with write access to a rw mounted block device")
+except DomainError, e:
+ s, o = traceCommand("umount mnt")
diff -r 9cc161c08b59 -r 6d9ea03c1baa tools/xm-test/tests/block-create/12_block_attach_shared_domU.py
--- /dev/null Wed Nov 23 12:35:50 2005
+++ b/tools/xm-test/tests/block-create/12_block_attach_shared_domU.py Wed Nov 23 12:38:34 2005
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2005
+# Author: Dan Smith <danms@us.ibm.com>
+
+from XmTestLib import *
+
+dom1 = XmTestDomain()
+dom2 = XmTestDomain(dom1.getName() + "-2")
+
+dom1.configAddDisk("phy:/dev/ram0", "hda1", "w")
+dom2.configAddDisk("phy:/dev/ram0", "hda1", "w")
+
+try:
+ dom1.start()
+except DomainError, e:
+ FAIL("Unable to start domain")
+
+try:
+ dom2.start()
+ FAIL("Bug #331: Started a DomU with write access to an in-use block device")
+except DomainError, e:
+ pass
+
diff -r 9cc161c08b59 -r 6d9ea03c1baa tools/xm-test/tests/network-attach/01_network_attach_pos.py
--- /dev/null Wed Nov 23 12:35:50 2005
+++ b/tools/xm-test/tests/network-attach/01_network_attach_pos.py Wed Nov 23 12:38:34 2005
@@ -0,0 +1,48 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2005
+# Author: Murillo F. Bernardes <mfb@br.ibm.com>
+
+import sys
+
+from XmTestLib import *
+from network_utils import *
+
+# Create a domain (default XmTestDomain, with our ramdisk)
+domain = XmTestDomain()
+
+try:
+ domain.start()
+except DomainError, e:
+ if verbose:
+ print "Failed to create test domain because:"
+ print e.extra
+ FAIL(str(e))
+
+# Attach a console to it
+try:
+ console = XmConsole(domain.getName(), historySaveCmds=True)
+except ConsoleError, e:
+ FAIL(str(e))
+
+try:
+ # Activate the console
+ console.sendInput("input")
+ # Run 'ls'
+ run = console.runCmd("ls")
+except ConsoleError, e:
+ saveLog(console.getHistory())
+ FAIL(str(e))
+
+## Real test
+status, msg = network_attach(domain.getName(), console)
+if status:
+ FAIL(msg)
+
+
+##
+# Close the console
+console.closeConsole()
+
+# Stop the domain (nice shutdown)
+domain.stop()
diff -r 9cc161c08b59 -r 6d9ea03c1baa tools/xm-test/tests/network-attach/02_network_attach_detach_pos.py
--- /dev/null Wed Nov 23 12:35:50 2005
+++ b/tools/xm-test/tests/network-attach/02_network_attach_detach_pos.py Wed Nov 23 12:38:34 2005
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2005
+# Author: Murillo F. Bernardes <mfb@br.ibm.com>
+
+import sys
+import re
+import time
+
+from XmTestLib import *
+from network_utils import *
+
+# Create a domain (default XmTestDomain, with our ramdisk)
+domain = XmTestDomain()
+
+try:
+ domain.start()
+except DomainError, e:
+ if verbose:
+ print "Failed to create test domain because:"
+ print e.extra
+ FAIL(str(e))
+
+# Attach a console to it
+try:
+ console = XmConsole(domain.getName(), historySaveCmds=True)
+except ConsoleError, e:
+ FAIL(str(e))
+
+try:
+ # Activate the console
+ console.sendInput("input")
+ # Run 'ls'
+ run = console.runCmd("ls")
+except ConsoleError, e:
+ saveLog(console.getHistory())
+ FAIL(str(e))
+
+## Real test - attach and detach
+status, msg = network_attach(domain.getName(), console)
+if status:
+ FAIL(msg)
+
+status, msg = network_detach(domain.getName(), console)
+if status:
+ FAIL(msg)
+
+
+
+# Close the console
+console.closeConsole()
+
+# Stop the domain (nice shutdown)
+domain.stop()
diff -r 9cc161c08b59 -r 6d9ea03c1baa tools/xm-test/tests/network-attach/03_network_attach_detach_multiple_pos.py
--- /dev/null Wed Nov 23 12:35:50 2005
+++ b/tools/xm-test/tests/network-attach/03_network_attach_detach_multiple_pos.py Wed Nov 23 12:38:34 2005
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2005
+# Author: Murillo F. Bernardes <mfb@br.ibm.com>
+
+import sys
+import re
+import time
+
+from XmTestLib import *
+from network_utils import *
+
+# Create a domain (default XmTestDomain, with our ramdisk)
+domain = XmTestDomain()
+
+try:
+ domain.start()
+except DomainError, e:
+ if verbose:
+ print "Failed to create test domain because:"
+ print e.extra
+ FAIL(str(e))
+
+# Attach a console to it
+try:
+ console = XmConsole(domain.getName(), historySaveCmds=True)
+except ConsoleError, e:
+ FAIL(str(e))
+
+try:
+ # Activate the console
+ console.sendInput("input")
+ # Run 'ls'
+ run = console.runCmd("ls")
+except ConsoleError, e:
+ saveLog(console.getHistory())
+ FAIL(str(e))
+
+for i in range(10):
+ print "Attaching %d device" % i
+ status, msg = network_attach(domain.getName(), console)
+ if status:
+ FAIL(msg)
+
+ print "Detaching %d device" % i
+ status, msg = network_detach(domain.getName(), console, i)
+ if status:
+ FAIL(msg)
+
+# Close the console
+console.closeConsole()
+
+# Stop the domain (nice shutdown)
+domain.stop()
diff -r 9cc161c08b59 -r 6d9ea03c1baa tools/xm-test/tests/network-attach/04_network_attach_baddomain_neg.py
--- /dev/null Wed Nov 23 12:35:50 2005
+++ b/tools/xm-test/tests/network-attach/04_network_attach_baddomain_neg.py Wed Nov 23 12:38:34 2005
@@ -0,0 +1,17 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2005
+# Author: Murillo F. Bernardes <mfb@br.ibm.com>
+
+from XmTestLib import *
+
+status, output = traceCommand("xm network-attach NOT-EXIST")
+
+eyecatcher = "Error"
+where = output.find(eyecatcher)
+if status == 0:
+ FAIL("xm block-attach returned bad status, expected non 0, status is: %i" % status )
+elif where == -1:
+ FAIL("xm block-attach returned bad output, expected Error, output is: %s" % output )
+
+
diff -r 9cc161c08b59 -r 6d9ea03c1baa tools/xm-test/tests/network-attach/Makefile.am
--- /dev/null Wed Nov 23 12:35:50 2005
+++ b/tools/xm-test/tests/network-attach/Makefile.am Wed Nov 23 12:38:34 2005
@@ -0,0 +1,24 @@
+
+SUBDIRS =
+
+TESTS = 01_network_attach_pos.test \
+ 02_network_attach_detach_pos.test \
+ 03_network_attach_detach_multiple_pos.test \
+ 04_network_attach_baddomain_neg.test
+
+DISABLED =
+
+EXTRA_DIST = $(TESTS) $(XFAIL_TESTS) network_utils.py
+
+TESTS_ENVIRONMENT=@TENV@
+
+%.test: %.py
+ cp $< $@
+ chmod +x $@
+
+clean-local: am_config_clean-local
+
+am_config_clean-local:
+ rm -f *test
+ rm -f *log
+ rm -f *~
diff -r 9cc161c08b59 -r 6d9ea03c1baa tools/xm-test/tests/network-attach/network_utils.py
--- /dev/null Wed Nov 23 12:35:50 2005
+++ b/tools/xm-test/tests/network-attach/network_utils.py Wed Nov 23 12:38:34 2005
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2005
+# Author: Murillo F. Bernardes <mfb@br.ibm.com>
+
+from XmTestLib import *
+
+def count_eth(console):
+ try:
+ run = console.runCmd("ifconfig -a | grep eth")
+ except ConsoleError, e:
+ FAIL(str(e))
+ return = len(run['output'].splitlines())
+
+def network_attach(domain_name, console):
+ eths_before = count_eth(console)
+ status, output = traceCommand("xm network-attach %s" % domain_name)
+ if status != 0:
+ return -1, "xm network-attach returned invalid %i != 0" % status
+
+ eths_after = count_eth(console)
+ if (eths_after != (eths_before+1)):
+ return -2, "Network device is not actually connected to domU"
+
+ return 0, None
+
+def network_detach(domain_name, console, num=0):
+ eths_before = count_eth(console)
+ status, output = traceCommand("xm network-detach %s %d" % (domain_name, num))
+ if status != 0:
+ return -1, "xm network-attach returned invalid %i != 0" % status
+
+ eths_after = count_eth(console)
+ if eths_after != (eths_before-1):
+ return -2, "Network device was not actually disconnected from domU"
+
+ return 0, None

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog