Re: [PATCH 18/18] KVM test: Add subtest of testing offload by ethtool
On Mon, 27 Sep 2010 18:44:04 -0400 Lucas Meneghel Rodrigues l...@redhat.com wrote: + +vm = kvm_test_utils.get_living_vm(env, params.get(main_vm)) +session = kvm_test_utils.wait_for_login(vm, + timeout=int(params.get(login_timeout, 360))) +# Let's just error the test if we identify that there's no ethtool installed +if session.get_command_status(ethtool -h): +raise error.TestError(Command ethtool not installed on guest) +session2 = kvm_test_utils.wait_for_login(vm, + timeout=int(params.get(login_timeout, 360))) +mtu = 1514 +feature_status = {} +filename = /tmp/ethtool.dd +guest_ip = vm.get_address() +ethname = kvm_test_utils.get_linux_ifname(session, vm.get_mac_address(0)) +supported_features = params.get(supported_features).split() I guess split this expects input. 23:48:03 ERROR| Test failed: AttributeError: 'NoneType' object has no attribute 'split' 22.12', '00:1a:4a:65:09:09': '192.168.122.66', '9a:52:2f:62:12:63': '192.168.122.151', '9a:52:2f:62:6b:28': '192.168.122.35'}, 'version': 0, 'tcpdump': kvm_subprocess.kvm_tail instance at 0x27cb200} 23:48:05 INFO | ['iteration.1'] 23:48:05 ERROR| Exception escaping from test: Traceback (most recent call last): File /home/pradeep/vhost_net/autotest/client/common_lib/test.py, line 412, in _exec _call_test_function(self.execute, *p_args, **p_dargs) File /home/pradeep/vhost_net/autotest/client/common_lib/test.py, line 605, in _call_test_function raise error.UnhandledTestFail(e) UnhandledTestFail: Unhandled AttributeError: 'NoneType' object has no attribute 'split' Traceback (most recent call last): File /home/pradeep/vhost_net/autotest/client/common_lib/test.py, line 598, in _call_test_function return func(*args, **dargs) File /home/pradeep/vhost_net/autotest/client/common_lib/test.py, line 284, in execute postprocess_profiled_run, args, dargs) File /home/pradeep/vhost_net/autotest/client/common_lib/test.py, line 202, in _call_run_once self.run_once_profiling(postprocess_profiled_run, *args, **dargs) File /home/pradeep/vhost_net/autotest/client/common_lib/test.py, line 308, in run_once_profiling self.run_once(*args, **dargs) File /home/pradeep/vhost_net/autotest/client/tests/kvm/kvm.py, line 73, in run_once run_func(self, params, env) File /home/pradeep/vhost_net/autotest/client/tests/kvm/tests/ethtool.py, line 185, in run_ethtool supported_features = params.get(supported_features).split() AttributeError: 'NoneType' object has no attribute 'split' --Pradeep -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [Autotest] [PATCH 18/18] KVM test: Add subtest of testing offload by ethtool
On Wed, 6 Oct 2010 14:26:46 +0530 pradeep psuri...@linux.vnet.ibm.com wrote: On Mon, 27 Sep 2010 18:44:04 -0400 Lucas Meneghel Rodrigues l...@redhat.com wrote: ion, vm.get_mac_address(0)) +supported_features = params.get(supported_features).split() I guess split this expects input. 23:48:03 ERROR| Test failed: AttributeError: 'NoneType' object has no attribute 'split' Neglect my earlier mail. i was using rtl8139. rtl8139 doesnt support this. --Pradeep ___ Autotest mailing list autot...@test.kernel.org http://test.kernel.org/cgi-bin/mailman/listinfo/autotest -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 18/18] KVM test: Add subtest of testing offload by ethtool
* pradeep psuri...@linux.vnet.ibm.com [2010-10-06 03:57]: On Mon, 27 Sep 2010 18:44:04 -0400 Lucas Meneghel Rodrigues l...@redhat.com wrote: + +vm = kvm_test_utils.get_living_vm(env, params.get(main_vm)) +session = kvm_test_utils.wait_for_login(vm, + timeout=int(params.get(login_timeout, 360))) +# Let's just error the test if we identify that there's no ethtool installed +if session.get_command_status(ethtool -h): +raise error.TestError(Command ethtool not installed on guest) +session2 = kvm_test_utils.wait_for_login(vm, + timeout=int(params.get(login_timeout, 360))) +mtu = 1514 +feature_status = {} +filename = /tmp/ethtool.dd +guest_ip = vm.get_address() +ethname = kvm_test_utils.get_linux_ifname(session, vm.get_mac_address(0)) +supported_features = params.get(supported_features).split() I guess split this expects input. 23:48:03 ERROR| Test failed: AttributeError: 'NoneType' object has no attribute 'split' That'll need an update to the tests_base.cfg file to ensure the test type has that config value set. Did the patchset miss updating tests_base.cfg.sample with this one ? 22.12', '00:1a:4a:65:09:09': '192.168.122.66', '9a:52:2f:62:12:63': '192.168.122.151', '9a:52:2f:62:6b:28': '192.168.122.35'}, 'version': 0, 'tcpdump': kvm_subprocess.kvm_tail instance at 0x27cb200} 23:48:05 INFO | ['iteration.1'] 23:48:05 ERROR| Exception escaping from test: Traceback (most recent call last): File /home/pradeep/vhost_net/autotest/client/common_lib/test.py, line 412, in _exec _call_test_function(self.execute, *p_args, **p_dargs) File /home/pradeep/vhost_net/autotest/client/common_lib/test.py, line 605, in _call_test_function raise error.UnhandledTestFail(e) UnhandledTestFail: Unhandled AttributeError: 'NoneType' object has no attribute 'split' Traceback (most recent call last): File /home/pradeep/vhost_net/autotest/client/common_lib/test.py, line 598, in _call_test_function return func(*args, **dargs) File /home/pradeep/vhost_net/autotest/client/common_lib/test.py, line 284, in execute postprocess_profiled_run, args, dargs) File /home/pradeep/vhost_net/autotest/client/common_lib/test.py, line 202, in _call_run_once self.run_once_profiling(postprocess_profiled_run, *args, **dargs) File /home/pradeep/vhost_net/autotest/client/common_lib/test.py, line 308, in run_once_profiling self.run_once(*args, **dargs) File /home/pradeep/vhost_net/autotest/client/tests/kvm/kvm.py, line 73, in run_once run_func(self, params, env) File /home/pradeep/vhost_net/autotest/client/tests/kvm/tests/ethtool.py, line 185, in run_ethtool supported_features = params.get(supported_features).split() AttributeError: 'NoneType' object has no attribute 'split' --Pradeep -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx ry...@us.ibm.com -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 18/18] KVM test: Add subtest of testing offload by ethtool
On Wed, 2010-10-06 at 10:55 -0500, Ryan Harper wrote: * pradeep psuri...@linux.vnet.ibm.com [2010-10-06 03:57]: On Mon, 27 Sep 2010 18:44:04 -0400 Lucas Meneghel Rodrigues l...@redhat.com wrote: + +vm = kvm_test_utils.get_living_vm(env, params.get(main_vm)) +session = kvm_test_utils.wait_for_login(vm, + timeout=int(params.get(login_timeout, 360))) +# Let's just error the test if we identify that there's no ethtool installed +if session.get_command_status(ethtool -h): +raise error.TestError(Command ethtool not installed on guest) +session2 = kvm_test_utils.wait_for_login(vm, + timeout=int(params.get(login_timeout, 360))) +mtu = 1514 +feature_status = {} +filename = /tmp/ethtool.dd +guest_ip = vm.get_address() +ethname = kvm_test_utils.get_linux_ifname(session, vm.get_mac_address(0)) +supported_features = params.get(supported_features).split() I guess split this expects input. 23:48:03 ERROR| Test failed: AttributeError: 'NoneType' object has no attribute 'split' That'll need an update to the tests_base.cfg file to ensure the test type has that config value set. Did the patchset miss updating tests_base.cfg.sample with this one ? I think pradeep forgot to update tests_base.cfg indeed. It's working fine for me. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 18/18] KVM test: Add subtest of testing offload by ethtool
The latest case contains TX/RX/SG/TSO/GSO/GRO/LRO test. RTL8139 NIC doesn't support TSO, LRO, it's too old, so drop offload test from rtl8139. LRO, GRO are only supported by latest kernel, virtio nic doesn't support receive offloading function. Initialize the callbacks first and execute all the sub tests one by one, all the result will be check at the end. When execute this test, vhost should be enabled, then most of new features can be used. Vhost doesn't support VIRTIO_NET_F_MRG_RXBUF, so do not check large packets in received offload test. Transfer files by scp between host and guest, match new opened TCP port by netstat. Capture the packages info by tcpdump, it contains package length. Changes from v3: - Error the test on the very beginning if we can't find ethtool installed on guest. TODO: Query supported offload function by 'ethtool' TODO: Find a clean way to get ethtool installed through apt-get/yum/whatever Signed-off-by: Amos Kong ak...@redhat.com --- client/tests/kvm/tests/ethtool.py | 222 client/tests/kvm/tests_base.cfg.sample | 13 ++- 2 files changed, 233 insertions(+), 2 deletions(-) create mode 100644 client/tests/kvm/tests/ethtool.py diff --git a/client/tests/kvm/tests/ethtool.py b/client/tests/kvm/tests/ethtool.py new file mode 100644 index 000..56b1c70 --- /dev/null +++ b/client/tests/kvm/tests/ethtool.py @@ -0,0 +1,222 @@ +import logging, commands, re +from autotest_lib.client.common_lib import error +from autotest_lib.client.bin import utils +import kvm_test_utils, kvm_utils + +def run_ethtool(test, params, env): + +Test offload functions of ethernet device by ethtool + +1) Log into a guest. +2) Initialize the callback of sub functions. +3) Enable/disable sub function of NIC. +4) Execute callback function. +5) Check the return value. +6) Restore original configuration. + +@param test: KVM test object. +@param params: Dictionary with the test parameters. +@param env: Dictionary with test environment. + +@todo: Not all guests have ethtool installed, so +find a way to get it installed using yum/apt-get/ +whatever + +def ethtool_get(type): +feature_pattern = { +'tx': 'tx.*checksumming', +'rx': 'rx.*checksumming', +'sg': 'scatter.*gather', +'tso': 'tcp.*segmentation.*offload', +'gso': 'generic.*segmentation.*offload', +'gro': 'generic.*receive.*offload', +'lro': 'large.*receive.*offload', +} +s, o = session.get_command_status_output(ethtool -k %s % ethname) +try: +return re.findall(%s: (.*) % feature_pattern.get(type), o)[0] +except IndexError: +logging.debug(Could not get %s status % type) + + +def ethtool_set(type, status): + +Set ethernet device offload status + +@param type: Offload type name +@param status: New status will be changed to + +logging.info(Try to set %s %s % (type, status)) +if status not in [off, on]: +return False +cmd = ethtool -K %s %s %s % (ethname, type, status) +if ethtool_get(type) != status: +return session.get_command_status(cmd) == 0 +if ethtool_get(type) != status: +logging.error(Fail to set %s %s % (type, status)) +return False +return True + + +def ethtool_save_params(): +logging.info(Save ethtool configuration) +for i in supported_features: +feature_status[i] = ethtool_get(i) + + +def ethtool_restore_params(): +logging.info(Restore ethtool configuration) +for i in supported_features: +ethtool_set(i, feature_status[i]) + + +def compare_md5sum(name): +logging.info(Compare md5sum of the files on guest and host) +host_result = utils.hash_file(name, method=md5) +try: +o = session.get_command_output(md5sum %s % name) +guest_result = re.findall(\w+, o)[0] +except IndexError: +logging.error(Could not get file md5sum in guest) +return False +logging.debug(md5sum: guest(%s), host(%s) % + (guest_result, host_result)) +return guest_result == host_result + + +def transfer_file(src=guest): + +Transfer file by scp, use tcpdump to capture packets, then check the +return string. + +@param src: Source host of transfer file +@return: Tuple (status, error msg/tcpdump result) + +session2.get_command_status(rm -rf %s % filename) +dd_cmd = dd if=/dev/urandom of=%s bs=1M count=%s % (filename, + params.get(filesize)) +logging.info(Creat file in source host, cmd: %s % dd_cmd) +tcpdump_cmd = tcpdump -lep -s 0 tcp -vv port ssh +if src == guest: +
Re: [Autotest] [PATCH 18/18] KVM test: Add subtest of testing offload by ethtool
On Tue, 14 Sep 2010 19:25:43 -0300 Lucas Meneghel Rodrigues l...@redhat.com wrote: The latest case contains TX/RX/SG/TSO/GSO/GRO/LRO test. RTL8139 NIC doesn't support TSO, LRO, it's too old, so drop offload test from rtl8139. LRO, GRO are only supported by latest kernel, virtio nic doesn't support receive offloading function. Initialize the callbacks first and execute all the sub tests one by one, all the result will be check at the end. When execute this test, vhost should be enabled, then most of new features can be used. Vhost doesn't support VIRTIO_NET_F_MRG_RXBUF, so do not check large packets in received offload test. Transfer files by scp between host and guest, match new opened TCP port by netstat. Capture the packages info by tcpdump, it contains package length. TODO: Query supported offload function by 'ethtool' Hi Lucas/AMos Thanks for the patches. Please find below error, when i try to run ethtool test on my guest (kernel: 2.6.32-71.el6.i386) which is on host (Kernel 2.6.32-71.el6.x86_64). 'module' object has no attribute 'get_linux_ifname'.. 04:23:59 DEBUG| Got shell prompt -- logged in 04:23:59 INFO | Logged into guest 'vm1' 04:23:59 ERROR| Test failed: AttributeError: 'module' object has no attribute 'get_linux_ifname' 04:23:59 DEBUG| Postprocessing VM 'vm1'... Ethtool is trying to access get_linux_ifname which is not present in kvm_test_utils.py. AM i missing any patches? Thanks Pradeep -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [Autotest] [PATCH 18/18] KVM test: Add subtest of testing offload by ethtool
On Thu, 2010-09-23 at 19:11 +0530, pradeep wrote: On Tue, 14 Sep 2010 19:25:43 -0300 Lucas Meneghel Rodrigues l...@redhat.com wrote: The latest case contains TX/RX/SG/TSO/GSO/GRO/LRO test. RTL8139 NIC doesn't support TSO, LRO, it's too old, so drop offload test from rtl8139. LRO, GRO are only supported by latest kernel, virtio nic doesn't support receive offloading function. Initialize the callbacks first and execute all the sub tests one by one, all the result will be check at the end. When execute this test, vhost should be enabled, then most of new features can be used. Vhost doesn't support VIRTIO_NET_F_MRG_RXBUF, so do not check large packets in received offload test. Transfer files by scp between host and guest, match new opened TCP port by netstat. Capture the packages info by tcpdump, it contains package length. TODO: Query supported offload function by 'ethtool' Hi Lucas/AMos Thanks for the patches. Please find below error, when i try to run ethtool test on my guest (kernel: 2.6.32-71.el6.i386) which is on host (Kernel 2.6.32-71.el6.x86_64). 'module' object has no attribute 'get_linux_ifname'.. 04:23:59 DEBUG| Got shell prompt -- logged in 04:23:59 INFO | Logged into guest 'vm1' 04:23:59 ERROR| Test failed: AttributeError: 'module' object has no attribute 'get_linux_ifname' 04:23:59 DEBUG| Postprocessing VM 'vm1'... Ethtool is trying to access get_linux_ifname which is not present in kvm_test_utils.py. AM i missing any patches? Yes, please verify http://patchwork.test.kernel.org/patch/2540/ Cheers! Lucas -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 18/18] KVM test: Add subtest of testing offload by ethtool
The latest case contains TX/RX/SG/TSO/GSO/GRO/LRO test. RTL8139 NIC doesn't support TSO, LRO, it's too old, so drop offload test from rtl8139. LRO, GRO are only supported by latest kernel, virtio nic doesn't support receive offloading function. Initialize the callbacks first and execute all the sub tests one by one, all the result will be check at the end. When execute this test, vhost should be enabled, then most of new features can be used. Vhost doesn't support VIRTIO_NET_F_MRG_RXBUF, so do not check large packets in received offload test. Transfer files by scp between host and guest, match new opened TCP port by netstat. Capture the packages info by tcpdump, it contains package length. TODO: Query supported offload function by 'ethtool' Signed-off-by: Amos Kong ak...@redhat.com --- client/tests/kvm/tests/ethtool.py | 215 client/tests/kvm/tests_base.cfg.sample | 13 ++- 2 files changed, 226 insertions(+), 2 deletions(-) create mode 100644 client/tests/kvm/tests/ethtool.py diff --git a/client/tests/kvm/tests/ethtool.py b/client/tests/kvm/tests/ethtool.py new file mode 100644 index 000..c0bab12 --- /dev/null +++ b/client/tests/kvm/tests/ethtool.py @@ -0,0 +1,215 @@ +import logging, commands, re +from autotest_lib.client.common_lib import error +from autotest_lib.client.bin import utils +import kvm_test_utils, kvm_utils + +def run_ethtool(test, params, env): + +Test offload functions of ethernet device by ethtool + +1) Log into a guest. +2) Initialize the callback of sub functions. +3) Enable/disable sub function of NIC. +4) Execute callback function. +5) Check the return value. +6) Restore original configuration. + +@param test: KVM test object. +@param params: Dictionary with the test parameters. +@param env: Dictionary with test environment. + +def ethtool_get(type): +feature_pattern = { +'tx': 'tx.*checksumming', +'rx': 'rx.*checksumming', +'sg': 'scatter.*gather', +'tso': 'tcp.*segmentation.*offload', +'gso': 'generic.*segmentation.*offload', +'gro': 'generic.*receive.*offload', +'lro': 'large.*receive.*offload', +} +s, o = session.get_command_status_output(ethtool -k %s % ethname) +try: +return re.findall(%s: (.*) % feature_pattern.get(type), o)[0] +except IndexError: +logging.debug(Could not get %s status % type) + + +def ethtool_set(type, status): + +Set ethernet device offload status + +@param type: Offload type name +@param status: New status will be changed to + +logging.info(Try to set %s %s % (type, status)) +if status not in [off, on]: +return False +cmd = ethtool -K %s %s %s % (ethname, type, status) +if ethtool_get(type) != status: +return session.get_command_status(cmd) == 0 +if ethtool_get(type) != status: +logging.error(Fail to set %s %s % (type, status)) +return False +return True + + +def ethtool_save_params(): +logging.info(Save ethtool configuration) +for i in supported_features: +feature_status[i] = ethtool_get(i) + + +def ethtool_restore_params(): +logging.info(Restore ethtool configuration) +for i in supported_features: +ethtool_set(i, feature_status[i]) + + +def compare_md5sum(name): +logging.info(Compare md5sum of the files on guest and host) +host_result = utils.hash_file(name, method=md5) +try: +o = session.get_command_output(md5sum %s % name) +guest_result = re.findall(\w+, o)[0] +except IndexError: +logging.error(Could not get file md5sum in guest) +return False +logging.debug(md5sum: guest(%s), host(%s) % + (guest_result, host_result)) +return guest_result == host_result + + +def transfer_file(src=guest): + +Transfer file by scp, use tcpdump to capture packets, then check the +return string. + +@param src: Source host of transfer file +@return: Tuple (status, error msg/tcpdump result) + +session2.get_command_status(rm -rf %s % filename) +dd_cmd = dd if=/dev/urandom of=%s bs=1M count=%s % (filename, + params.get(filesize)) +logging.info(Creat file in source host, cmd: %s % dd_cmd) +tcpdump_cmd = tcpdump -lep -s 0 tcp -vv port ssh +if src == guest: +s = session.get_command_status(dd_cmd, timeout=360) +tcpdump_cmd += and src %s % guest_ip +copy_files_fun = vm.copy_files_from +else: +s, o = commands.getstatusoutput(dd_cmd) +tcpdump_cmd += and dst %s % guest_ip +copy_files_fun =