Skip to contentSkip to conversation

TAP network support in kvm-autotest

PATCH New Jason Wang 1 participant 1 message May 13, 2009 1 message not in the archive KVM

lore
Share & tools
lore

Jason Wang

author
#1 lore raw

PATCH 1/1 TAP network support in kvm-autotest

In reply to a message not in the archive

Hi All:
This patch tries to add tap network support in kvm-autotest. Multiple nics connected to different bridges could be achieved through this script. Public bridge is important for testing real network traffic and migration. The patch gives each nic with randomly generated mac address. The ip address required in the test could be dynamically probed through nmap/arp. Only the ip address of first NIC is used through the test.

Example:
nics = nic1 nic2
network = bridge
bridge = switch
ifup =/etc/qemu-ifup-switch
ifdown =/etc/qemu-ifdown-switch

This would make the virtual machine have two nics both of which are connected to a bridge with the name of 'switch'. Ifup/ifdown scripts are also specified.

Another Example:
nics = nic1 nic2
network = bridge
bridge = switch
bridge_nic2 = virbr0
ifup =/etc/qemu-ifup-switch
ifup_nic2 = /etc/qemu-ifup-virbr0

This would makes the virtual machine have two nics: nic1 are connected to bridge 'switch' and nci2 are connected to bridge 'virbr0'.

Public mode and user mode nic could also be mixed:
nics = nic1 nic2
network = bridge
network_nic2 = user

Looking forward for comments and suggestions.

From: jason <[email protected]>
Date: Wed, 13 May 2009 16:15:28 +0800
Subject: [PATCH] Add tap networking support.

---
 client/tests/kvm_runtest_2/kvm_utils.py |    7 +++
 client/tests/kvm_runtest_2/kvm_vm.py    |   74 ++++++++++++++++++++++++++-----
 2 files changed, 69 insertions(+), 12 deletions(-)
client/tests/kvm_runtest_2/kvm_utils.py +7 -0
index be8ad95..0d1f7f8 100644
@@ -773,3 +773,10 @@ def md5sum_file(filename, size=None):
         size -= len(data)
     f.close()
     return o.hexdigest()
+
+def random_mac():
+    mac=[0x00,0x16,0x30,
+         random.randint(0x00,0x09),
+         random.randint(0x00,0x09),
+         random.randint(0x00,0x09)]
+    return ':'.join(map(lambda x: "%02x" %x,mac))
client/tests/kvm_runtest_2/kvm_vm.py +62 -12

115 lines not on this page · raw message

Signature · 1 line
1.5.5.6