[test-API PATCH] remove original 'util' object in testcases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 repos/domain/cpu_affinity.py    |    4 ++--
 repos/domain/cpu_topology.py    |    8 ++++----
 repos/domain/ownership_test.py  |   12 ++++++------
 repos/domain/restore.py         |    8 ++++----
 repos/domain/save.py            |   10 +++++-----
 repos/libvirtd/qemu_hang.py     |   12 ++++++------
 repos/libvirtd/restart.py       |   12 ++++++------
 repos/libvirtd/upstart.py       |    6 +++---
 repos/network/network_list.py   |   12 ++++++------
 repos/remoteAccess/tcp_setup.py |    8 ++++----
 repos/remoteAccess/tls_setup.py |   28 ++++++++++++++--------------
 repos/sVirt/domain_nfs_start.py |    8 ++++----
 12 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/repos/domain/cpu_affinity.py b/repos/domain/cpu_affinity.py
index 8b65e2f..ee585e6 100644
--- a/repos/domain/cpu_affinity.py
+++ b/repos/domain/cpu_affinity.py
@@ -38,7 +38,7 @@ def redefine_vcpu_number(domobj, domain_name, vcpu):
 
     return doc.toxml()
 
-def set_vcpus(util, domobj, domain_name, vcpu):
+def set_vcpus(domobj, domain_name, vcpu):
     """set the value of virtual machine to vcpu offline , then boot up
        the virtual machine
     """
@@ -225,7 +225,7 @@ def cpu_affinity(params):
 
     if vcpunum != vcpu:
         logger.info("set the vcpu of the guest to %s" % vcpu)
-        ret = set_vcpus(util, domobj, domain_name, vcpu)
+        ret = set_vcpus(domobj, domain_name, vcpu)
         if ret != 0:
             return 1
 
diff --git a/repos/domain/cpu_topology.py b/repos/domain/cpu_topology.py
index 120273a..f0f081c 100644
--- a/repos/domain/cpu_topology.py
+++ b/repos/domain/cpu_topology.py
@@ -86,7 +86,7 @@ def guest_define(domobj, domxml, logger):
 
     return 0
 
-def guest_start(domobj, guestname, util, logger):
+def guest_start(domobj, guestname, logger):
     """start guest"""
     timeout = 600
     ip = ''
@@ -121,7 +121,7 @@ def guest_start(domobj, guestname, util, logger):
     return 0, ip
 
 def cpu_topology_check(ip, username, password,
-                       sockets, cores, threads, util, logger):
+                       sockets, cores, threads, logger):
     """login the guest, run lscpu command to check the result"""
     lscpu = "lscpu"
     # sleep for 5 seconds
@@ -190,12 +190,12 @@ def cpu_topology(params):
     if guest_define(domobj, domxml, logger):
         return 1
 
-    ret, ip = guest_start(domobj, guestname, util, logger)
+    ret, ip = guest_start(domobj, guestname, logger)
     if ret:
         return 1
 
     if cpu_topology_check(ip, username, password,
-                          sockets, cores, threads, util, logger):
+                          sockets, cores, threads, logger):
        return 1
 
     return 0
diff --git a/repos/domain/ownership_test.py b/repos/domain/ownership_test.py
index acb56c1..b479708 100644
--- a/repos/domain/ownership_test.py
+++ b/repos/domain/ownership_test.py
@@ -35,7 +35,7 @@ def check_domain_running(conn, guestname, logger):
     else:
         return 0
 
-def nfs_setup(util, logger):
+def nfs_setup(logger):
     """setup nfs on localhost
     """
     logger.info("set nfs service")
@@ -57,7 +57,7 @@ def nfs_setup(util, logger):
 
     return 0
 
-def chown_file(util, filepath, logger):
+def chown_file(filepath, logger):
     """touch a file and setting the chown
     """
     if os.path.exists(filepath):
@@ -87,7 +87,7 @@ def chown_file(util, filepath, logger):
 
     return 0
 
-def prepare_env(util, dynamic_ownership, use_nfs, logger):
+def prepare_env(dynamic_ownership, use_nfs, logger):
     """configure dynamic_ownership in /etc/libvirt/qemu.conf,
        set chown of the file to save
     """
@@ -126,12 +126,12 @@ def prepare_env(util, dynamic_ownership, use_nfs, logger):
         logger.error("wrong use_nfs value")
         return 1
 
-    ret = chown_file(util, filepath, logger)
+    ret = chown_file(filepath, logger)
     if ret:
         return 1
 
     if use_nfs == 'enable':
-        ret = nfs_setup(util, logger)
+        ret = nfs_setup(logger)
         if ret:
             return 1
 
