TAP network support in kvm-autotest
PATCH 1/1 TAP network support in kvm-autotest
In reply to a message not in the archiveHi 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 = switchbridge_nic2 = virbr0
ifup =/etc/qemu-ifup-switchifup_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 = bridgenetwork_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
@@ -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