All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [KVM-AUTOTEST PATCH 4/5] KVM test: kvm_subprocess: rename get_command_status_output() and friends
       [not found] <2034814473.1590591288159137734.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>
@ 2010-10-27  5:59 ` Feng Yang
  2010-10-27  9:10   ` Michael Goldish
  2010-10-27 12:04   ` [Autotest] " Lucas Meneghel Rodrigues
  0 siblings, 2 replies; 4+ messages in thread
From: Feng Yang @ 2010-10-27  5:59 UTC (permalink / raw)
  To: Michael Goldish; +Cc: autotest, kvm


----- "Michael Goldish" <mgoldish@redhat.com> wrote:

> From: "Michael Goldish" <mgoldish@redhat.com>
> To: autotest@test.kernel.org, kvm@vger.kernel.org
> Cc: "Michael Goldish" <mgoldish@redhat.com>
> Sent: Wednesday, October 27, 2010 12:49:43 AM GMT +08:00 Beijing / Chongqing / Hong Kong / Urumqi
> Subject: [KVM-AUTOTEST PATCH 4/5] KVM test: kvm_subprocess: rename get_command_status_output() and friends
>
> get_command_status_output() -> cmd_status_output()
> get_command_output() -> cmd_output()
> get_command_status() -> cmd_status()
Any reason for these change? coding style issue?
If there is no necessary reason, we better do not change them. These functions is widely used, the change may introduce errors.
Changing interface will bring some workload and risk.  At least we need change all our internal case when merging with upstream.

> 
> Signed-off-by: Michael Goldish <mgoldish@redhat.com>
> ---
>  client/tests/kvm/kvm_subprocess.py                 |   27
> +++++++++----------
>  client/tests/kvm/kvm_test_utils.py                 |   20
> +++++++-------
>  client/tests/kvm/tests/ethtool.py                  |   16
> ++++++------
>  client/tests/kvm/tests/guest_s4.py                 |    8 +++---
>  client/tests/kvm/tests/guest_test.py               |    3 +-
>  client/tests/kvm/tests/iofuzz.py                   |    2 +-
>  client/tests/kvm/tests/ioquit.py                   |    4 +-
>  client/tests/kvm/tests/iozone_windows.py           |    4 +-
>  client/tests/kvm/tests/ksm_overcommit.py           |    4 +-
>  client/tests/kvm/tests/linux_s3.py                 |    4 +-
>  client/tests/kvm/tests/migration.py                |    7 ++---
>  client/tests/kvm/tests/multicast.py                |    8 +++---
>  client/tests/kvm/tests/netperf.py                  |    4 +-
>  client/tests/kvm/tests/nic_promisc.py              |    4 +-
>  client/tests/kvm/tests/nicdriver_unload.py         |    4 +-
>  client/tests/kvm/tests/pci_hotplug.py              |    6 ++--
>  client/tests/kvm/tests/physical_resources_check.py |    2 +-
>  client/tests/kvm/tests/timedrift.py                |    2 +-
>  client/tests/kvm/tests/vlan.py                     |   11 +++----
>  client/tests/kvm/tests/whql_client_install.py      |   10 +++---
>  client/tests/kvm/tests/whql_submission.py          |    4 +-
>  21 files changed, 75 insertions(+), 79 deletions(-)
> 
> diff --git a/client/tests/kvm/kvm_subprocess.py
> b/client/tests/kvm/kvm_subprocess.py
> index c92910c..c8caab2 100755
> --- a/client/tests/kvm/kvm_subprocess.py
> +++ b/client/tests/kvm/kvm_subprocess.py
> @@ -1103,7 +1103,7 @@ class kvm_shell_session(kvm_expect):
>          @param prompt: Regular expression describing the shell's
> prompt line.
>          @param status_test_command: Command to be used for getting
> the last
>                  exit status of commands run inside the shell (used
> by
> -                get_command_status_output() and friends).
> +                cmd_status_output() and friends).
>          """
>          # Init the superclass
>          kvm_expect.__init__(self, command, id, auto_close, echo,
> linesep,
> @@ -1193,8 +1193,8 @@ class kvm_shell_session(kvm_expect):
>          return o
>  
>  
> -    def get_command_output(self, cmd, timeout=30.0,
> internal_timeout=None,
> -                           print_func=None):
> +    def cmd_output(self, cmd, timeout=30.0, internal_timeout=None,
> +                   print_func=None):
>          """
>          Send a command and return its output.
>  
> @@ -1237,8 +1237,8 @@ class kvm_shell_session(kvm_expect):
>          return remove_last_nonempty_line(remove_command_echo(o,
> cmd))
>  
>  
> -    def get_command_status_output(self, cmd, timeout=30.0,
> -                                  internal_timeout=None,
> print_func=None):
> +    def cmd_status_output(self, cmd, timeout=30.0,
> internal_timeout=None,
> +                          print_func=None):
>          """
>          Send a command and return its exit status and output.
>  
> @@ -1257,11 +1257,10 @@ class kvm_shell_session(kvm_expect):
>          @raise ShellStatusError: Raised if the exit status cannot be
> obtained
>          @raise ShellError: Raised if an unknown error occurs
>          """
> -        o = self.get_command_output(cmd, timeout, internal_timeout,
> print_func)
> +        o = self.cmd_output(cmd, timeout, internal_timeout,
> print_func)
>          try:
>              # Send the 'echo $?' (or equivalent) command to get the
> exit status
> -            s = self.get_command_output(self.status_test_command,
> 10,
> -                                        internal_timeout)
> +            s = self.cmd_output(self.status_test_command, 10,
> internal_timeout)
>          except ShellError:
>              raise ShellStatusError(cmd, o)
>  
> @@ -1273,8 +1272,8 @@ class kvm_shell_session(kvm_expect):
>              raise ShellStatusError(cmd, o)
>  
>  
> -    def get_command_status(self, cmd, timeout=30.0,
> internal_timeout=None,
> -                           print_func=None):
> +    def cmd_status(self, cmd, timeout=30.0, internal_timeout=None,
> +                   print_func=None):
>          """
>          Send a command and return its exit status.
>  
> @@ -1292,8 +1291,8 @@ class kvm_shell_session(kvm_expect):
>          @raise ShellStatusError: Raised if the exit status cannot be
> obtained
>          @raise ShellError: Raised if an unknown error occurs
>          """
> -        s, o = self.get_command_status_output(cmd, timeout,
> internal_timeout,
> -                                              print_func)
> +        s, o = self.cmd_status_output(cmd, timeout,
> internal_timeout,
> +                                      print_func)
>          return s
>  
>  
> @@ -1319,8 +1318,8 @@ class kvm_shell_session(kvm_expect):
>          @raise ShellError: Raised if an unknown error occurs
>          @raise ShellCmdError: Raised if the exit status is nonzero
>          """
> -        s, o = self.get_command_status_output(cmd, timeout,
> internal_timeout,
> -                                              print_func)
> +        s, o = self.cmd_status_output(cmd, timeout,
> internal_timeout,
> +                                      print_func)
>          if s != 0:
>              raise ShellCmdError(cmd, s, o)
>          return o
> diff --git a/client/tests/kvm/kvm_test_utils.py
> b/client/tests/kvm/kvm_test_utils.py
> index 8d287b2..26d5164 100644
> --- a/client/tests/kvm/kvm_test_utils.py
> +++ b/client/tests/kvm/kvm_test_utils.py
> @@ -252,7 +252,7 @@ def stop_windows_service(session, service,
> timeout=120):
>      """
>      end_time = time.time() + timeout
>      while time.time() < end_time:
> -        o = session.get_command_output("sc stop %s" % service,
> timeout=60)
> +        o = session.cmd_output("sc stop %s" % service, timeout=60)
>          # FAILED 1060 means the service isn't installed.
>          # FAILED 1062 means the service hasn't been started.
>          if re.search(r"\bFAILED (1060|1062)\b", o, re.I):
> @@ -274,7 +274,7 @@ def start_windows_service(session, service,
> timeout=120):
>      """
>      end_time = time.time() + timeout
>      while time.time() < end_time:
> -        o = session.get_command_output("sc start %s" % service,
> timeout=60)
> +        o = session.cmd_output("sc start %s" % service, timeout=60)
>          # FAILED 1060 means the service isn't installed.
>          if re.search(r"\bFAILED 1060\b", o, re.I):
>              raise error.TestError("Could not start service '%s' "
> @@ -306,7 +306,7 @@ def get_time(session, time_command,
> time_filter_re, time_format):
>      """
>      if len(re.findall("ntpdate|w32tm", time_command)) == 0:
>          host_time = time.time()
> -        s = session.get_command_output(time_command)
> +        s = session.cmd_output(time_command)
>  
>          try:
>              s = re.findall(time_filter_re, s)[0]
> @@ -398,7 +398,7 @@ def run_autotest(vm, session, control_path,
> timeout, outputdir):
>          copy = False
>          local_hash = utils.hash_file(local_path)
>          basename = os.path.basename(local_path)
> -        output = session.get_command_output("md5sum %s" %
> remote_path)
> +        output = session.cmd_output("md5sum %s" % remote_path)
>          if "such file" in output:
>              remote_hash = "0"
>          elif output:
> @@ -451,7 +451,7 @@ def run_autotest(vm, session, control_path,
> timeout, outputdir):
>          Get the status of the tests that were executed on the host
> and close
>          the session where autotest was being executed.
>          """
> -        output = session.get_command_output("cat results/*/status")
> +        output = session.cmd_output("cat results/*/status")
>          try:
>              results = scan_results.parse_results(output)
>              # Report test results
> @@ -509,8 +509,8 @@ def run_autotest(vm, session, control_path,
> timeout, outputdir):
>      try:
>          try:
>              logging.info("---------------- Test output
> ----------------")
> -            session.get_command_output("bin/autotest control",
> timeout=timeout,
> -                                       print_func=logging.info)
> +            session.cmd_output("bin/autotest control",
> timeout=timeout,
> +                               print_func=logging.info)
>          finally:
>              logging.info("------------- End of test output
> ------------")
>      except kvm_subprocess.ShellTimeoutError:
> @@ -588,8 +588,8 @@ def raw_ping(command, timeout, session,
> output_func):
>          return status, output
>      else:
>          try:
> -            output = session.get_command_output(command,
> timeout=timeout,
> -                                               
> print_func=output_func)
> +            output = session.cmd_output(command, timeout=timeout,
> +                                        print_func=output_func)
>          except kvm_subprocess.ShellTimeoutError:
>              # Send ctrl+c (SIGINT) through ssh session
>              session.send("\003")
> @@ -671,7 +671,7 @@ def get_linux_ifname(session, mac_address):
>      @mac_address: the macaddress of nic
>      """
>  
> -    output = session.get_command_output("ifconfig -a")
> +    output = session.cmd_output("ifconfig -a")
>  
>      try:
>          ethname = re.findall("(\w+)\s+Link.*%s" % mac_address,
> output,
> diff --git a/client/tests/kvm/tests/ethtool.py
> b/client/tests/kvm/tests/ethtool.py
> index b93c5a1..b839963 100644
> --- a/client/tests/kvm/tests/ethtool.py
> +++ b/client/tests/kvm/tests/ethtool.py
> @@ -51,7 +51,7 @@ def run_ethtool(test, params, env):
>              return False
>          cmd = "ethtool -K %s %s %s" % (ethname, type, status)
>          if ethtool_get(type) != status:
> -            return session.get_command_status(cmd) == 0
> +            return session.cmd_status(cmd) == 0
>          if ethtool_get(type) != status:
>              logging.error("Fail to set %s %s" % (type, status))
>              return False
> @@ -74,7 +74,7 @@ def run_ethtool(test, params, env):
>          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)
> +            o = session.cmd_output("md5sum %s" % name)
>              guest_result = re.findall("\w+", o)[0]
>          except IndexError:
>              logging.error("Could not get file md5sum in guest")
> @@ -92,13 +92,13 @@ def run_ethtool(test, params, env):
>          @param src: Source host of transfer file
>          @return: Tuple (status, error msg/tcpdump result)
>          """
> -        session2.get_command_output("rm -rf %s" % filename)
> +        session2.cmd_output("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":
> -            session.get_command_output(dd_cmd, timeout=360)
> +            session.cmd_output(dd_cmd, timeout=360)
>              tcpdump_cmd += " and src %s" % guest_ip
>              copy_files_fun = vm.copy_files_from
>          else:
> @@ -115,15 +115,15 @@ def run_ethtool(test, params, env):
>              tcpdump_cmd += " and not port %s" % i
>          logging.debug("Listen by command: %s" % tcpdump_cmd)
>          session2.sendline(tcpdump_cmd)
> -        if not kvm_utils.wait_for(lambda:
> session.get_command_status(
> -                                           "pgrep tcpdump") == 0,
> 30):
> +        cmd = "pgrep tcpdump"
> +        if not kvm_utils.wait_for(lambda: session.cmd_status(cmd) ==
> 0, 30):
>              return (False, "Tcpdump process wasn't launched")
>  
>          logging.info("Start to transfer file")
>          if not copy_files_fun(filename, filename):
>              return (False, "Child process transfer file failed")
>          logging.info("Transfer file completed")
> -        if session.get_command_status("killall tcpdump") != 0:
> +        if session.cmd_status("killall tcpdump") != 0:
>              return (False, "Could not kill all tcpdump process")
>          try:
>              tcpdump_string = session2.read_up_to_prompt(timeout=60)
> @@ -174,7 +174,7 @@ def run_ethtool(test, params, env):
>      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"):
> +    if session.cmd_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)))
> diff --git a/client/tests/kvm/tests/guest_s4.py
> b/client/tests/kvm/tests/guest_s4.py
> index 2eb035b..2c38013 100644
> --- a/client/tests/kvm/tests/guest_s4.py
> +++ b/client/tests/kvm/tests/guest_s4.py
> @@ -16,7 +16,7 @@ def run_guest_s4(test, params, env):
>      session = kvm_test_utils.wait_for_login(vm, timeout=timeout)
>  
>      logging.info("Checking whether guest OS supports suspend to disk
> (S4)...")
> -    s, o =
> session.get_command_status_output(params.get("check_s4_support_cmd"))
> +    s, o =
> session.cmd_status_output(params.get("check_s4_support_cmd"))
>      if "not enough space" in o:
>          raise error.TestError("Check S4 support failed: %s" % o)
>      elif s != 0:
> @@ -36,7 +36,7 @@ def run_guest_s4(test, params, env):
>  
>      # Make sure the background program is running as expected
>      check_s4_cmd = params.get("check_s4_cmd")
> -    if session2.get_command_status(check_s4_cmd) != 0:
> +    if session2.cmd_status(check_s4_cmd) != 0:
>          raise error.TestError("Failed to launch '%s' as a background
> process" %
>                                test_s4_cmd)
>      logging.info("Launched background command in guest: %s" %
> test_s4_cmd)
> @@ -68,11 +68,11 @@ def run_guest_s4(test, params, env):
>  
>      # Check whether the test command is still alive
>      logging.info("Checking if background command is still alive...")
> -    if session2.get_command_status(check_s4_cmd) != 0:
> +    if session2.cmd_status(check_s4_cmd) != 0:
>          raise error.TestFail("Background command '%s' stopped
> running. S4 "
>                               "failed." % test_s4_cmd)
>  
>      logging.info("VM resumed successfuly after suspend to disk")
> -    session2.get_command_output(params.get("kill_test_s4_cmd"))
> +    session2.cmd_output(params.get("kill_test_s4_cmd"))
>      session.close()
>      session2.close()
> diff --git a/client/tests/kvm/tests/guest_test.py
> b/client/tests/kvm/tests/guest_test.py
> index da38afd..bdc5366 100644
> --- a/client/tests/kvm/tests/guest_test.py
> +++ b/client/tests/kvm/tests/guest_test.py
> @@ -56,8 +56,7 @@ def run_guest_test(test, params, env):
>              session.cmd(rsc_cmd, timeout=test_timeout)
>              logging.info("Download resource finished.")
>          else:
> -            session.get_command_output("del %s" % dst_rsc_path,
> -                                       internal_timeout=0)
> +            session.cmd_output("del %s" % dst_rsc_path,
> internal_timeout=0)
>              script_path = kvm_utils.get_path(test.bindir, script)
>              vm.copy_files_to(script_path, dst_rsc_path, timeout=60)
>  
> diff --git a/client/tests/kvm/tests/iofuzz.py
> b/client/tests/kvm/tests/iofuzz.py
> index 77f4761..e77540e 100644
> --- a/client/tests/kvm/tests/iofuzz.py
> +++ b/client/tests/kvm/tests/iofuzz.py
> @@ -98,7 +98,7 @@ def run_iofuzz(test, params, env):
>          r = random.SystemRandom()
>  
>          logging.info("Enumerate guest devices through
> /proc/ioports")
> -        ioports = session.get_command_output("cat /proc/ioports")
> +        ioports = session.cmd_output("cat /proc/ioports")
>          logging.debug(ioports)
>          devices = re.findall("(\w+)-(\w+)\ : (.*)", ioports)
>  
> diff --git a/client/tests/kvm/tests/ioquit.py
> b/client/tests/kvm/tests/ioquit.py
> index bdccd78..f8c8956 100644
> --- a/client/tests/kvm/tests/ioquit.py
> +++ b/client/tests/kvm/tests/ioquit.py
> @@ -20,13 +20,13 @@ def run_ioquit(test, params, env):
>      try:
>          bg_cmd = params.get("background_cmd")
>          logging.info("Add IO workload for guest OS.")
> -        session.get_command_output(bg_cmd, timeout=60)
> +        session.cmd_output(bg_cmd, timeout=60)
>          check_cmd = params.get("check_cmd")
>          session2.cmd(check_cmd, timeout=60)
>  
>          logging.info("Sleep for a while")
>          time.sleep(random.randrange(30,100))
> -        if session2.get_command_status(check_cmd, timeout=60) != 0:
> +        if session2.cmd_status(check_cmd, timeout=60) != 0:
>              logging.info("IO workload finished before the VM was
> killed")
>          logging.info("Kill the virtual machine")
>          vm.process.close()
> diff --git a/client/tests/kvm/tests/iozone_windows.py
> b/client/tests/kvm/tests/iozone_windows.py
> index a96fdfc..febf898 100644
> --- a/client/tests/kvm/tests/iozone_windows.py
> +++ b/client/tests/kvm/tests/iozone_windows.py
> @@ -28,8 +28,8 @@ def run_iozone_windows(test, params, env):
>      c = params.get("iozone_cmd")
>      t = int(params.get("iozone_timeout"))
>      logging.info("Running IOzone command on guest, timeout %ss", t)
> -    results = session.get_command_output(command=c, timeout=t,
> -                                         print_func=logging.debug)
> +    results = session.cmd_output(command=c, timeout=t,
> +                                 print_func=logging.debug)
>      utils.open_write_close(results_path, results)
>  
>      # Postprocess the results using the IOzone postprocessing module
> diff --git a/client/tests/kvm/tests/ksm_overcommit.py
> b/client/tests/kvm/tests/ksm_overcommit.py
> index dbd05dc..f60929e 100644
> --- a/client/tests/kvm/tests/ksm_overcommit.py
> +++ b/client/tests/kvm/tests/ksm_overcommit.py
> @@ -230,7 +230,7 @@ def run_ksm_overcommit(test, params, env):
>                             (mem / 200 * 50 * perf_ratio))
>         
> logging.debug(kvm_test_utils.get_memory_info([lvms[last_vm]]))
>  
> -        lsessions[i].get_command_output("die()", 20)
> +        lsessions[i].cmd_output("die()", 20)
>          lvms[last_vm].destroy(gracefully = False)
>          logging.info("Phase 3b: PASS")
>  
> @@ -356,7 +356,7 @@ def run_ksm_overcommit(test, params, env):
>  
>          logging.debug("Cleaning up...")
>          for i in range(0, max_alloc):
> -            lsessions[i].get_command_output("die()", 20)
> +            lsessions[i].cmd_output("die()", 20)
>          session.close()
>          vm.destroy(gracefully = False)
>  
> diff --git a/client/tests/kvm/tests/linux_s3.py
> b/client/tests/kvm/tests/linux_s3.py
> index 55acea3..3baf660 100644
> --- a/client/tests/kvm/tests/linux_s3.py
> +++ b/client/tests/kvm/tests/linux_s3.py
> @@ -16,13 +16,13 @@ def run_linux_s3(test, params, env):
>      session = kvm_test_utils.wait_for_login(vm, timeout=timeout)
>  
>      logging.info("Checking that VM supports S3")
> -    if session.get_command_status("grep -q mem /sys/power/state") !=
> 0:
> +    if session.cmd_status("grep -q mem /sys/power/state") != 0:
>          raise error.TestFail("Guest does not support S3")
>  
>      logging.info("Waiting for a while for X to start")
>      time.sleep(10)
>  
> -    src_tty = session.get_command_output("fgconsole").strip()
> +    src_tty = session.cmd_output("fgconsole").strip()
>      logging.info("Current virtual terminal is %s" % src_tty)
>      if src_tty not in map(str, range(1,10)):
>          raise error.TestFail("Got a strange current vt (%s)" %
> src_tty)
> diff --git a/client/tests/kvm/tests/migration.py
> b/client/tests/kvm/tests/migration.py
> index 513b500..e883838 100644
> --- a/client/tests/kvm/tests/migration.py
> +++ b/client/tests/kvm/tests/migration.py
> @@ -29,7 +29,7 @@ def run_migration(test, params, env):
>  
>      # Get the output of migration_test_command
>      test_command = params.get("migration_test_command")
> -    reference_output = session.get_command_output(test_command)
> +    reference_output = session.cmd_output(test_command)
>  
>      # Start some process in the background (and leave the session
> open)
>      background_command = params.get("migration_bg_command", "")
> @@ -60,7 +60,7 @@ def run_migration(test, params, env):
>          session2.cmd(check_command, timeout=30)
>  
>          # Get the output of migration_test_command
> -        output = session2.get_command_output(test_command)
> +        output = session2.cmd_output(test_command)
>  
>          # Compare output to reference output
>          if output != reference_output:
> @@ -77,8 +77,7 @@ def run_migration(test, params, env):
>      finally:
>          # Kill the background process
>          if session2 and session2.is_alive():
> -           
> session2.get_command_output(params.get("migration_bg_kill_command",
> -                                                   ""))
> +           
> session2.cmd_output(params.get("migration_bg_kill_command", ""))
>  
>      session2.close()
>      session.close()
> diff --git a/client/tests/kvm/tests/multicast.py
> b/client/tests/kvm/tests/multicast.py
> index 4a1b4f5..2a12b4f 100644
> --- a/client/tests/kvm/tests/multicast.py
> +++ b/client/tests/kvm/tests/multicast.py
> @@ -56,8 +56,8 @@ def run_multicast(test, params, env):
>      mcast_path = os.path.join(test.bindir, "scripts/join_mcast.py")
>      if not vm.copy_files_to(mcast_path, "/tmp"):
>          raise error.TestError("Fail to copy %s to guest" %
> mcast_path)
> -    output = session.get_command_output("python /tmp/join_mcast.py %d
> %s %d" %
> -                                        (mgroup_count, prefix,
> suffix))
> +    output = session.cmd_output("python /tmp/join_mcast.py %d %s %d"
> %
> +                                (mgroup_count, prefix, suffix))
>  
>      # if success to join multicast, the process will be paused, and
> return PID.
>      try:
> @@ -86,6 +86,6 @@ def run_multicast(test, params, env):
>                                       (s, o))
>  
>      finally:
> -        logging.debug(session.get_command_output("ipmaddr show"))
> -        session.get_command_output("kill -s SIGCONT %s" % pid)
> +        logging.debug(session.cmd_output("ipmaddr show"))
> +        session.cmd_output("kill -s SIGCONT %s" % pid)
>          session.close()
> diff --git a/client/tests/kvm/tests/netperf.py
> b/client/tests/kvm/tests/netperf.py
> index 64ff4c6..7e39f6a 100644
> --- a/client/tests/kvm/tests/netperf.py
> +++ b/client/tests/kvm/tests/netperf.py
> @@ -26,7 +26,7 @@ def run_netperf(test, params, env):
>      result_file = os.path.join(test.resultsdir, "output_%s" %
> test.iteration)
>  
>      firewall_flush = "iptables -F"
> -    session.get_command_output(firewall_flush)
> +    session.cmd_output(firewall_flush)
>  
>      for i in params.get("netperf_files").split():
>          if not vm.copy_files_to(os.path.join(netperf_dir, i),
> "/tmp"):
> @@ -65,5 +65,5 @@ def run_netperf(test, params, env):
>                                   ", ".join(list_fail))
>  
>      finally:
> -        session.get_command_output("killall netserver")
> +        session.cmd_output("killall netserver")
>          session.close()
> diff --git a/client/tests/kvm/tests/nic_promisc.py
> b/client/tests/kvm/tests/nic_promisc.py
> index 95f43ec..080fe94 100644
> --- a/client/tests/kvm/tests/nic_promisc.py
> +++ b/client/tests/kvm/tests/nic_promisc.py
> @@ -82,12 +82,12 @@ def run_nic_promisc(test, params, env):
>              logging.info("Clean temporary files")
>              cmd = "rm -f %s" % filename
>              utils.run(cmd)
> -            session.get_command_output(cmd)
> +            session.cmd_output(cmd)
>  
>      finally:
>          logging.info("Restore the %s to the nonpromisc mode",
> ethname)
>          session2.close()
> -        session.get_command_output("ip link set %s promisc off" %
> ethname)
> +        session.cmd_output("ip link set %s promisc off" % ethname)
>          session.close()
>  
>      if success_counter != 2 * len(file_size):
> diff --git a/client/tests/kvm/tests/nicdriver_unload.py
> b/client/tests/kvm/tests/nicdriver_unload.py
> index cc0879c..3dacbfa 100644
> --- a/client/tests/kvm/tests/nicdriver_unload.py
> +++ b/client/tests/kvm/tests/nicdriver_unload.py
> @@ -74,7 +74,7 @@ def run_nicdriver_unload(test, params, env):
>              try:
>                  session2.cmd(unload_load_cmd, timeout=120)
>              except:
> -                session.get_command_output("rm -rf /tmp/Thread-*")
> +                session.cmd_output("rm -rf /tmp/Thread-*")
>                  raise
>              pid, s = os.waitpid(pid, os.WNOHANG)
>              status = os.WEXITSTATUS(s)
> @@ -107,5 +107,5 @@ def run_nicdriver_unload(test, params, env):
>              raise error.TestFail("Test nic function after load/unload
> fail")
>  
>      finally:
> -        session.get_command_output("rm -rf /tmp/Thread-*")
> +        session.cmd_output("rm -rf /tmp/Thread-*")
>          session.close()
> diff --git a/client/tests/kvm/tests/pci_hotplug.py
> b/client/tests/kvm/tests/pci_hotplug.py
> index 1b38927..3f07bda 100644
> --- a/client/tests/kvm/tests/pci_hotplug.py
> +++ b/client/tests/kvm/tests/pci_hotplug.py
> @@ -32,7 +32,7 @@ def run_pci_hotplug(test, params, env):
>      info_pci_ref = vm.monitor.info("pci")
>  
>      # Get output of command as reference
> -    reference =
> session.get_command_output(params.get("reference_cmd"))
> +    reference = session.cmd_output(params.get("reference_cmd"))
>  
>      tested_model = params.get("pci_model")
>      test_type = params.get("pci_type")
> @@ -130,7 +130,7 @@ def run_pci_hotplug(test, params, env):
>  
>          # Define a helper function to compare the output
>          def new_shown():
> -            o =
> session.get_command_output(params.get("reference_cmd"))
> +            o = session.cmd_output(params.get("reference_cmd"))
>              return o != reference
>  
>          secs = int(params.get("wait_secs_for_hook_up"))
> @@ -141,7 +141,7 @@ def run_pci_hotplug(test, params, env):
>  
>          # Define a helper function to catch PCI device string
>          def find_pci():
> -            o =
> session.get_command_output(params.get("find_pci_cmd"))
> +            o = session.cmd_output(params.get("find_pci_cmd"))
>              return params.get("match_string") in o
>  
>          if not kvm_utils.wait_for(find_pci, 30, 3, 3):
> diff --git a/client/tests/kvm/tests/physical_resources_check.py
> b/client/tests/kvm/tests/physical_resources_check.py
> index 682c7b2..0630ac8 100644
> --- a/client/tests/kvm/tests/physical_resources_check.py
> +++ b/client/tests/kvm/tests/physical_resources_check.py
> @@ -135,7 +135,7 @@ def run_physical_resources_check(test, params,
> env):
>      def verify_device(expect, name, verify_cmd):
>          f_fail = 0
>          if verify_cmd:
> -            actual = session.get_command_output(verify_cmd)
> +            actual = session.cmd_output(verify_cmd)
>              if not string.upper(expect) in actual:
>                  f_fail += 1
>                  logging.error("%s mismatch:")
> diff --git a/client/tests/kvm/tests/timedrift.py
> b/client/tests/kvm/tests/timedrift.py
> index a6d3076..e5aa316 100644
> --- a/client/tests/kvm/tests/timedrift.py
> +++ b/client/tests/kvm/tests/timedrift.py
> @@ -146,7 +146,7 @@ def run_timedrift(test, params, env):
>              restore_cpu_affinity(prev_affinity)
>              # Stop the guest load
>              if guest_load_stop_command:
> -                session.get_command_output(guest_load_stop_command)
> +                session.cmd_output(guest_load_stop_command)
>              # Close all load shell sessions
>              for load_session in guest_load_sessions:
>                  load_session.close()
> diff --git a/client/tests/kvm/tests/vlan.py
> b/client/tests/kvm/tests/vlan.py
> index 8641c23..dfaf9d3 100644
> --- a/client/tests/kvm/tests/vlan.py
> +++ b/client/tests/kvm/tests/vlan.py
> @@ -48,8 +48,7 @@ def run_vlan(test, params, env):
>      def rem_vlan(session, id, iface="eth0"):
>          rem_vlan_cmd = "if [[ -e /proc/net/vlan/%s ]];then vconfig
> rem %s;fi"
>          iface = "%s.%s" % (iface, id)
> -        s = session.get_command_status(rem_vlan_cmd % (iface,
> iface))
> -        return s
> +        return session.cmd_status(rem_vlan_cmd % (iface, iface))
>  
>      def nc_transfer(src, dst):
>          nc_port = kvm_utils.find_free_port(1025, 5334, vm_ip[dst])
> @@ -62,7 +61,7 @@ def run_vlan(test, params, env):
>          time.sleep(2)
>          #send file from src to dst
>          send_cmd = send_cmd % (vlan_ip[dst], str(nc_port), "file")
> -        if session[src].get_command_status(send_cmd, timeout=60) !=
> 0:
> +        if session[src].cmd_status(send_cmd, timeout=60) != 0:
>              raise error.TestFail ("Fail to send file"
>                                      " from vm%s to vm%s" % (src+1,
> dst+1))
>          try:
> @@ -71,7 +70,7 @@ def run_vlan(test, params, env):
>              raise error.TestFail ("Fail to receive file"
>                                      " from vm%s to vm%s" % (src+1,
> dst+1))
>          #check MD5 message digest of receive file in dst
> -        output = session[dst].get_command_output("md5sum
> receive").strip()
> +        output = session[dst].cmd_output("md5sum receive").strip()
>          digest_receive = re.findall(r'(\w+)', output)[0]
>          if digest_receive == digest_origin[src]:
>              logging.info("file succeed received in vm %s" %
> vlan_ip[dst])
> @@ -79,7 +78,7 @@ def run_vlan(test, params, env):
>              logging.info("digest_origin is  %s" %
> digest_origin[src])
>              logging.info("digest_receive is %s" % digest_receive)
>              raise error.TestFail("File transfered differ from
> origin")
> -        session[dst].get_command_output("rm -f receive")
> +        session[dst].cmd_output("rm -f receive")
>  
>      for i in range(2):
>          session.append(kvm_test_utils.wait_for_login(vm[i],
> @@ -101,7 +100,7 @@ def run_vlan(test, params, env):
>          digest_origin.append(re.findall(r'(\w+)', output)[0])
>  
>          #stop firewall in vm
> -        session[i].get_command_output("/etc/init.d/iptables stop")
> +        session[i].cmd_output("/etc/init.d/iptables stop")
>  
>          #load 8021q module for vconfig
>          session[i].cmd("modprobe 8021q")
> diff --git a/client/tests/kvm/tests/whql_client_install.py
> b/client/tests/kvm/tests/whql_client_install.py
> index 52daa31..1c3f1c8 100644
> --- a/client/tests/kvm/tests/whql_client_install.py
> +++ b/client/tests/kvm/tests/whql_client_install.py
> @@ -54,14 +54,14 @@ def run_whql_client_install(test, params, env):
>  
>      # Get server and client information
>      cmd = "echo %computername%"
> -    server_name = server_session.get_command_output(cmd).strip()
> -    client_name = session.get_command_output(cmd).strip()
> +    server_name = server_session.cmd_output(cmd).strip()
> +    client_name = session.cmd_output(cmd).strip()
>      cmd = "wmic computersystem get domain"
> -    server_workgroup =
> server_session.get_command_output(cmd).strip()
> +    server_workgroup = server_session.cmd_output(cmd).strip()
>      server_workgroup = server_workgroup.splitlines()[-1]
>      regkey =
> r"HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"
>      cmd = "reg query %s /v Domain" % regkey
> -    o =
> server_session.get_command_output(cmd).strip().splitlines()[-1]
> +    o = server_session.cmd_output(cmd).strip().splitlines()[-1]
>      try:
>          server_dns_suffix = o.split(None, 2)[2]
>      except IndexError:
> @@ -101,7 +101,7 @@ def run_whql_client_install(test, params, env):
>                                           server_password)
>      end_time = time.time() + 120
>      while time.time() < end_time:
> -        if session.get_command_status(cmd) == 0:
> +        if session.cmd_status(cmd) == 0:
>              break
>          time.sleep(5)
>      else:
> diff --git a/client/tests/kvm/tests/whql_submission.py
> b/client/tests/kvm/tests/whql_submission.py
> index 3930954..b1b7f25 100644
> --- a/client/tests/kvm/tests/whql_submission.py
> +++ b/client/tests/kvm/tests/whql_submission.py
> @@ -54,8 +54,8 @@ def run_whql_submission(test, params, env):
>  
>      # Get the computer names of the server and client
>      cmd = "echo %computername%"
> -    server_name = server_session.get_command_output(cmd).strip()
> -    client_name = session.get_command_output(cmd).strip()
> +    server_name = server_session.cmd_output(cmd).strip()
> +    client_name = session.cmd_output(cmd).strip()
>      session.close()
>  
>      # Run the automation program on the server
> -- 
> 1.5.5.6
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [KVM-AUTOTEST PATCH 4/5] KVM test: kvm_subprocess: rename get_command_status_output() and friends
  2010-10-27  5:59 ` [KVM-AUTOTEST PATCH 4/5] KVM test: kvm_subprocess: rename get_command_status_output() and friends Feng Yang
