File virttest_fix_path_sudo.patch of Package virt-test

diff -rau virttest/base_installer.py virttest.sudo/base_installer.py
--- virttest/base_installer.py	2014-03-06 22:46:05.688844045 +0100
+++ virttest.sudo/base_installer.py	2014-03-13 14:45:44.154373783 +0100
@@ -352,7 +352,7 @@
         logging.info("Loading modules from default locations through "
                      "modprobe")
         for module in module_list:
-            utils.system("modprobe %s" % module)
+            utils.system("sudo /sbin/modprobe %s" % module)
 
     def unload_modules(self, module_list=None):
         '''
diff -rau virttest/test_setup.py virttest.sudo/test_setup.py
--- virttest/test_setup.py	2014-03-06 22:46:05.703843949 +0100
+++ virttest.sudo/test_setup.py	2014-03-13 15:09:02.464801774 +0100
@@ -378,7 +378,7 @@
         if self.deallocate:
             error.context("trying to dealocate hugepage memory")
             try:
-                utils.system("umount %s" % self.hugepage_path)
+                utils.system("sudo /usr/bin/umount %s" % self.hugepage_path)
             except error.CmdError:
                 return
             utils.system("echo 0 > %s" % self.kernel_hp_file)
@@ -521,32 +521,32 @@
         return rules
 
     def _add_bridge(self):
-        utils.system("brctl addbr %s" % self.brname)
+        utils.system("sudo /usr/sbin/brctl addbr %s" % self.brname)
         ip_fwd_path = "/proc/sys/net/%s/ip_forward" % self.ip_version
         ip_fwd = open(ip_fwd_path, "w")
         ip_fwd.write("1\n")
-        utils.system("brctl stp %s on" % self.brname)
-        utils.system("brctl setfd %s 4" % self.brname)
+        utils.system("sudo /usr/sbin/brctl stp %s on" % self.brname)
+        utils.system("sudo /usr/sbin/brctl setfd %s 4" % self.brname)
         if self.physical_nic:
-            utils.system("brctl addif %s %s" % (self.brname,
+            utils.system("sudo /usr/sbin/brctl addif %s %s" % (self.brname,
                                                 self.physical_nic))
 
     def _bring_bridge_up(self):
-        utils.system("ifconfig %s %s.1 up" % (self.brname, self.subnet))
+        utils.system("sudo /sbin/ifconfig %s %s.1 up" % (self.brname, self.subnet))
 
     def _iptables_add(self, cmd):
-        return utils.system("iptables -I %s" % cmd)
+        return utils.system("sudo /usr/sbin/iptables -I %s" % cmd)
 
     def _iptables_del(self, cmd):
-        return utils.system("iptables -D %s" % cmd)
+        return utils.system("sudo /usr/sbin/iptables -D %s" % cmd)
 
     def _enable_nat(self):
         for rule in self.iptables_rules:
             self._iptables_add(rule)
 
     def _start_dhcp_server(self):
-        utils.system("service dnsmasq stop")
-        utils.system("dnsmasq --strict-order --bind-interfaces "
+        utils.system("sudo /usr/sbin/service dnsmasq stop")
+        utils.system("sudo /usr/sbin/dnsmasq --strict-order --bind-interfaces "
                      "--listen-address %s.1 --dhcp-range %s.2,%s.254 "
                      "--dhcp-lease-max=253 "
                      "--dhcp-no-override "
@@ -625,7 +625,7 @@
                 pass
 
     def _bring_bridge_down(self):
-        utils.system("ifconfig %s down" % self.brname, ignore_status=True)
+        utils.system("sudo /sbin/ifconfig %s down" % self.brname, ignore_status=True)
 
     def _disable_nat(self):
         for rule in self.iptables_rules:
@@ -636,7 +636,7 @@
             self._iptables_del(rule)
 
     def _remove_bridge(self):
-        utils.system("brctl delbr %s" % self.brname, ignore_status=True)
+        utils.system("sudo /sbin/brctl delbr %s" % self.brname, ignore_status=True)
 
     def cleanup(self):
         brctl_output = utils.system_output("brctl show")
@@ -864,7 +864,7 @@
         """
 
         base_dir = "/sys/bus/pci/devices"
-        cmd = "lspci | awk '/%s/ {print $1}'" % self.pf_filter_re
+        cmd = "/sbin/lspci | awk '/%s/ {print $1}'" % self.pf_filter_re
         pf_ids = [i for i in utils.system_output(cmd).splitlines()]
         pf_vf_dict = []
         for pf_id in pf_ids:
@@ -887,7 +887,7 @@
         re_ethname = "\w+(?=: flags)|eth[0-9](?=\s*Link)"
         ethnames = re.findall(re_ethname, if_out)
         for eth in ethnames:
-            cmd = "ethtool -i %s | awk '/bus-info/ {print $2}'" % eth
+            cmd = "/usr/sbin/ethtool -i %s | awk '/bus-info/ {print $2}'" % eth
             pci_id = utils.system_output(cmd)
             if not pci_id:
                 continue
@@ -956,7 +956,7 @@
             if d_type == "vf":
                 dev_id = vf_ids.pop(0)
                 (ethname, vf_num) = self.get_vf_num_by_id(dev_id)
-                set_mac_cmd = "ip link set dev %s vf %s mac %s " % (ethname,
+                set_mac_cmd = "sudo /usr/sbin/ip link set dev %s vf %s mac %s " % (ethname,
                                                                     vf_num,
                                                                     device["mac"])
                 utils.run(set_mac_cmd)
@@ -978,7 +978,7 @@
         # FIXME: Need to think out a method of identify which
         # 'virtual function' belongs to which physical card considering
         # that if the host has more than one 82576 card. PCI_ID?
-        cmd = "lspci | grep '%s' | wc -l" % self.vf_filter_re
+        cmd = "/sbin/lspci | grep '%s' | wc -l" % self.vf_filter_re
         vf_num = int(utils.system_output(cmd, verbose=False))
         logging.info("Found %s vf in host", vf_num)
         return vf_num
@@ -1065,7 +1065,7 @@
             status = utils.system('lsmod | grep vfio', ignore_status=True)
             if status:
                 logging.info("Load vfio-pci module.")
-                cmd = "modprobe vfio-pci"
+                cmd = "sudo /sbin/modprobe vfio-pci"
                 utils.run(cmd)
                 time.sleep(3)
             if not ecap or (int(ecap[0], 16) & 8 != 8):
@@ -1079,7 +1079,7 @@
         if status:
             re_probe = True
         elif not self.check_vfs_count():
-            os.system("modprobe -r %s" % self.driver)
+            os.system("sudo /sbin/modprobe -r %s" % self.driver)
             re_probe = True
         else:
             self.setup = None
@@ -1087,7 +1087,7 @@
 
         # Re-probe driver with proper number of VFs
         if re_probe:
-            cmd = "modprobe %s %s" % (self.driver, self.driver_option)
+            cmd = "sudo /sbin/modprobe %s %s" % (self.driver, self.driver_option)
             error.context("Loading the driver '%s' with command '%s'" %
                           (self.driver, cmd), logging.info)
             status = utils.system(cmd, ignore_status=True)
@@ -1096,7 +1096,7 @@
             logging.info("Log dmesg after loading '%s' to '%s'.", self.driver,
                          file_name)
             utils_misc.log_line(file_name, dmesg)
-            utils.system("/etc/init.d/network restart", ignore_status=True)
+            utils.system("sudo /usr/sbin/service network restart", ignore_status=True)
             if status:
                 return False
             self.setup = None
@@ -1130,7 +1130,7 @@
         status = utils.system('lsmod | grep %s' % self.driver,
                               ignore_status=True)
         if status:
-            cmd = "modprobe -r %s" % self.driver
+            cmd = "sudo /sbin/modprobe -r %s" % self.driver
             logging.info("Running host command: %s" % cmd)
             os.system(cmd)
             re_probe = True
@@ -1139,11 +1139,11 @@
 
         # Re-probe driver with proper number of VFs
         if re_probe:
-            cmd = "modprobe %s" % self.driver
+            cmd = "sudo /sbin/modprobe %s" % self.driver
             msg = "Loading the driver '%s' without option" % self.driver
             error.context(msg, logging.info)
             status = utils.system(cmd, ignore_status=True)
-            utils.system("/etc/init.d/network restart", ignore_status=True)
+            utils.system("sudo /usr/sbin/service restart", ignore_status=True)
             if status:
                 return False
             return True
diff -rau virttest/utils_misc.py virttest.sudo/utils_misc.py
--- virttest/utils_misc.py	2014-03-07 12:29:47.551705285 +0100
+++ virttest.sudo/utils_misc.py	2014-03-13 14:46:58.499920129 +0100
@@ -2162,11 +2162,11 @@
 
     def load_ksm_module(self):
         """Try to load ksm module."""
-        utils.system("modprobe ksm")
+        utils.system("sudo /sbin/modprobe ksm")
 
     def unload_ksm_module(self):
         """Try to unload ksm module."""
-        utils.system("modprobe -r ksm")
+        utils.system("sudo /sbin/modprobe -r ksm")
 
     def get_ksmtuned_pid(self):
         """
openSUSE Build Service is sponsored by