@@ -175,7 +175,7 @@ def ownership_test(params):
 
     # set env
     logger.info("prepare the environment")
-    ret = prepare_env(util, dynamic_ownership, use_nfs, logger)
+    ret = prepare_env(dynamic_ownership, use_nfs, logger)
     if ret:
         logger.error("failed to prepare the environment")
         return 1
diff --git a/repos/domain/restore.py b/repos/domain/restore.py
index 4ac68be..3a1a5a9 100644
--- a/repos/domain/restore.py
+++ b/repos/domain/restore.py
@@ -16,7 +16,7 @@ optional_params = {}
 
 def get_guest_ipaddr(*args):
     """Get guest ip address"""
-    (guestname, util, logger) = args
+    (guestname, logger) = args
 
     mac = utils.get_dom_mac_addr(guestname)
     logger.debug("guest mac address: %s" % mac)
@@ -47,10 +47,10 @@ def check_guest_restore(*args):
     """Check restore domain result, if restore domain is successful,
        guest status will not be paused and can be ping
     """
-    (guestname, domobj, util, logger) = args
+    (guestname, domobj, logger) = args
 
     if check_guest_status(domobj, logger):
-        if get_guest_ipaddr(guestname, util, logger):
+        if get_guest_ipaddr(guestname, logger):
             return True
         else:
             return False
@@ -73,7 +73,7 @@ def restore(params):
 
     try:
         conn.restore(filepath)
-        if check_guest_restore(guestname, domobj, util, logger):
+        if check_guest_restore(guestname, domobj, logger):
             logger.info("restore %s domain successful" % guestname)
         else:
             logger.error("Error: fail to check restore domain")
diff --git a/repos/domain/save.py b/repos/domain/save.py
index 677adb4..236420d 100644
--- a/repos/domain/save.py
+++ b/repos/domain/save.py
@@ -16,7 +16,7 @@ optional_params = {}
 
 def get_guest_ipaddr(*args):
     """Get guest ip address"""
-    (guestname, util, logger) = args
+    (guestname, logger) = args
 
     mac = utils.get_dom_mac_addr(guestname)
     logger.debug("guest mac address: %s" %mac)