@ 2010-10-27  9:10   ` Michael Goldish
  2010-10-27 12:04   ` [Autotest] " Lucas Meneghel Rodrigues
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Goldish @ 2010-10-27  9:10 UTC (permalink / raw)
  To: Feng Yang; +Cc: autotest, kvm

On 10/27/2010 07:59 AM, Feng Yang wrote:
> 
> ----- "Michael Goldish" <mgoldish@redhat.com> wrote:
> 
>> From: "Michael Goldish" <mgoldish@redhat.com>
>> To: autotest@test.kernel.org, kvm@vger.kernel.org
>> Cc: "Michael Goldish" <mgoldish@redhat.com>
>> Sent: Wednesday, October 27, 2010 12:49:43 AM GMT +08:00 Beijing / Chongqing / Hong Kong / Urumqi
>> Subject: [KVM-AUTOTEST PATCH 4/5] KVM test: kvm_subprocess: rename get_command_status_output() and friends
>>
>> get_command_status_output() -> cmd_status_output()
>> get_command_output() -> cmd_output()
>> get_command_status() -> cmd_status()
> Any reason for these change? coding style issue?
> If there is no necessary reason, we better do not change them. These functions is widely used, the change may introduce errors.
> Changing interface will bring some workload and risk.  At least we need change all our internal case when merging with upstream.

I think raising exceptions in these functions (patch 1 in the series)
causes much more significant compatibility issues than just renaming
them.  Since we're making lots of changes throughout the code anyway
because of the exceptions, I thought this would be a good time to rename
the functions.

We can keep both the old names and the new names, so new tests can be
merged upstream and then modified later to use the new names.  Does that
sound OK?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Autotest] [KVM-AUTOTEST PATCH 4/5] KVM test: kvm_subprocess: rename get_command_status_output() and friends
  2010-10-27  5:59 ` [KVM-AUTOTEST PATCH 4/5] KVM test: kvm_subprocess: rename get_command_status_output() and friends Feng Yang
  2010-10-27  9:10   ` Michael Goldish
@ 2010-10-27 12:04   ` Lucas Meneghel Rodrigues
  1 sibling, 0 replies; 4+ messages in thread
From: Lucas Meneghel Rodrigues @ 2010-10-27 12:04 UTC (permalink / raw)
  To: Feng Yang; +Cc: Michael Goldish, autotest, kvm

On Wed, 2010-10-27 at 01:59 -0400, Feng Yang wrote:
> ----- "Michael Goldish" <mgoldish@redhat.com> wrote:
> 
> > From: "Michael Goldish" <mgoldish@redhat.com>
> > To: autotest@test.kernel.org, kvm@vger.kernel.org
> > Cc: "Michael Goldish" <mgoldish@redhat.com>
> > Sent: Wednesday, October 27, 2010 12:49:43 AM GMT +08:00 Beijing / Chongqing / Hong Kong / Urumqi
> > Subject: [KVM-AUTOTEST PATCH 4/5] KVM test: kvm_subprocess: rename get_command_status_output() and friends
> >
> > get_command_status_output() -> cmd_status_output()
> > get_command_output() -> cmd_output()
> > get_command_status() -> cmd_status()
> Any reason for these change? coding style issue?
> If there is no necessary reason, we better do not change them. These functions is widely used, the change may introduce errors.
> Changing interface will bring some workload and risk.  At least we need change all our internal case when merging with upstream.

I think the changes are worth the risks. The function names are shorter
and nicer. Now, the merge with your internal tree indeed raises some
concern.

Maybe we could postpone the naming change when our trees have smaller
difference, or something like that. Anyway, the merging back will
allways be difficult, I can help with that as well.

> > 
> > Signed-off-by: Michael Goldish <mgoldish@redhat.com>
> > ---
> >  client/tests/kvm/kvm_subprocess.py                 |   27
> > +++++++++----------
> >  client/tests/kvm/kvm_test_utils.py                 |   20
> > +++++++-------
> >  client/tests/kvm/tests/ethtool.py                  |   16
> > ++++++------
> >  client/tests/kvm/tests/guest_s4.py                 |    8 +++---
> >  client/tests/kvm/tests/guest_test.py               |    3 +-
> >  client/tests/kvm/tests/iofuzz.py                   |    2 +-
> >  client/tests/kvm/tests/ioquit.py                   |    4 +-
> >  client/tests/kvm/tests/iozone_windows.py           |    4 +-
> >  client/tests/kvm/tests/ksm_overcommit.py           |    4 +-
> >  client/tests/kvm/tests/linux_s3.py                 |    4 +-
> >  client/tests/kvm/tests/migration.py                |    7 ++---
> >  client/tests/kvm/tests/multicast.py                |    8 +++---
> >  client/tests/kvm/tests/netperf.py                  |    4 +-
> >  client/tests/kvm/tests/nic_promisc.py              |    4 +-
> >  client/tests/kvm/tests/nicdriver_unload.py         |    4 +-
> >  client/tests/kvm/tests/pci_hotplug.py              |    6 ++--
> >  client/tests/kvm/tests/physical_resources_check.py |    2 +-
> >  client/tests/kvm/tests/timedrift.py                |    2 +-
> >  client/tests/kvm/tests/vlan.py                     |   11 +++----
> >  client/tests/kvm/tests/whql_client_install.py      |   10 +++---
> >  client/tests/kvm/tests/whql_submission.py          |    4 +-
> >  21 files changed, 75 insertions(+), 79 deletions(-)
> > 
> > diff --git a/client/tests/kvm/kvm_subprocess.py
> > b/client/tests/kvm/kvm_subprocess.py
> > index c92910c..c8caab2 100755
> > --- a/client/tests/kvm/kvm_subprocess.py
> > +++ b/client/tests/kvm/kvm_subprocess.py
> > @@ -1103,7 +1103,7 @@ class kvm_shell_session(kvm_expect):
> >          @param prompt: Regular expression describing the shell's
> > prompt line.
> >          @param status_test_command: Command to be used for getting
> > the last
> >                  exit status of commands run inside the shell (used
> > by
> > -                get_command_status_output() and friends).
> > +                cmd_status_output() and friends).
> >          """
> >          # Init the superclass
> >          kvm_expect.__init__(self, command, id, auto_close, echo,
> > linesep,
> > @@ -1193,8 +1193,8 @@ class kvm_shell_session(kvm_expect):
> >          return o
> >  
> >  
> > -    def get_command_output(self, cmd, timeout=30.0,
> > internal_timeout=None,
> > -                           print_func=None):
> > +    def cmd_output(self, cmd, timeout=30.0, internal_timeout=None,
> > +                   print_func=None):
> >          """
> >          Send a command and return its output.
> >  
> > @@ -1237,8 +1237,8 @@ class kvm_shell_session(kvm_expect):
> >          return remove_last_nonempty_line(remove_command_echo(o,
> > cmd))
> >  
> >  
> > -    def get_command_status_output(self, cmd, timeout=30.0,
> > -                                  internal_timeout=None,
> > print_func=None):
> > +    def cmd_status_output(self, cmd, timeout=30.0,
> > internal_timeout=None,
> > +                          print_func=None):
> >          """
> >          Send a command and return its exit status and output.
> >  
> > @@ -1257,11 +1257,10 @@ class kvm_shell_session(kvm_expect):
> >          @raise ShellStatusError: Raised if the exit status cannot be
> > obtained
> >          @raise ShellError: Raised if an unknown error occurs
> >          """
> > -        o = self.get_command_output(cmd, timeout, internal_timeout,
> > print_func)
> > +        o = self.cmd_output(cmd, timeout, internal_timeout,
> > print_func)
> >          try:
> >              # Send the 'echo $?' (or equivalent) command to get the
> > exit status
> > -            s = self.get_command_output(self.status_test_command,
> > 10,
> > -                                        internal_timeout)
> > +            s = self.cmd_output(self.status_test_command, 10,
> > internal_timeout)
> >          except ShellError:
> >              raise ShellStatusError(cmd, o)
> >  
> > @@ -1273,8 +1272,8 @@ class kvm_shell_session(kvm_expect):
> >              raise ShellStatusError(cmd, o)
> >  
> >  
> > -    def get_command_status(self, cmd, timeout=30.0,
> > internal_timeout=None,
> > -                           print_func=None):
> > +    def cmd_status(self, cmd, timeout=30.0, internal_timeout=None,
> > +                   print_func=None):
> >          """
> >          Send a command and return its exit status.
> >  
> > @@ -1292,8 +1291,8 @@ class kvm_shell_session(kvm_expect):
> >          @raise ShellStatusError: Raised if the exit status cannot be
> > obtained
> >          @raise ShellError: Raised if an unknown error occurs
> >          """
> > -        s, o = self.get_command_status_output(cmd, timeout,
> > internal_timeout,
> > -                                              print_func)
> > +        s, o = self.cmd_status_output(cmd, timeout,
> > internal_timeout,
> > +                                      print_func)
> >          return s
> >  
> >  
> > @@ -1319,8 +1318,8 @@ class kvm_shell_session(kvm_expect):
> >          @raise ShellError: Raised if an unknown error occurs
> >          @raise ShellCmdError: Raised if the exit status is nonzero
> >          """
> > -        s, o = self.get_command_status_output(cmd, timeout,
> > internal_timeout,
> > -                                              print_func)
> > +        s, o = self.cmd_status_output(cmd, timeout,
> > internal_timeout,
> > +                                      print_func)
> >          if s != 0:
> >              raise ShellCmdError(cmd, s, o)
> >          return o
> > diff --git a/client/tests/kvm/kvm_test_utils.py
> > b/client/tests/kvm/kvm_test_utils.py
> > index 8d287b2..26d5164 100644
> > --- a/client/tests/kvm/kvm_test_utils.py
> > +++ b/client/tests/kvm/kvm_test_utils.py
> > @@ -252,7 +252,7 @@ def stop_windows_service(session, service,
> > timeout=120):
> >      """
> >      end_time = time.time() + timeout
> >      while time.time() < end_time:
> > -        o = session.get_command_output("sc stop %s" % service,
> > timeout=60)
> > +        o = session.cmd_output("sc stop %s" % service, timeout=60)
> >          # FAILED 1060 means the service isn't installed.
> >          # FAILED 1062 means the service hasn't been started.
> >          if re.search(r"\bFAILED (1060|1062)\b", o, re.I):
> > @@ -274,7 +274,7 @@ def start_windows_service(session, service,
> > timeout=120):
> >      """
> >      end_time = time.time() + timeout
> >      while time.time() < end_time:
> > -        o = session.get_command_output("sc start %s" % service,
> > timeout=60)
> > +        o = session.cmd_output("sc start %s" % service, timeout=60)
> >          # FAILED 1060 means the service isn't installed.
> >          if re.search(r"\bFAILED 1060\b", o, re.I):
> >              raise error.TestError("Could not start service '%s' "
> > @@ -306,7 +306,7 @@ def get_time(session, time_command,
> > time_filter_re, time_format):
> >      """
> >      if len(re.findall("ntpdate|w32tm", time_command)) == 0:
> >          host_time = time.time()
> > -        s = session.get_command_output(time_command)
> > +        s = session.cmd_output(time_command)
> >  
> >          try:
> >              s = re.findall(time_filter_re, s)[0]
> > @@ -398,7 +398,7 @@ def run_autotest(vm, session, control_path,
> > timeout, outputdir):
> >          copy = False
> >          local_hash = utils.hash_file(local_path)
> >          basename = os.path.basename(local_path)
> > -        output = session.get_command_output("md5sum %s" %
> > remote_path)
> > +        output = session.cmd_output("md5sum %s" % remote_path)
> >          if "such file" in output:
> >              remote_hash = "0"
> >          elif output:
> > @@ -451,7 +451,7 @@ def run_autotest(vm, session, control_path,
> > timeout, outputdir):
> >          Get the status of the tests that were executed on the host
> > and close
> >          the session where autotest was being executed.
> >          """
> > -        output = session.get_command_output("cat results/*/status")
> > +        output = session.cmd_output("cat results/*/status")
> >          try:
> >              results = scan_results.parse_results(output)
> >              # Report test results
> > @@ -509,8 +509,8 @@ def run_autotest(vm, session, control_path,
> > timeout, outputdir):
> >      try:
> >          try:
> >              logging.info("---------------- Test output
> > ----------------")
> > -            session.get_command_output("bin/autotest control",
> > timeout=timeout,
> > -                                       print_func=logging.info)
> > +            session.cmd_output("bin/autotest control",
> > timeout=timeout,
> > +                               print_func=logging.info)
> >          finally:
> >              logging.info("------------- End of test output
> > ------------")
> >      except kvm_subprocess.ShellTimeoutError:
> > @@ -588,8 +588,8 @@ def raw_ping(command, timeout, session,
> > output_func):
> >          return status, output
> >      else:
> >          try:
> > -            output = session.get_command_output(command,
> > timeout=timeout,
> > -                                               
> > print_func=output_func)
> > +            output = session.cmd_output(command, timeout=timeout,
> > +                                        print_func=output_func)
> >          except kvm_subprocess.ShellTimeoutError:
> >              # Send ctrl+c (SIGINT) through ssh session
> >              session.send("\003")
> > @@ -671,7 +671,7 @@ def get_linux_ifname(session, mac_address):
> >      @mac_address: the macaddress of nic
> >      """
> >  
> > -    output = session.get_command_output("ifconfig -a")
> > +    output = session.cmd_output("ifconfig -a")
> >  
> >      try:
> >          ethname = re.findall("(\w+)\s+Link.*%s" % mac_address,
> > output,
> > diff --git a/client/tests/kvm/tests/ethtool.py
> > b/client/tests/kvm/tests/ethtool.py
> > index b93c5a1..b839963 100644
> > --- a/client/tests/kvm/tests/ethtool.py
> > +++ b/client/tests/kvm/tests/ethtool.py
> > @@ -51,7 +51,7 @@ def run_ethtool(test, params, env):
> >              return False
> >          cmd = "ethtool -K %s %s %s" % (ethname, type, status)
> >          if ethtool_get(type) != status:
> > -            return session.get_command_status(cmd) == 0
> > +            return session.cmd_status(cmd) == 0
> >          if ethtool_get(type) != status:
> >              logging.error("Fail to set %s %s" % (type, status))
> >              return False
> > @@ -74,7 +74,7 @@ def run_ethtool(test, params, env):
> >          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)
> > +            o = session.cmd_output("md5sum %s" % name)
> >              guest_result = re.findall("\w+", o)[0]
> >          except IndexError:
> >              logging.error("Could not get file md5sum in guest")
> > @@ -92,13 +92,13 @@ def run_ethtool(test, params, env):
> >          @param src: Source host of transfer file
> >          @return: Tuple (status, error msg/tcpdump result)
> >          """
> > -        session2.get_command_output("rm -rf %s" % filename)
> > +        session2.cmd_output("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":
> > -            session.get_command_output(dd_cmd, timeout=360)
> > +            session.cmd_output(dd_cmd, timeout=360)
> >              tcpdump_cmd += " and src %s" % guest_ip
> >              copy_files_fun = vm.copy_files_from
> >          else:
> > @@ -115,15 +115,15 @@ def run_ethtool(test, params, env):
> >              tcpdump_cmd += " and not port %s" % i
> >          logging.debug("Listen by command: %s" % tcpdump_cmd)
> >          session2.sendline(tcpdump_cmd)
> > -        if not kvm_utils.wait_for(lambda:
> > session.get_command_status(
> > -                                           "pgrep tcpdump") == 0,
> > 30):
> > +        cmd = "pgrep tcpdump"
> > +        if not kvm_utils.wait_for(lambda: session.cmd_status(cmd) ==
> > 0, 30):
> >              return (False, "Tcpdump process wasn't launched")
> >  
> >          logging.info("Start to transfer file")
> >          if not copy_files_fun(filename, filename):
> >              return (False, "Child process transfer file failed")
> >          logging.info("Transfer file completed")
> > -        if session.get_command_status("killall tcpdump") != 0:
> > +        if session.cmd_status("killall tcpdump") != 0:
> >              return (False, "Could not kill all tcpdump process")
> >          try:
> >              tcpdump_string = session2.read_up_to_prompt(timeout=60)
> > @@ -174,7 +174,7 @@ def run_ethtool(test, params, env):
> >      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"):
> > +    if session.cmd_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)))
> > diff --git a/client/tests/kvm/tests/guest_s4.py
> > b/client/tests/kvm/tests/guest_s4.py
> > index 2eb035b..2c38013 100644
> > --- a/client/tests/kvm/tests/guest_s4.py
> > +++ b/client/tests/kvm/tests/guest_s4.py
> > @@ -16,7 +16,7 @@ def run_guest_s4(test, params, env):
> >      session = kvm_test_utils.wait_for_login(vm, timeout=timeout)
> >  
> >      logging.info("Checking whether guest OS supports suspend to disk
> > (S4)...")
> > -    s, o =
> > session.get_command_status_output(params.get("check_s4_support_cmd"))
> > +    s, o =
> > session.cmd_status_output(params.get("check_s4_support_cmd"))
> >      if "not enough space" in o:
> >          raise error.TestError("Check S4 support failed: %s" % o)
> >      elif s != 0:
> > @@ -36,7 +36,7 @@ def run_guest_s4(test, params, env):
> >  
> >      # Make sure the background program is running as expected
> >      check_s4_cmd = params.get("check_s4_cmd")
> > -    if session2.get_command_status(check_s4_cmd) != 0:
> > +    if session2.cmd_status(check_s4_cmd) != 0:
> >          raise error.TestError("Failed to launch '%s' as a background
> > process" %
> >                                test_s4_cmd)
> >      logging.info("Launched background command in guest: %s" %
> > test_s4_cmd)
> > @@ -68,11 +68,11 @@ def run_guest_s4(test, params, env):
> >  
> >      # Check whether the test command is still alive
> >      logging.info("Checking if background command is still alive...")
> > -    if session2.get_command_status(check_s4_cmd) != 0:
> > +    if session2.cmd_status(check_s4_cmd) != 0:
> >          raise error.TestFail("Background command '%s' stopped
> > running. S4 "
> >                               "failed." % test_s4_cmd)
> >  
> >      logging.info("VM resumed successfuly after suspend to disk")
> > -    session2.get_command_output(params.get("kill_test_s4_cmd"))
> > +    session2.cmd_output(params.get("kill_test_s4_cmd"))
> >      session.close()
> >      session2.close()
> > diff --git a/client/tests/kvm/tests/guest_test.py
> > b/client/tests/kvm/tests/guest_test.py
> > index da38afd..bdc5366 100644
> > --- a/client/tests/kvm/tests/guest_test.py
> > +++ b/client/tests/kvm/tests/guest_test.py
> > @@ -56,8 +56,7 @@ def run_guest_test(test, params, env):
> >              session.cmd(rsc_cmd, timeout=test_timeout)
> >              logging.info("Download resource finished.")
> >          else:
> > -            session.get_command_output("del %s" % dst_rsc_path,
> > -                                       internal_timeout=0)
> > +            session.cmd_output("del %s" % dst_rsc_path,
> > internal_timeout=0)
> >              script_path = kvm_utils.get_path(test.bindir, script)
> >              vm.copy_files_to(script_path, dst_rsc_path, timeout=60)
> >  
> > diff --git a/client/tests/kvm/tests/iofuzz.py
> > b/client/tests/kvm/tests/iofuzz.py
> > index 77f4761..e77540e 100644
> > --- a/client/tests/kvm/tests/iofuzz.py
> > +++ b/client/tests/kvm/tests/iofuzz.py
> > @@ -98,7 +98,7 @@ def run_iofuzz(test, params, env):
> >          r = random.SystemRandom()
> >  
> >          logging.info("Enumerate guest devices through
> > /proc/ioports")
> > -        ioports = session.get_command_output("cat /proc/ioports")
> > +        ioports = session.cmd_output("cat /proc/ioports")
> >          logging.debug(ioports)
> >          devices = re.findall("(\w+)-(\w+)\ : (.*)", ioports)
> >  
> > diff --git a/client/tests/kvm/tests/ioquit.py
> > b/client/tests/kvm/tests/ioquit.py
> > index bdccd78..f8c8956 100644
> > --- a/client/tests/kvm/tests/ioquit.py
> > +++ b/client/tests/kvm/tests/ioquit.py
> > @@ -20,13 +20,13 @@ def run_ioquit(test, params, env):
> >      try:
> >          bg_cmd = params.get("background_cmd")
> >          logging.info("Add IO workload for guest OS.")
> > -        session.get_command_output(bg_cmd, timeout=60)
> > +        session.cmd_output(bg_cmd, timeout=60)
> >          check_cmd = params.get("check_cmd")
> >          session2.cmd(check_cmd, timeout=60)
> >  
> >          logging.info("Sleep for a while")
> >          time.sleep(random.randrange(30,100))
> > -        if session2.get_command_status(check_cmd, timeout=60) != 0:
> > +        if session2.cmd_status(check_cmd, timeout=60) != 0:
> >              logging.info("IO workload finished before the VM was
> > killed")
> >          logging.info("Kill the virtual machine")
> >          vm.process.close()
> > diff --git a/client/tests/kvm/tests/iozone_windows.py
> > b/client/tests/kvm/tests/iozone_windows.py
> > index a96fdfc..febf898 100644
> > --- a/client/tests/kvm/tests/iozone_windows.py
> > +++ b/client/tests/kvm/tests/iozone_windows.py
> > @@ -28,8 +28,8 @@ def run_iozone_windows(test, params, env):
> >      c = params.get("iozone_cmd")
> >      t = int(params.get("iozone_timeout"))
> >      logging.info("Running IOzone command on guest, timeout %ss", t)
> > -    results = session.get_command_output(command=c, timeout=t,
> > -                                         print_func=logging.debug)
> > +    results = session.cmd_output(command=c, timeout=t,
> > +                                 print_func=logging.debug)
> >      utils.open_write_close(results_path, results)
> >  
> >      # Postprocess the results using the IOzone postprocessing module
> > diff --git a/client/tests/kvm/tests/ksm_overcommit.py
> > b/client/tests/kvm/tests/ksm_overcommit.py
> > index dbd05dc..f60929e 100644
> > --- a/client/tests/kvm/tests/ksm_overcommit.py
> > +++ b/client/tests/kvm/tests/ksm_overcommit.py
> > @@ -230,7 +230,7 @@ def run_ksm_overcommit(test, params, env):
> >                             (mem / 200 * 50 * perf_ratio))
> >         
> > logging.debug(kvm_test_utils.get_memory_info([lvms[last_vm]]))
> >  
> > -        lsessions[i].get_command_output("die()", 20)
> > +        lsessions[i].cmd_output("die()", 20)
> >          lvms[last_vm].destroy(gracefully = False)
> >          logging.info("Phase 3b: PASS")
> >  
> > @@ -356,7 +356,7 @@ def run_ksm_overcommit(test, params, env):
> >  
> >          logging.debug("Cleaning up...")
> >          for i in range(0, max_alloc):
> > -            lsessions[i].get_command_output("die()", 20)
> > +            lsessions[i].cmd_output("die()", 20)
> >          session.close()
> >          vm.destroy(gracefully = False)
> >  
> > diff --git a/client/tests/kvm/tests/linux_s3.py
> > b/client/tests/kvm/tests/linux_s3.py
> > index 55acea3..3baf660 100644
> > --- a/client/tests/kvm/tests/linux_s3.py
> > +++ b/client/tests/kvm/tests/linux_s3.py
> > @@ -16,13 +16,13 @@ def run_linux_s3(test, params, env):
> >      session = kvm_test_utils.wait_for_login(vm, timeout=timeout)
> >  
> >      logging.info("Checking that VM supports S3")
> > -    if session.get_command_status("grep -q mem /sys/power/state") !=
> > 0:
> > +    if session.cmd_status("grep -q mem /sys/power/state") != 0:
> >          raise error.TestFail("Guest does not support S3")
> >  
> >      logging.info("Waiting for a while for X to start")
> >      time.sleep(10)
> >  
> > -    src_tty = session.get_command_output("fgconsole").strip()
> > +    src_tty = session.cmd_output("fgconsole").strip()
> >      logging.info("Current virtual terminal is %s" % src_tty)
> >      if src_tty not in map(str, range(1,10)):
> >          raise error.TestFail("Got a strange current vt (%s)" %
> > src_tty)
> > diff --git a/client/tests/kvm/tests/migration.py
> > b/client/tests/kvm/tests/migration.py
> > index 513b500..e883838 100644
> > --- a/client/tests/kvm/tests/migration.py
> > +++ b/client/tests/kvm/tests/migration.py
> > @@ -29,7 +29,7 @@ def run_migration(test, params, env):
> >  
> >      # Get the output of migration_test_command
> >      test_command = params.get("migration_test_command")
> > -    reference_output = session.get_command_output(test_command)
> > +    reference_output = session.cmd_output(test_command)
> >  
> >      # Start some process in the background (and leave the session
> > open)
> >      background_command = params.get("migration_bg_command", "")
> > @@ -60,7 +60,7 @@ def run_migration(test, params, env):
> >          session2.cmd(check_command, timeout=30)
> >  
> >          # Get the output of migration_test_command
> > -        output = session2.get_command_output(test_command)
> > +        output = session2.cmd_output(test_command)
> >  
> >          # Compare output to reference output
> >          if output != reference_output:
> > @@ -77,8 +77,7 @@ def run_migration(test, params, env):
> >      finally:
> >          # Kill the background process
> >          if session2 and session2.is_alive():
> > -           
> > session2.get_command_output(params.get("migration_bg_kill_command",
> > -                                                   ""))
> > +           
> > session2.cmd_output(params.get("migration_bg_kill_command", ""))
> >  
> >      session2.close()
> >      session.close()
> > diff --git a/client/tests/kvm/tests/multicast.py
> > b/client/tests/kvm/tests/multicast.py
> > index 4a1b4f5..2a12b4f 100644
> > --- a/client/tests/kvm/tests/multicast.py
> > +++ b/client/tests/kvm/tests/multicast.py
> > @@ -56,8 +56,8 @@ def run_multicast(test, params, env):
> >      mcast_path = os.path.join(test.bindir, "scripts/join_mcast.py")
> >      if not vm.copy_files_to(mcast_path, "/tmp"):
> >          raise error.TestError("Fail to copy %s to guest" %
> > mcast_path)
> > -    output = session.get_command_output("python /tmp/join_mcast.py %d
> > %s %d" %
> > -                                        (mgroup_count, prefix,
> > suffix))
> > +    output = session.cmd_output("python /tmp/join_mcast.py %d %s %d"
> > %
> > +                                (mgroup_count, prefix, suffix))
> >  
> >      # if success to join multicast, the process will be paused, and
> > return PID.
> >      try:
> > @@ -86,6 +86,6 @@ def run_multicast(test, params, env):
> >                                       (s, o))
> >  
> >      finally:
> > -        logging.debug(session.get_command_output("ipmaddr show"))
> > -        session.get_command_output("kill -s SIGCONT %s" % pid)
> > +        logging.debug(session.cmd_output("ipmaddr show"))
> > +        session.cmd_output("kill -s SIGCONT %s" % pid)
> >          session.close()
> > diff --git a/client/tests/kvm/tests/netperf.py
> > b/client/tests/kvm/tests/netperf.py
> > index 64ff4c6..7e39f6a 100644
> > --- a/client/tests/kvm/tests/netperf.py
> > +++ b/client/tests/kvm/tests/netperf.py
> > @@ -26,7 +26,7 @@ def run_netperf(test, params, env):
> >      result_file = os.path.join(test.resultsdir, "output_%s" %
> > test.iteration)
> >  
> >      firewall_flush = "iptables -F"
> > -    session.get_command_output(firewall_flush)
> > +    session.cmd_output(firewall_flush)
> >  
> >      for i in params.get("netperf_files").split():
> >          if not vm.copy_files_to(os.path.join(netperf_dir, i),
> > "/tmp"):
> > @@ -65,5 +65,5 @@ def run_netperf(test, params, env):
> >                                   ", ".join(list_fail))
> >  
> >      finally:
> > -        session.get_command_output("killall netserver")
> > +        session.cmd_output("killall netserver")
> >          session.close()
> > diff --git a/client/tests/kvm/tests/nic_promisc.py
> > b/client/tests/kvm/tests/nic_promisc.py
> > index 95f43ec..080fe94 100644
> > --- a/client/tests/kvm/tests/nic_promisc.py
> > +++ b/client/tests/kvm/tests/nic_promisc.py
> > @@ -82,12 +82,12 @@ def run_nic_promisc(test, params, env):
> >              logging.info("Clean temporary files")
> >              cmd = "rm -f %s" % filename
> >              utils.run(cmd)
> > -            session.get_command_output(cmd)
> > +            session.cmd_output(cmd)
> >  
> >      finally:
> >          logging.info("Restore the %s to the nonpromisc mode",
> > ethname)
> >          session2.close()
> > -        session.get_command_output("ip link set %s promisc off" %
> > ethname)
> > +        session.cmd_output("ip link set %s promisc off" % ethname)
> >          session.close()
> >  
> >      if success_counter != 2 * len(file_size):
> > diff --git a/client/tests/kvm/tests/nicdriver_unload.py
> > b/client/tests/kvm/tests/nicdriver_unload.py
> > index cc0879c..3dacbfa 100644
> > --- a/client/tests/kvm/tests/nicdriver_unload.py
> > +++ b/client/tests/kvm/tests/nicdriver_unload.py
> > @@ -74,7 +74,7 @@ def run_nicdriver_unload(test, params, env):
> >              try:
> >                  session2.cmd(unload_load_cmd, timeout=120)
> >              except:
> > -                session.get_command_output("rm -rf /tmp/Thread-*")
> > +                session.cmd_output("rm -rf /tmp/Thread-*")
> >                  raise
> >              pid, s = os.waitpid(pid, os.WNOHANG)
> >              status = os.WEXITSTATUS(s)
> > @@ -107,5 +107,5 @@ def run_nicdriver_unload(test, params, env):
> >              raise error.TestFail("Test nic function after load/unload
> > fail")
> >  
> >      finally:
> > -        session.get_command_output("rm -rf /tmp/Thread-*")
> > +        session.cmd_output("rm -rf /tmp/Thread-*")
> >          session.close()
> > diff --git a/client/tests/kvm/tests/pci_hotplug.py
> > b/client/tests/kvm/tests/pci_hotplug.py
> > index 1b38927..3f07bda 100644
> > --- a/client/tests/kvm/tests/pci_hotplug.py
> > +++ b/client/tests/kvm/tests/pci_hotplug.py
> > @@ -32,7 +32,7 @@ def run_pci_hotplug(test, params, env):
> >      info_pci_ref = vm.monitor.info("pci")
> >  
> >      # Get output of command as reference
> > -    reference =
> > session.get_command_output(params.get("reference_cmd"))
> > +    reference = session.cmd_output(params.get("reference_cmd"))
> >  
> >      tested_model = params.get("pci_model")
> >      test_type = params.get("pci_type")
> > @@ -130,7 +130,7 @@ def run_pci_hotplug(test, params, env):
> >  
> >          # Define a helper function to compare the output
> >          def new_shown():
> > -            o =
> > session.get_command_output(params.get("reference_cmd"))
> > +            o = session.cmd_output(params.get("reference_cmd"))
> >              return o != reference
> >  
> >          secs = int(params.get("wait_secs_for_hook_up"))
> > @@ -141,7 +141,7 @@ def run_pci_hotplug(test, params, env):
> >  
> >          # Define a helper function to catch PCI device string
> >          def find_pci():
> > -            o =
> > session.get_command_output(params.get("find_pci_cmd"))
> > +            o = session.cmd_output(params.get("find_pci_cmd"))
> >              return params.get("match_string") in o
> >  
> >          if not kvm_utils.wait_for(find_pci, 30, 3, 3):
> > diff --git a/client/tests/kvm/tests/physical_resources_check.py
> > b/client/tests/kvm/tests/physical_resources_check.py
> > index 682c7b2..0630ac8 100644
> > --- a/client/tests/kvm/tests/physical_resources_check.py
> > +++ b/client/tests/kvm/tests/physical_resources_check.py
> > @@ -135,7 +135,7 @@ def run_physical_resources_check(test, params,
> > env):
> >      def verify_device(expect, name, verify_cmd):
> >          f_fail = 0
> >          if verify_cmd:
> > -            actual = session.get_command_output(verify_cmd)
> > +            actual = session.cmd_output(verify_cmd)
> >              if not string.upper(expect) in actual:
> >                  f_fail += 1
> >                  logging.error("%s mismatch:")
> > diff --git a/client/tests/kvm/tests/timedrift.py
> > b/client/tests/kvm/tests/timedrift.py
> > index a6d3076..e5aa316 100644
> > --- a/client/tests/kvm/tests/timedrift.py
> > +++ b/client/tests/kvm/tests/timedrift.py
> > @@ -146,7 +146,7 @@ def run_timedrift(test, params, env):
> >              restore_cpu_affinity(prev_affinity)
> >              # Stop the guest load
> >              if guest_load_stop_command:
> > -                session.get_command_output(guest_load_stop_command)
> > +                session.cmd_output(guest_load_stop_command)
> >              # Close all load shell sessions
> >              for load_session in guest_load_sessions:
> >                  load_session.close()
> > diff --git a/client/tests/kvm/tests/vlan.py
> > b/client/tests/kvm/tests/vlan.py
> > index 8641c23..dfaf9d3 100644
> > --- a/client/tests/kvm/tests/vlan.py
> > +++ b/client/tests/kvm/tests/vlan.py
> > @@ -48,8 +48,7 @@ def run_vlan(test, params, env):
> >      def rem_vlan(session, id, iface="eth0"):
> >          rem_vlan_cmd = "if [[ -e /proc/net/vlan/%s ]];then vconfig
> > rem %s;fi"
> >          iface = "%s.%s" % (iface, id)
> > -        s = session.get_command_status(rem_vlan_cmd % (iface,
> > iface))
> > -        return s
> > +        return session.cmd_status(rem_vlan_cmd % (iface, iface))
> >  
> >      def nc_transfer(src, dst):
> >          nc_port = kvm_utils.find_free_port(1025, 5334, vm_ip[dst])
> > @@ -62,7 +61,7 @@ def run_vlan(test, params, env):
> >          time.sleep(2)
> >          #send file from src to dst
> >          send_cmd = send_cmd % (vlan_ip[dst], str(nc_port), "file")
> > -        if session[src].get_command_status(send_cmd, timeout=60) !=
> > 0:
> > +        if session[src].cmd_status(send_cmd, timeout=60) != 0:
> >              raise error.TestFail ("Fail to send file"
> >                                      " from vm%s to vm%s" % (src+1,
> > dst+1))
> >          try:
> > @@ -71,7 +70,7 @@ def run_vlan(test, params, env):
> >              raise error.TestFail ("Fail to receive file"
> >                                      " from vm%s to vm%s" % (src+1,
> > dst+1))
> >          #check MD5 message digest of receive file in dst
> > -        output = session[dst].get_command_output("md5sum
> > receive").strip()
> > +        output = session[dst].cmd_output("md5sum receive").strip()
> >          digest_receive = re.findall(r'(\w+)', output)[0]
> >          if digest_receive == digest_origin[src]:
> >              logging.info("file succeed received in vm %s" %
> > vlan_ip[dst])
> > @@ -79,7 +78,7 @@ def run_vlan(test, params, env):
> >              logging.info("digest_origin is  %s" %
> > digest_origin[src])
> >              logging.info("digest_receive is %s" % digest_receive)
> >              raise error.TestFail("File transfered differ from
> > origin")
> > -        session[dst].get_command_output("rm -f receive")
> > +        session[dst].cmd_output("rm -f receive")
> >  
> >      for i in range(2):
> >          session.append(kvm_test_utils.wait_for_login(vm[i],
> > @@ -101,7 +100,7 @@ def run_vlan(test, params, env):
> >          digest_origin.append(re.findall(r'(\w+)', output)[0])
> >  
> >          #stop firewall in vm
> > -        session[i].get_command_output("/etc/init.d/iptables stop")
> > +        session[i].cmd_output("/etc/init.d/iptables stop")
> >  
> >          #load 8021q module for vconfig
> >          session[i].cmd("modprobe 8021q")
> > diff --git a/client/tests/kvm/tests/whql_client_install.py
> > b/client/tests/kvm/tests/whql_client_install.py
> > index 52daa31..1c3f1c8 100644
> > --- a/client/tests/kvm/tests/whql_client_install.py
> > +++ b/client/tests/kvm/tests/whql_client_install.py
> > @@ -54,14 +54,14 @@ def run_whql_client_install(test, params, env):
> >  
> >      # Get server and client information
> >      cmd = "echo %computername%"
> > -    server_name = server_session.get_command_output(cmd).strip()
> > -    client_name = session.get_command_output(cmd).strip()
> > +    server_name = server_session.cmd_output(cmd).strip()
> > +    client_name = session.cmd_output(cmd).strip()
> >      cmd = "wmic computersystem get domain"
> > -    server_workgroup =
> > server_session.get_command_output(cmd).strip()
> > +    server_workgroup = server_session.cmd_output(cmd).strip()
> >      server_workgroup = server_workgroup.splitlines()[-1]
> >      regkey =
> > r"HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"
> >      cmd = "reg query %s /v Domain" % regkey
> > -    o =
> > server_session.get_command_output(cmd).strip().splitlines()[-1]
> > +    o = server_session.cmd_output(cmd).strip().splitlines()[-1]
> >      try:
> >          server_dns_suffix = o.split(None, 2)[2]
> >      except IndexError:
> > @@ -101,7 +101,7 @@ def run_whql_client_install(test, params, env):
> >                                           server_password)
> >      end_time = time.time() + 120
> >      while time.time() < end_time:
> > -        if session.get_command_status(cmd) == 0:
> > +        if session.cmd_status(cmd) == 0:
> >              break
> >          time.sleep(5)
> >      else:
> > diff --git a/client/tests/kvm/tests/whql_submission.py
> > b/client/tests/kvm/tests/whql_submission.py
> > index 3930954..b1b7f25 100644
> > --- a/client/tests/kvm/tests/whql_submission.py
> > +++ b/client/tests/kvm/tests/whql_submission.py
> > @@ -54,8 +54,8 @@ def run_whql_submission(test, params, env):
> >  
> >      # Get the computer names of the server and client
> >      cmd = "echo %computername%"
> > -    server_name = server_session.get_command_output(cmd).strip()
> > -    client_name = session.get_command_output(cmd).strip()
> > +    server_name = server_session.cmd_output(cmd).strip()
> > +    client_name = session.cmd_output(cmd).strip()
> >      session.close()
> >  
> >      # Run the automation program on the server
> > -- 
> > 1.5.5.6
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe kvm" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> _______________________________________________
> Autotest mailing list
> Autotest@test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [KVM-AUTOTEST PATCH 4/5] KVM test: kvm_subprocess: rename get_command_status_output() and friends
  2010-10-26 16:49   ` [KVM-AUTOTEST PATCH 3/5] KVM test: add utility functions start_windows_service() and stop_windows_service() Michael Goldish