@@ -50,10 +50,10 @@ def check_guest_save(*args):
        guestname.save will exist under /tmp directory and guest
        can't be ping and status is paused
     """
-    (guestname, domobj, util, logger) = args
+    (guestname, domobj, logger) = args
 
     if not check_guest_status(domobj, logger):
-        if not get_guest_ipaddr(guestname, util, logger):
+        if not get_guest_ipaddr(guestname, logger):
             return True
         else:
             return False
@@ -70,7 +70,7 @@ def save(params):
     domobj = conn.lookupByName(guestname)
 
     # Save domain
-    ipaddr = get_guest_ipaddr(guestname, util, logger)
+    ipaddr = get_guest_ipaddr(guestname, logger)
 
     if not check_guest_status(domobj, logger):
         logger.error("Error: current guest status is shutoff")
@@ -82,7 +82,7 @@ def save(params):
 
     try:
         domobj.save(filepath)
-        if check_guest_save(guestname, domobj, util, logger):
+        if check_guest_save(guestname, domobj, logger):
             logger.info("save %s domain successful" %guestname)
         else:
             logger.error("Error: fail to check save domain")
diff --git a/repos/libvirtd/qemu_hang.py b/repos/libvirtd/qemu_hang.py
index 894949c..7a58f50 100644
--- a/repos/libvirtd/qemu_hang.py
+++ b/repos/libvirtd/qemu_hang.py
@@ -33,7 +33,7 @@ def check_domain_running(conn, guestname, logger):
     else:
         return 0
 
-def libvirtd_check(util, logger):
+def libvirtd_check(logger):
     """check libvirtd status
     """
     cmd = "service libvirtd status"
@@ -55,7 +55,7 @@ def libvirtd_check(util, logger):
 
     return 0
 
-def get_domain_pid(util, logger, guestname):
+def get_domain_pid(logger, guestname):
     """get the pid of running domain"""
     logger.info("get the pid of running domain %s"  % guestname)
     get_pid_cmd = "cat /var/run/libvirt/qemu/%s.pid" % guestname
@@ -82,11 +82,11 @@ def qemu_hang(params):
         return 1
 
     logger.info("check the libvirtd status:")
-    ret = libvirtd_check(util, logger)
+    ret = libvirtd_check(logger)
     if ret:
         return 1
 
-    ret, pid = get_domain_pid(util, logger, guestname)
+    ret, pid = get_domain_pid(logger, guestname)
     if ret:
         return 1
 
@@ -98,7 +98,7 @@ def qemu_hang(params):
         return 1
 
     logger.info("recheck libvirtd status:")
-    ret = libvirtd_check(util, logger)
+    ret = libvirtd_check(logger)
     if ret:
         return 1
 
@@ -109,7 +109,7 @@ def qemu_hang_clean(params):
     logger = params['logger']
     guestname = params['guestname']
 
-    ret = get_domain_pid(util, logger, guestname)
+    ret = get_domain_pid(logger, guestname)
     cmd = "kill -CONT %s" % ret[1]
     ret = utils.exec_cmd(cmd, shell=True)
     if ret[0]:
diff --git a/repos/libvirtd/restart.py b/repos/libvirtd/restart.py
index c095fc7..803fa2e 100644
--- a/repos/libvirtd/restart.py
+++ b/repos/libvirtd/restart.py
@@ -33,7 +33,7 @@ def check_domain_running(conn, guestname, logger):
     else:
         return 0
 
-def libvirtd_check(util, logger):
+def libvirtd_check(logger):
     """check libvirtd status
     """
     cmd = "service libvirtd status"
@@ -55,7 +55,7 @@ def libvirtd_check(util, logger):
 
     return 0
 
-def get_domain_pid(util, logger, guestname):
+def get_domain_pid(logger, guestname):
     """get the pid of running domain"""
     logger.info("get the pid of running domain %s"  % guestname)
     get_pid_cmd = "cat /var/run/libvirt/qemu/%s.pid" % guestname
@@ -82,7 +82,7 @@ def restart(params):
         return 1
 
     logger.info("check the libvirtd status:")
-    ret = libvirtd_check(util, logger)
+    ret = libvirtd_check(logger)
     if ret:
         return 1
 
@@ -102,7 +102,7 @@ def restart(params):
         logger.error("fail to ping domain %s" % guestname)
         return 1
 
-    ret, pid_before = get_domain_pid(util, logger, guestname)
+    ret, pid_before = get_domain_pid(logger, guestname)
     if ret:
         return 1
 
@@ -118,7 +118,7 @@ def restart(params):
             logger.info(out[i])
 
     logger.info("recheck libvirtd status:")
-    ret = libvirtd_check(util, logger)
+    ret = libvirtd_check(logger)
     if ret:
         return 1
 
@@ -129,7 +129,7 @@ def restart(params):
         logger.error("fail to ping domain %s" % guestname)
         return 1
 
-    ret, pid_after = get_domain_pid(util, logger, guestname)
+    ret, pid_after = get_domain_pid(logger, guestname)
     if ret:
         return 1
 
diff --git a/repos/libvirtd/upstart.py b/repos/libvirtd/upstart.py
index 7746d20..13cb349 100644
--- a/repos/libvirtd/upstart.py
+++ b/repos/libvirtd/upstart.py
@@ -20,7 +20,7 @@ INITCTL_RELOAD_CMD = "initctl reload-configuration"
 SYSTEMCTL_RELOAD_CMD = "systemctl daemon-reload"
 INIT_CONF = "/etc/init/libvirtd.conf"
 
-def libvirtd_check(util, logger):
+def libvirtd_check(logger):
     """check libvirtd status
     """
     cmd = "service libvirtd status"
@@ -133,7 +133,7 @@ def upstart(params):
     time.sleep(5)
 
     logger.info("check the libvirtd status:")
-    ret = libvirtd_check(util, logger)
+    ret = libvirtd_check(logger)
     if ret:
         return 1
 
@@ -149,7 +149,7 @@ def upstart(params):
     time.sleep(5)
 
     logger.info("recheck libvirtd status:")
-    ret = libvirtd_check(util, logger)
+    ret = libvirtd_check(logger)
     if ret:
         return 1
     else:
diff --git a/repos/network/network_list.py b/repos/network/network_list.py
index c04a183..7c34f69 100644
--- a/repos/network/network_list.py
+++ b/repos/network/network_list.py
@@ -47,7 +47,7 @@ def get_output(logger, command, flag):
         logger.error(ret)
     return status, ret
 
-def check_all_option(conn, util, logger):
+def check_all_option(conn, logger):
     """check the output of virsh net-list with --all option
     """
     all_network = []
@@ -73,7 +73,7 @@ def check_all_option(conn, util, logger):
                 return 1
     return 0
 
-def check_inactive_option(conn, util, logger):
+def check_inactive_option(conn, logger):
     """check the output of virsh net-list with --inactive option
     """
     inactive_network = []
@@ -105,7 +105,7 @@ def check_inactive_option(conn, util, logger):
 
     return 0
 
-def check_default_option(conn, util, logger):
+def check_default_option(conn, logger):
     """check the output of virsh net-list
     """
     active_network = []
@@ -158,7 +158,7 @@ def network_list(params):
     for option in option_list:
         if option == ' ':
             logger.info("check the output of virsh net-list")
-            if not check_default_option(conn, util, logger):
+            if not check_default_option(conn, logger):
                 logger.info("virsh net-list checking succeeded")
                 execute_virsh_netlist(option, logger)
             else:
@@ -166,7 +166,7 @@ def network_list(params):
                 return 1
         elif option == '--inactive':
             logger.info("check the output of virsh net-list --inactive")
-            if not check_inactive_option(conn, util, logger):
+            if not check_inactive_option(conn, logger):
                 logger.info("virsh net-list --inactive checking succeeded")
                 execute_virsh_netlist(option, logger)
             else:
@@ -174,7 +174,7 @@ def network_list(params):
                 return 1
         elif option == '--all':
             logger.info("check the output of virsh net-list --all")
-            if not check_all_option(conn, util, logger):
+            if not check_all_option(conn, logger):
                 logger.info("virsh net-list --all checking succeeded")
                 execute_virsh_netlist(option, logger)
             else:
diff --git a/repos/remoteAccess/tcp_setup.py b/repos/remoteAccess/tcp_setup.py
index ec76c84..ddbe333 100644
--- a/repos/remoteAccess/tcp_setup.py
+++ b/repos/remoteAccess/tcp_setup.py
@@ -22,7 +22,7 @@ SASLPASSWD2 = "/usr/sbin/saslpasswd2"
 LIBVIRTD_CONF = "/etc/libvirt/libvirtd.conf"
 SYSCONFIG_LIBVIRTD = "/etc/sysconfig/libvirtd"
 
-def sasl_user_add(target_machine, username, password, util, logger):
+def sasl_user_add(target_machine, username, password, logger):
     """ execute saslpasswd2 to add sasl user """
     logger.info("add sasl user on server side")
     saslpasswd2_add = "echo %s | %s -a libvirt %s" % (password, SASLPASSWD2, username)
@@ -35,7 +35,7 @@ def sasl_user_add(target_machine, username, password, util, logger):
     return 0
 
 def tcp_libvirtd_set(target_machine, username, password,
-                      listen_tcp, auth_tcp, util, logger):
+                      listen_tcp, auth_tcp, logger):
     """ configure libvirtd.conf on libvirt server """
     logger.info("setting libvirtd.conf on libvirt server")
     # open libvirtd --listen option
@@ -156,11 +156,11 @@ def tcp_setup(params):
         return 1
 
     if auth_tcp == 'sasl':
-        if sasl_user_add(target_machine, username, password, util, logger):
+        if sasl_user_add(target_machine, username, password, logger):
             return 1
 
     if tcp_libvirtd_set(target_machine, username, password,
-                         listen_tcp, auth_tcp, util, logger):
+                         listen_tcp, auth_tcp, logger):
         return 1
 
     if listen_tcp == 'disable':
diff --git a/repos/remoteAccess/tls_setup.py b/repos/remoteAccess/tls_setup.py
index 4e7c60d..f8b3cea 100644
--- a/repos/remoteAccess/tls_setup.py
+++ b/repos/remoteAccess/tls_setup.py
@@ -37,7 +37,7 @@ SERVERCERT = os.path.join(TEMP_TLS_FOLDER, 'servercert.pem')
 CLIENTKEY = os.path.join(TEMP_TLS_FOLDER, 'clientkey.pem')
 CLIENTCERT = os.path.join(TEMP_TLS_FOLDER, 'clientcert.pem')
 
-def CA_setting_up(util, logger):
+def CA_setting_up(logger):
     """ setting up a Certificate Authority """
     # Create a private key for CA
     logger.info("generate CA certificates")
@@ -72,7 +72,7 @@ def CA_setting_up(util, logger):
     logger.info("done the CA certificates job")
     return 0
 
-def tls_server_cert(target_machine, util, logger):
+def tls_server_cert(target_machine, logger):
     """ generating server certificates """
     # Create tls server key
     logger.info("generate server certificates")
@@ -114,7 +114,7 @@ def tls_server_cert(target_machine, util, logger):
     logger.info("done the server certificates job")
     return 0
 
-def tls_client_cert(local_machine, util, logger):
+def tls_client_cert(local_machine, logger):
     """ generating client certificates """
     # Create tls client key
     logger.info("generate client certificates")
@@ -160,7 +160,7 @@ def tls_client_cert(local_machine, util, logger):
     logger.info("done the client certificates job")
     return 0
 
-def deliver_cert(target_machine, username, password, pkipath, util, logger):
+def deliver_cert(target_machine, username, password, pkipath, logger):
     """ deliver CA, server and client certificates """
     # transmit cacert.pem to remote host
     logger.info("deliver CA, server and client certificates to both local and remote server")
@@ -218,7 +218,7 @@ def deliver_cert(target_machine, username, password, pkipath, util, logger):
     logger.info("done to delivery")
     return 0
 
-def sasl_user_add(target_machine, username, password, util, logger):
+def sasl_user_add(target_machine, username, password, logger):
     """ execute saslpasswd2 to add sasl user """
     logger.info("add sasl user on server side")
     saslpasswd2_add = "echo %s | %s -a libvirt %s" % (password, SASLPASSWD2, username)
@@ -231,7 +231,7 @@ def sasl_user_add(target_machine, username, password, util, logger):
     return 0
 
 def tls_libvirtd_set(target_machine, username, password,
-                     listen_tls, auth_tls, util, logger):
+                     listen_tls, auth_tls, logger):
     """ configure libvirtd.conf on tls server """
     logger.info("setting libvirtd.conf on tls server")
     # open libvirtd --listen option
@@ -272,7 +272,7 @@ def tls_libvirtd_set(target_machine, username, password,
     logger.info("done to libvirtd configuration")
     return 0
 
-def iptables_stop(target_machine, username, password, util, logger):
+def iptables_stop(target_machine, username, password, logger):
     """ This is a temprory method in favor of migration """
     logger.info("stop local and remote iptables temprorily")
     iptables_stop_cmd = "service iptables stop"
@@ -375,28 +375,28 @@ def tls_setup(params):
 
     os.mkdir(TEMP_TLS_FOLDER)
 
-    if iptables_stop(target_machine, username, password, util, logger):
+    if iptables_stop(target_machine, username, password, logger):
         return 1
 
-    if CA_setting_up(util, logger):
+    if CA_setting_up(logger):
         return 1
 
-    if tls_server_cert(target_machine, util, logger):
+    if tls_server_cert(target_machine, logger):
         return 1
 
-    if tls_client_cert(local_machine, util, logger):
+    if tls_client_cert(local_machine, logger):
         return 1
 
     if deliver_cert(target_machine, username,
-                     password, pkipath, util, logger):
+                     password, pkipath, logger):
         return 1
 
     if auth_tls == 'sasl':
-        if sasl_user_add(target_machine, username, password, util, logger):
+        if sasl_user_add(target_machine, username, password, logger):
             return 1
 
     if tls_libvirtd_set(target_machine, username, password,
-                        listen_tls, auth_tls, util, logger):
+                        listen_tls, auth_tls, logger):
         return 1
 
     if listen_tls == 'disable':
diff --git a/repos/sVirt/domain_nfs_start.py b/repos/sVirt/domain_nfs_start.py
index 59cb267..88d349c 100644
--- a/repos/sVirt/domain_nfs_start.py
+++ b/repos/sVirt/domain_nfs_start.py
@@ -25,7 +25,7 @@ optional_params = {}
 
 QEMU_CONF = "/etc/libvirt/qemu.conf"
 
-def nfs_setup(util, root_squash, logger):
+def nfs_setup(root_squash, logger):
     """setup nfs on localhost
     """
     logger.info("set nfs service")
@@ -55,7 +55,7 @@ def nfs_setup(util, root_squash, logger):
 
     return 0
 
-def prepare_env(util, d_ownership, virt_use_nfs, guestname, root_squash, \
+def prepare_env(d_ownership, virt_use_nfs, guestname, root_squash, \
                 disk_file, img_dir, logger):
     """set virt_use_nfs SElinux boolean, configure
        dynamic_ownership in /etc/libvirt/qemu.conf
@@ -105,7 +105,7 @@ def prepare_env(util, d_ownership, virt_use_nfs, guestname, root_squash, \
     copy(disk_file, "/tmp")
 
     logger.info("set up nfs service on localhost")
-    ret = nfs_setup(util, root_squash, logger)
+    ret = nfs_setup(root_squash, logger)
     if ret:
         return 1
 
@@ -165,7 +165,7 @@ def domain_nfs_start(params):
 
     # set env
     logger.info("prepare the environment")
-    ret = prepare_env(util, dynamic_ownership, virt_use_nfs, guestname, \
+    ret = prepare_env(dynamic_ownership, virt_use_nfs, guestname, \
                       root_squash, disk_file, img_dir, logger)
     if ret:
         logger.error("failed to prepare the environment")
-- 
1.7.7.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]