@ 2010-10-26 16:49     ` Michael Goldish
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Goldish @ 2010-10-26 16:49 UTC (permalink / raw)
  To: autotest, kvm

get_command_status_output() -> cmd_status_output()
get_command_output() -> cmd_output()
get_command_status() -> cmd_status()

Signed-off-by: Michael Goldish <mgoldish@redhat.com>
---
 client/tests/kvm/kvm_subprocess.py                 |   27 +++++++++----------
 client/tests/kvm/kvm_test_utils.py                 |   20 +++++++-------
 client/tests/kvm/tests/ethtool.py                  |   16 ++++++------
 client/tests/kvm/tests/guest_s4.py                 |    8 +++---
 client/tests/kvm/tests/guest_test.py               |    3 +-
 client/tests/kvm/tests/iofuzz.py                   |    2 +-
 client/tests/kvm/tests/ioquit.py                   |    4 +-
 client/tests/kvm/tests/iozone_windows.py           |    4 +-
 client/tests/kvm/tests/ksm_overcommit.py           |    4 +-
 client/tests/kvm/tests/linux_s3.py                 |    4 +-
 client/tests/kvm/tests/migration.py                |    7 ++---
 client/tests/kvm/tests/multicast.py                |    8 +++---
 client/tests/kvm/tests/netperf.py                  |    4 +-
 client/tests/kvm/tests/nic_promisc.py              |    4 +-
 client/tests/kvm/tests/nicdriver_unload.py         |    4 +-
 client/tests/kvm/tests/pci_hotplug.py              |    6 ++--
 client/tests/kvm/tests/physical_resources_check.py |    2 +-
 client/tests/kvm/tests/timedrift.py                |    2 +-
 client/tests/kvm/tests/vlan.py                     |   11 +++----
 client/tests/kvm/tests/whql_client_install.py      |   10 +++---
 client/tests/kvm/tests/whql_submission.py          |    4 +-
 21 files changed, 75 insertions(+), 79 deletions(-)

diff --git a/client/tests/kvm/kvm_subprocess.py b/client/tests/kvm/kvm_subprocess.py
index c92910c..c8caab2 100755
--- a/client/tests/kvm/kvm_subprocess.py
+++ b/client/tests/kvm/kvm_subprocess.py
@@ -1103,7 +1103,7 @@ class kvm_shell_session(kvm_expect):
         @param prompt: Regular expression describing the shell's prompt line.
         @param status_test_command: Command to be used for getting the last
                 exit status of commands run inside the shell (used by
-                get_command_status_output() and friends).
+                cmd_status_output() and friends).
         """
         # Init the superclass
         kvm_expect.__init__(self, command, id, auto_close, echo, linesep,
@@ -1193,8 +1193,8 @@ class kvm_shell_session(kvm_expect):
         return o
 
 
-    def get_command_output(self, cmd, timeout=30.0, internal_timeout=None,
-                           print_func=None):
+    def cmd_output(self, cmd, timeout=30.0, internal_timeout=None,
+                   print_func=None):
         """
         Send a command and return its output.
 
@@ -1237,8 +1237,8 @@ class kvm_shell_session(kvm_expect):
         return remove_last_nonempty_line(remove_command_echo(o, cmd))
 
 
-    def get_command_status_output(self, cmd, timeout=30.0,
-                                  internal_timeout=None, print_func=None):
+    def cmd_status_output(self, cmd, timeout=30.0, internal_timeout=None,
+                          print_func=None):
         """
         Send a command and return its exit status and output.
 
@@ -1257,11 +1257,10 @@ class kvm_shell_session(kvm_expect):
         @raise ShellStatusError: Raised if the exit status cannot be obtained
         @raise ShellError: Raised if an unknown error occurs
         """
-        o = self.get_command_output(cmd, timeout, internal_timeout, print_func)
+        o = self.cmd_output(cmd, timeout, internal_timeout, print_func)
         try:
             # Send the 'echo $?' (or equivalent) command to get the exit status
-            s = self.get_command_output(self.status_test_command, 10,
-                                        internal_timeout)
+            s = self.cmd_output(self.status_test_command, 10, internal_timeout)
         except ShellError:
             raise ShellStatusError(cmd, o)
 
@@ -1273,8 +1272,8 @@ class kvm_shell_session(kvm_expect):
             raise ShellStatusError(cmd, o)
 
 
-    def get_command_status(self, cmd, timeout=30.0, internal_timeout=None,
-                           print_func=None):
+    def cmd_status(self, cmd, timeout=30.0, internal_timeout=None,
+                   print_func=None):
         """
         Send a command and return its exit status.
 
@@ -1292,8 +1291,8 @@ class kvm_shell_session(kvm_expect):
         @raise ShellStatusError: Raised if the exit status cannot be obtained
         @raise ShellError: Raised if an unknown error occurs
         """
-        s, o = self.get_command_status_output(cmd, timeout, internal_timeout,
-                                              print_func)
+        s, o = self.cmd_status_output(cmd, timeout, internal_timeout,
+                                      print_func)
         return s
 
 
@@ -1319,8 +1318,8 @@ class kvm_shell_session(kvm_expect):
         @raise ShellError: Raised if an unknown error occurs
         @raise ShellCmdError: Raised if the exit status is nonzero
         """
-        s, o = self.get_command_status_output(cmd, timeout, internal_timeout,
-                                              print_func)
+        s, o = self.cmd_status_output(cmd, timeout, internal_timeout,
+                                      print_func)
         if s != 0:
             raise ShellCmdError(cmd, s, o)
         return o
diff --git a/client/tests/kvm/kvm_test_utils.py b/client/tests/kvm/kvm_test_utils.py
index 8d287b2..26d5164 100644
--- a/client/tests/kvm/kvm_test_utils.py
+++ b/client/tests/kvm/kvm_test_utils.py
@@ -252,7 +252,7 @@ def stop_windows_service(session, service, timeout=120):
     """
     end_time = time.time() + timeout
     while time.time() < end_time:
-        o = session.get_command_output("sc stop %s" % service, timeout=60)
+        o = session.cmd_output("sc stop %s" % service, timeout=60)
         # FAILED 1060 means the service isn't installed.
         # FAILED 1062 means the service hasn't been started.
         if re.search(r"\bFAILED (1060|1062)\b", o, re.I):
@@ -274,7 +274,7 @@ def start_windows_service(session, service, timeout=120):
     """
     end_time = time.time() + timeout
     while time.time() < end_time:
-        o = session.get_command_output("sc start %s" % service, timeout=60)
+        o = session.cmd_output("sc start %s" % service, timeout=60)
         # FAILED 1060 means the service isn't installed.
         if re.search(r"\bFAILED 1060\b", o, re.I):
             raise error.TestError("Could not start service '%s' "
@@ -306,7 +306,7 @@ def get_time(session, time_command, time_filter_re, time_format):
     """
     if len(re.findall("ntpdate|w32tm", time_command)) == 0:
         host_time = time.time()
-        s = session.get_command_output(time_command)
+        s = session.cmd_output(time_command)
 
         try:
             s = re.findall(time_filter_re, s)[0]
@@ -398,7 +398,7 @@ def run_autotest(vm, session, control_path, timeout, outputdir):
         copy = False
         local_hash = utils.hash_file(local_path)
         basename = os.path.basename(local_path)
-        output = session.get_command_output("md5sum %s" % remote_path)
+        output = session.cmd_output("md5sum %s" % remote_path)
         if "such file" in output:
             remote_hash = "0"
         elif output:
@@ -451,7 +451,7 @@ def run_autotest(vm, session, control_path, timeout, outputdir):
         Get the status of the tests that were executed on the host and close
         the session where autotest was being executed.
         """
-        output = session.get_command_output("cat results/*/status")
+        output = session.cmd_output("cat results/*/status")
         try:
             results = scan_results.parse_results(output)
             # Report test results
@@ -509,8 +509,8 @@ def run_autotest(vm, session, control_path, timeout, outputdir):
     try:
         try:
             logging.info("---------------- Test output ----------------")
-            session.get_command_output("bin/autotest control", timeout=timeout,
-                                       print_func=logging.info)
+            session.cmd_output("bin/autotest control", timeout=timeout,
+                               print_func=logging.info)
         finally:
             logging.info("------------- End of test output ------------")
     except kvm_subprocess.ShellTimeoutError:
@@ -588,8 +588,8 @@ def raw_ping(command, timeout, session, output_func):
         return status, output
     else:
         try:
-            output = session.get_command_output(command, timeout=timeout,
-                                                print_func=output_func)
+            output = session.cmd_output(command, timeout=timeout,
+                                        print_func=output_func)
         except kvm_subprocess.ShellTimeoutError:
             # Send ctrl+c (SIGINT) through ssh session
             session.send("\003")
@@ -671,7 +671,7 @@ def get_linux_ifname(session, mac_address):
     @mac_address: the macaddress of nic
     """
 
-    output = session.get_command_output("ifconfig -a")
+    output = session.cmd_output("ifconfig -a")
 
     try:
         ethname = re.findall("(\w+)\s+Link.*%s" % mac_address, output,
diff --git a/client/tests/kvm/tests/ethtool.py b/client/tests/kvm/tests/ethtool.py
index b93c5a1..b839963 100644
--- a/client/tests/kvm/tests/ethtool.py
+++ b/client/tests/kvm/tests/ethtool.py
@@ -51,7 +51,7 @@ def run_ethtool(test, params, env):
             return False
         cmd = "ethtool -K %s %s %s" % (ethname, type, status)
         if ethtool_get(type) != status:
-            return session.get_command_status(cmd) == 0
+            return session.cmd_status(cmd) == 0
         if ethtool_get(type) != status:
             logging.error("Fail to set %s %s" % (type, status))
             return False
@@ -74,7 +74,7 @@ def run_ethtool(test, params, env):
         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)
+            o = session.cmd_output("md5sum %s" % name)
             guest_result = re.findall("\w+", o)[0]
         except IndexError:
             logging.error("Could not get file md5sum in guest")
@@ -92,13 +92,13 @@ def run_ethtool(test, params, env):
         @param src: Source host of transfer file
         @return: Tuple (status, error msg/tcpdump result)
         """
-        session2.get_command_output("rm -rf %s" % filename)
+        session2.cmd_output("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":
-            session.get_command_output(dd_cmd, timeout=360)
+            session.cmd_output(dd_cmd, timeout=360)
             tcpdump_cmd += " and src %s" % guest_ip
             copy_files_fun = vm.copy_files_from
         else:
@@ -115,15 +115,15 @@ def run_ethtool(test, params, env):
             tcpdump_cmd += " and not port %s" % i
         logging.debug("Listen by command: %s" % tcpdump_cmd)
         session2.sendline(tcpdump_cmd)
-        if not kvm_utils.wait_for(lambda: session.get_command_status(
-                                           "pgrep tcpdump") == 0, 30):
+        cmd = "pgrep tcpdump"
+        if not kvm_utils.wait_for(lambda: session.cmd_status(cmd) == 0, 30):
             return (False, "Tcpdump process wasn't launched")
 
         logging.info("Start to transfer file")
         if not copy_files_fun(filename, filename):
             return (False, "Child process transfer file failed")
         logging.info("Transfer file completed")
-        if session.get_command_status("killall tcpdump") != 0:
+        if session.cmd_status("killall tcpdump") != 0:
             return (False, "Could not kill all tcpdump process")
         try:
             tcpdump_string = session2.read_up_to_prompt(timeout=60)
@@ -174,7 +174,7 @@ def run_ethtool(test, params, env):
     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"):
+    if session.cmd_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)))
diff --git a/client/tests/kvm/tests/guest_s4.py b/client/tests/kvm/tests/guest_s4.py
index 2eb035b..2c38013 100644
--- a/client/tests/kvm/tests/guest_s4.py
+++ b/client/tests/kvm/tests/guest_s4.py
@@ -16,7 +16,7 @@ def run_guest_s4(test, params, env):
     session = kvm_test_utils.wait_for_login(vm, timeout=timeout)
 
     logging.info("Checking whether guest OS supports suspend to disk (S4)...")
-    s, o = session.get_command_status_output(params.get("check_s4_support_cmd"))
+    s, o = session.cmd_status_output(params.get("check_s4_support_cmd"))
     if "not enough space" in o:
         raise error.TestError("Check S4 support failed: %s" % o)
     elif s != 0:
@@ -36,7 +36,7 @@ def run_guest_s4(test, params, env):
 
     # Make sure the background program is running as expected
     check_s4_cmd = params.get("check_s4_cmd")
-    if session2.get_command_status(check_s4_cmd) != 0:
+    if session2.cmd_status(check_s4_cmd) != 0:
         raise error.TestError("Failed to launch '%s' as a background process" %
                               test_s4_cmd)
     logging.info("Launched background command in guest: %s" % test_s4_cmd)
@@ -68,11 +68,11 @@ def run_guest_s4(test, params, env):
 
     # Check whether the test command is still alive
     logging.info("Checking if background command is still alive...")
-    if session2.get_command_status(check_s4_cmd) != 0:
+    if session2.cmd_status(check_s4_cmd) != 0:
         raise error.TestFail("Background command '%s' stopped running. S4 "
                              "failed." % test_s4_cmd)
 
     logging.info("VM resumed successfuly after suspend to disk")
-    session2.get_command_output(params.get("kill_test_s4_cmd"))
+    session2.cmd_output(params.get("kill_test_s4_cmd"))
     session.close()
     session2.close()
diff --git a/client/tests/kvm/tests/guest_test.py b/client/tests/kvm/tests/guest_test.py
index da38afd..bdc5366 100644
--- a/client/tests/kvm/tests/guest_test.py
+++ b/client/tests/kvm/tests/guest_test.py
@@ -56,8 +56,7 @@ def run_guest_test(test, params, env):
             session.cmd(rsc_cmd, timeout=test_timeout)
             logging.info("Download resource finished.")
         else:
-            session.get_command_output("del %s" % dst_rsc_path,
-                                       internal_timeout=0)
+            session.cmd_output("del %s" % dst_rsc_path, internal_timeout=0)
             script_path = kvm_utils.get_path(test.bindir, script)
             vm.copy_files_to(script_path, dst_rsc_path, timeout=60)
 
diff --git a/client/tests/kvm/tests/iofuzz.py b/client/tests/kvm/tests/iofuzz.py
index 77f4761..e77540e 100644
--- a/client/tests/kvm/tests/iofuzz.py
+++ b/client/tests/kvm/tests/iofuzz.py
@@ -98,7 +98,7 @@ def run_iofuzz(test, params, env):
         r = random.SystemRandom()
 
         logging.info("Enumerate guest devices through /proc/ioports")
-        ioports = session.get_command_output("cat /proc/ioports")
+        ioports = session.cmd_output("cat /proc/ioports")
         logging.debug(ioports)
         devices = re.findall("(\w+)-(\w+)\ : (.*)", ioports)
 
diff --git a/client/tests/kvm/tests/ioquit.py b/client/tests/kvm/tests/ioquit.py
index bdccd78..f8c8956 100644
--- a/client/tests/kvm/tests/ioquit.py
+++ b/client/tests/kvm/tests/ioquit.py
@@ -20,13 +20,13 @@ def run_ioquit(test, params, env):
     try:
         bg_cmd = params.get("background_cmd")
         logging.info("Add IO workload for guest OS.")
-        session.get_command_output(bg_cmd, timeout=60)
+        session.cmd_output(bg_cmd, timeout=60)
         check_cmd = params.get("check_cmd")
         session2.cmd(check_cmd, timeout=60)
 
         logging.info("Sleep for a while")
         time.sleep(random.randrange(30,100))
-        if session2.get_command_status(check_cmd, timeout=60) != 0:
+        if session2.cmd_status(check_cmd, timeout=60) != 0:
             logging.info("IO workload finished before the VM was killed")
         logging.info("Kill the virtual machine")
         vm.process.close()
diff --git a/client/tests/kvm/tests/iozone_windows.py b/client/tests/kvm/tests/iozone_windows.py
index a96fdfc..febf898 100644
--- a/client/tests/kvm/tests/iozone_windows.py
+++ b/client/tests/kvm/tests/iozone_windows.py
@@ -28,8 +28,8 @@ def run_iozone_windows(test, params, env):
     c = params.get("iozone_cmd")
     t = int(params.get("iozone_timeout"))
     logging.info("Running IOzone command on guest, timeout %ss", t)
-    results = session.get_command_output(command=c, timeout=t,
-                                         print_func=logging.debug)
+    results = session.cmd_output(command=c, timeout=t,
+                                 print_func=logging.debug)
     utils.open_write_close(results_path, results)
 
     # Postprocess the results using the IOzone postprocessing module
diff --git a/client/tests/kvm/tests/ksm_overcommit.py b/client/tests/kvm/tests/ksm_overcommit.py
index dbd05dc..f60929e 100644
--- a/client/tests/kvm/tests/ksm_overcommit.py
+++ b/client/tests/kvm/tests/ksm_overcommit.py
@@ -230,7 +230,7 @@ def run_ksm_overcommit(test, params, env):
                            (mem / 200 * 50 * perf_ratio))
         logging.debug(kvm_test_utils.get_memory_info([lvms[last_vm]]))
 
-        lsessions[i].get_command_output("die()", 20)
+        lsessions[i].cmd_output("die()", 20)
         lvms[last_vm].destroy(gracefully = False)
         logging.info("Phase 3b: PASS")
 
@@ -356,7 +356,7 @@ def run_ksm_overcommit(test, params, env):
 
         logging.debug("Cleaning up...")
         for i in range(0, max_alloc):
-            lsessions[i].get_command_output("die()", 20)
+            lsessions[i].cmd_output("die()", 20)
         session.close()
         vm.destroy(gracefully = False)
 
diff --git a/client/tests/kvm/tests/linux_s3.py b/client/tests/kvm/tests/linux_s3.py
index 55acea3..3baf660 100644
--- a/client/tests/kvm/tests/linux_s3.py
+++ b/client/tests/kvm/tests/linux_s3.py
@@ -16,13 +16,13 @@ def run_linux_s3(test, params, env):
     session = kvm_test_utils.wait_for_login(vm, timeout=timeout)
 
     logging.info("Checking that VM supports S3")
-    if session.get_command_status("grep -q mem /sys/power/state") != 0:
+    if session.cmd_status("grep -q mem /sys/power/state") != 0:
         raise error.TestFail("Guest does not support S3")
 
     logging.info("Waiting for a while for X to start")
     time.sleep(10)
 
-    src_tty = session.get_command_output("fgconsole").strip()
+    src_tty = session.cmd_output("fgconsole").strip()
     logging.info("Current virtual terminal is %s" % src_tty)
     if src_tty not in map(str, range(1,10)):
         raise error.TestFail("Got a strange current vt (%s)" % src_tty)
diff --git a/client/tests/kvm/tests/migration.py b/client/tests/kvm/tests/migration.py
index 513b500..e883838 100644
--- a/client/tests/kvm/tests/migration.py
+++ b/client/tests/kvm/tests/migration.py
@@ -29,7 +29,7 @@ def run_migration(test, params, env):
 
     # Get the output of migration_test_command
     test_command = params.get("migration_test_command")
-    reference_output = session.get_command_output(test_command)
+    reference_output = session.cmd_output(test_command)
 
     # Start some process in the background (and leave the session open)
     background_command = params.get("migration_bg_command", "")
@@ -60,7 +60,7 @@ def run_migration(test, params, env):
         session2.cmd(check_command, timeout=30)
 
         # Get the output of migration_test_command
-        output = session2.get_command_output(test_command)
+        output = session2.cmd_output(test_command)
 
         # Compare output to reference output
         if output != reference_output:
@@ -77,8 +77,7 @@ def run_migration(test, params, env):
     finally:
         # Kill the background process
         if session2 and session2.is_alive():
-            session2.get_command_output(params.get("migration_bg_kill_command",
-                                                   ""))
+            session2.cmd_output(params.get("migration_bg_kill_command", ""))
 
     session2.close()
     session.close()
diff --git a/client/tests/kvm/tests/multicast.py b/client/tests/kvm/tests/multicast.py
index 4a1b4f5..2a12b4f 100644
--- a/client/tests/kvm/tests/multicast.py
+++ b/client/tests/kvm/tests/multicast.py
@@ -56,8 +56,8 @@ def run_multicast(test, params, env):
     mcast_path = os.path.join(test.bindir, "scripts/join_mcast.py")
     if not vm.copy_files_to(mcast_path, "/tmp"):
         raise error.TestError("Fail to copy %s to guest" % mcast_path)
-    output = session.get_command_output("python /tmp/join_mcast.py %d %s %d" %
-                                        (mgroup_count, prefix, suffix))
+    output = session.cmd_output("python /tmp/join_mcast.py %d %s %d" %
+                                (mgroup_count, prefix, suffix))
 
     # if success to join multicast, the process will be paused, and return PID.
     try:
@@ -86,6 +86,6 @@ def run_multicast(test, params, env):
                                      (s, o))
 
     finally:
-        logging.debug(session.get_command_output("ipmaddr show"))
-        session.get_command_output("kill -s SIGCONT %s" % pid)
+        logging.debug(session.cmd_output("ipmaddr show"))
+        session.cmd_output("kill -s SIGCONT %s" % pid)
         session.close()
diff --git a/client/tests/kvm/tests/netperf.py b/client/tests/kvm/tests/netperf.py
index 64ff4c6..7e39f6a 100644
--- a/client/tests/kvm/tests/netperf.py
+++ b/client/tests/kvm/tests/netperf.py
@@ -26,7 +26,7 @@ def run_netperf(test, params, env):
     result_file = os.path.join(test.resultsdir, "output_%s" % test.iteration)
 
     firewall_flush = "iptables -F"
-    session.get_command_output(firewall_flush)
+    session.cmd_output(firewall_flush)
 
     for i in params.get("netperf_files").split():
         if not vm.copy_files_to(os.path.join(netperf_dir, i), "/tmp"):
@@ -65,5 +65,5 @@ def run_netperf(test, params, env):
                                  ", ".join(list_fail))
 
     finally:
-        session.get_command_output("killall netserver")
+        session.cmd_output("killall netserver")
         session.close()
diff --git a/client/tests/kvm/tests/nic_promisc.py b/client/tests/kvm/tests/nic_promisc.py
index 95f43ec..080fe94 100644
--- a/client/tests/kvm/tests/nic_promisc.py
+++ b/client/tests/kvm/tests/nic_promisc.py
@@ -82,12 +82,12 @@ def run_nic_promisc(test, params, env):
             logging.info("Clean temporary files")
             cmd = "rm -f %s" % filename
             utils.run(cmd)
-            session.get_command_output(cmd)
+            session.cmd_output(cmd)
 
     finally:
         logging.info("Restore the %s to the nonpromisc mode", ethname)
         session2.close()
-        session.get_command_output("ip link set %s promisc off" % ethname)
+        session.cmd_output("ip link set %s promisc off" % ethname)
         session.close()
 
     if success_counter != 2 * len(file_size):
diff --git a/client/tests/kvm/tests/nicdriver_unload.py b/client/tests/kvm/tests/nicdriver_unload.py
index cc0879c..3dacbfa 100644
--- a/client/tests/kvm/tests/nicdriver_unload.py
+++ b/client/tests/kvm/tests/nicdriver_unload.py
@@ -74,7 +74,7 @@ def run_nicdriver_unload(test, params, env):
             try:
                 session2.cmd(unload_load_cmd, timeout=120)
             except:
-                session.get_command_output("rm -rf /tmp/Thread-*")
+                session.cmd_output("rm -rf /tmp/Thread-*")
                 raise
             pid, s = os.waitpid(pid, os.WNOHANG)
             status = os.WEXITSTATUS(s)
@@ -107,5 +107,5 @@ def run_nicdriver_unload(test, params, env):
             raise error.TestFail("Test nic function after load/unload fail")
 
     finally:
-        session.get_command_output("rm -rf /tmp/Thread-*")
+        session.cmd_output("rm -rf /tmp/Thread-*")
         session.close()
diff --git a/client/tests/kvm/tests/pci_hotplug.py b/client/tests/kvm/tests/pci_hotplug.py
index 1b38927..3f07bda 100644
--- a/client/tests/kvm/tests/pci_hotplug.py
+++ b/client/tests/kvm/tests/pci_hotplug.py
@@ -32,7 +32,7 @@ def run_pci_hotplug(test, params, env):
     info_pci_ref = vm.monitor.info("pci")
 
     # Get output of command as reference
-    reference = session.get_command_output(params.get("reference_cmd"))
+    reference = session.cmd_output(params.get("reference_cmd"))
 
     tested_model = params.get("pci_model")
     test_type = params.get("pci_type")
@@ -130,7 +130,7 @@ def run_pci_hotplug(test, params, env):
 
         # Define a helper function to compare the output
         def new_shown():
-            o = session.get_command_output(params.get("reference_cmd"))
+            o = session.cmd_output(params.get("reference_cmd"))
             return o != reference
 
         secs = int(params.get("wait_secs_for_hook_up"))
@@ -141,7 +141,7 @@ def run_pci_hotplug(test, params, env):
 
         # Define a helper function to catch PCI device string
         def find_pci():
-            o = session.get_command_output(params.get("find_pci_cmd"))
+            o = session.cmd_output(params.get("find_pci_cmd"))
             return params.get("match_string") in o
 
         if not kvm_utils.wait_for(find_pci, 30, 3, 3):
diff --git a/client/tests/kvm/tests/physical_resources_check.py b/client/tests/kvm/tests/physical_resources_check.py
index 682c7b2..0630ac8 100644
--- a/client/tests/kvm/tests/physical_resources_check.py
+++ b/client/tests/kvm/tests/physical_resources_check.py
@@ -135,7 +135,7 @@ def run_physical_resources_check(test, params, env):
     def verify_device(expect, name, verify_cmd):
         f_fail = 0
         if verify_cmd:
-            actual = session.get_command_output(verify_cmd)
+            actual = session.cmd_output(verify_cmd)
             if not string.upper(expect) in actual:
                 f_fail += 1
                 logging.error("%s mismatch:")
diff --git a/client/tests/kvm/tests/timedrift.py b/client/tests/kvm/tests/timedrift.py
index a6d3076..e5aa316 100644
--- a/client/tests/kvm/tests/timedrift.py
+++ b/client/tests/kvm/tests/timedrift.py
@@ -146,7 +146,7 @@ def run_timedrift(test, params, env):
             restore_cpu_affinity(prev_affinity)
             # Stop the guest load
             if guest_load_stop_command:
-                session.get_command_output(guest_load_stop_command)
+                session.cmd_output(guest_load_stop_command)
             # Close all load shell sessions
             for load_session in guest_load_sessions:
                 load_session.close()
diff --git a/client/tests/kvm/tests/vlan.py b/client/tests/kvm/tests/vlan.py
index 8641c23..dfaf9d3 100644
--- a/client/tests/kvm/tests/vlan.py
+++ b/client/tests/kvm/tests/vlan.py
@@ -48,8 +48,7 @@ def run_vlan(test, params, env):
     def rem_vlan(session, id, iface="eth0"):
         rem_vlan_cmd = "if [[ -e /proc/net/vlan/%s ]];then vconfig rem %s;fi"
         iface = "%s.%s" % (iface, id)
-        s = session.get_command_status(rem_vlan_cmd % (iface, iface))
-        return s
+        return session.cmd_status(rem_vlan_cmd % (iface, iface))
 
     def nc_transfer(src, dst):
         nc_port = kvm_utils.find_free_port(1025, 5334, vm_ip[dst])
@@ -62,7 +61,7 @@ def run_vlan(test, params, env):
         time.sleep(2)
         #send file from src to dst
         send_cmd = send_cmd % (vlan_ip[dst], str(nc_port), "file")
-        if session[src].get_command_status(send_cmd, timeout=60) != 0:
+        if session[src].cmd_status(send_cmd, timeout=60) != 0:
             raise error.TestFail ("Fail to send file"
                                     " from vm%s to vm%s" % (src+1, dst+1))
         try:
@@ -71,7 +70,7 @@ def run_vlan(test, params, env):
             raise error.TestFail ("Fail to receive file"
                                     " from vm%s to vm%s" % (src+1, dst+1))
         #check MD5 message digest of receive file in dst
-        output = session[dst].get_command_output("md5sum receive").strip()
+        output = session[dst].cmd_output("md5sum receive").strip()
         digest_receive = re.findall(r'(\w+)', output)[0]
         if digest_receive == digest_origin[src]:
             logging.info("file succeed received in vm %s" % vlan_ip[dst])
@@ -79,7 +78,7 @@ def run_vlan(test, params, env):
             logging.info("digest_origin is  %s" % digest_origin[src])
             logging.info("digest_receive is %s" % digest_receive)
             raise error.TestFail("File transfered differ from origin")
-        session[dst].get_command_output("rm -f receive")
+        session[dst].cmd_output("rm -f receive")
 
     for i in range(2):
         session.append(kvm_test_utils.wait_for_login(vm[i],
@@ -101,7 +100,7 @@ def run_vlan(test, params, env):
         digest_origin.append(re.findall(r'(\w+)', output)[0])
 
         #stop firewall in vm
-        session[i].get_command_output("/etc/init.d/iptables stop")
+        session[i].cmd_output("/etc/init.d/iptables stop")
 
         #load 8021q module for vconfig
         session[i].cmd("modprobe 8021q")
diff --git a/client/tests/kvm/tests/whql_client_install.py b/client/tests/kvm/tests/whql_client_install.py
index 52daa31..1c3f1c8 100644
--- a/client/tests/kvm/tests/whql_client_install.py
+++ b/client/tests/kvm/tests/whql_client_install.py
@@ -54,14 +54,14 @@ def run_whql_client_install(test, params, env):
 
     # Get server and client information
     cmd = "echo %computername%"
-    server_name = server_session.get_command_output(cmd).strip()
-    client_name = session.get_command_output(cmd).strip()
+    server_name = server_session.cmd_output(cmd).strip()
+    client_name = session.cmd_output(cmd).strip()
     cmd = "wmic computersystem get domain"
-    server_workgroup = server_session.get_command_output(cmd).strip()
+    server_workgroup = server_session.cmd_output(cmd).strip()
     server_workgroup = server_workgroup.splitlines()[-1]
     regkey = r"HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"
     cmd = "reg query %s /v Domain" % regkey
-    o = server_session.get_command_output(cmd).strip().splitlines()[-1]
+    o = server_session.cmd_output(cmd).strip().splitlines()[-1]
     try:
         server_dns_suffix = o.split(None, 2)[2]
     except IndexError:
@@ -101,7 +101,7 @@ def run_whql_client_install(test, params, env):
                                          server_password)
     end_time = time.time() + 120
     while time.time() < end_time:
-        if session.get_command_status(cmd) == 0:
+        if session.cmd_status(cmd) == 0:
             break
         time.sleep(5)
     else:
diff --git a/client/tests/kvm/tests/whql_submission.py b/client/tests/kvm/tests/whql_submission.py
index 3930954..b1b7f25 100644
--- a/client/tests/kvm/tests/whql_submission.py
+++ b/client/tests/kvm/tests/whql_submission.py
@@ -54,8 +54,8 @@ def run_whql_submission(test, params, env):
 
     # Get the computer names of the server and client
     cmd = "echo %computername%"
-    server_name = server_session.get_command_output(cmd).strip()
-    client_name = session.get_command_output(cmd).strip()
+    server_name = server_session.cmd_output(cmd).strip()
+    client_name = session.cmd_output(cmd).strip()
     session.close()
 
     # Run the automation program on the server
-- 
1.5.5.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-27 12:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <2034814473.1590591288159137734.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>
2010-10-27  5:59 ` [KVM-AUTOTEST PATCH 4/5] KVM test: kvm_subprocess: rename get_command_status_output() and friends Feng Yang
2010-10-27  9:10   ` Michael Goldish
2010-10-27 12:04   ` [Autotest] " Lucas Meneghel Rodrigues
2010-10-26 16:49 [KVM-AUTOTEST PATCH 1/5] KVM test: kvm_subprocess: raise exceptions in kvm_shell_session and kvm_expect Michael Goldish
2010-10-26 16:49 ` [KVM-AUTOTEST PATCH 2/5] KVM test: kvm_monitor.py: store attributes in QMPCmdError Michael Goldish
2010-10-26 16:49   ` [KVM-AUTOTEST PATCH 3/5] KVM test: add utility functions start_windows_service() and stop_windows_service() Michael Goldish
2010-10-26 16:49     ` [KVM-AUTOTEST PATCH 4/5] KVM test: kvm_subprocess: rename get_command_status_output() and friends Michael Goldish

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.