diff --git a/virttest/kernel_interface.py b/virttest/kernel_interface.py
index b290a7cd10..f3ad5a0c89 100644
--- a/virttest/kernel_interface.py
+++ b/virttest/kernel_interface.py
@@ -9,6 +9,7 @@ class FS(object):
"""
Base class for proc/sys FS set and get
"""
+
def __init__(self, fs, session=None):
"""
Initializes path, session and func to trigger cmd
@@ -116,6 +117,7 @@ class to get or set sysfs values in host, remote host or in VM
>>> obj.sys_fs_value # To get the value
>>> obj.sys_fs_value = "never" # To set the value
"""
+
def __init__(self, sys_fs, session=None, regex=r"\[%s\]"):
"""
Initializes path, session and func to trigger cmd
diff --git a/virttest/libvirt_xml/vm_xml.py b/virttest/libvirt_xml/vm_xml.py
index 4df07d31c4..267866bf19 100755
--- a/virttest/libvirt_xml/vm_xml.py
+++ b/virttest/libvirt_xml/vm_xml.py
@@ -1487,7 +1487,7 @@ def set_graphics_attr(vm_name, attr, index=0, virsh_instance=base.virsh):
:param virsh_instance: virsh instance
"""
vmxml = VMXML.new_from_inactive_dumpxml(
- vm_name, virsh_instance=virsh_instance)
+ vm_name, virsh_instance=virsh_instance)
graphic = vmxml.xmltreefile.find('devices').findall('graphics')
for key in attr:
logging.debug("Set %s='%s'" % (key, attr[key]))
@@ -3524,6 +3524,7 @@ class VMKeywrapXML(base.LibvirtXMLBase):
kw.set_cipher("aes", "off")
vmxml.set_keywrap(kw)
"""
+
def __init__(self, virsh_instance=base.virsh):
super(VMKeywrapXML, self).__init__(virsh_instance=virsh_instance)
self.xml = ''
diff --git a/virttest/qemu_devices/qcontainer.py b/virttest/qemu_devices/qcontainer.py
index c96a3b2aa2..b83bc69d16 100644
--- a/virttest/qemu_devices/qcontainer.py
+++ b/virttest/qemu_devices/qcontainer.py
@@ -1874,9 +1874,9 @@ def define_hbas(qtype, atype, bus, unit, port, qbus, pci_bus, iothread,
peers.append({'host': peer['host'],
'type': peer.get('type', 'inet'),
'port': '%s' % peer.get('port', '0')})
- gluster_peers.update({'server.{i}.{k}'.format(i=i+1, k=k): v
- for i, server in enumerate(peers)
- for k, v in six.iteritems(server)})
+ gluster_peers.update({'server.{i}.{k}'.format(i=i + 1, k=k): v
+ for i, server in enumerate(peers)
+ for k, v in six.iteritems(server)})
elif access.storage_type == 'nbd':
reconnect_delay = access.reconnect_delay
elif access.storage_type == 'curl':
diff --git a/virttest/qemu_devices/qdevices.py b/virttest/qemu_devices/qdevices.py
index de1142ed25..4dcdc21b25 100644
--- a/virttest/qemu_devices/qdevices.py
+++ b/virttest/qemu_devices/qdevices.py
@@ -811,6 +811,7 @@ def get_qid(self):
class QBlockdevFormatNode(QBlockdevNode):
""" New a format type blockdev node. """
+
def __init__(self, aobject):
child_bus = QDriveBus('drive_%s' % aobject, aobject)
super(QBlockdevFormatNode, self).__init__(aobject, child_bus)
@@ -867,6 +868,7 @@ class QBlockdevFormatLuks(QBlockdevFormatNode):
class QBlockdevProtocol(QBlockdevNode):
""" New a protocol blockdev node. """
+
def __init__(self, aobject):
super(QBlockdevProtocol, self).__init__(aobject, None, False)
@@ -1778,7 +1780,7 @@ def start_daemon(self):
self._daemon_process = aexpect.run_bg(cmd, **run_bg_kwargs)
if status_active:
self._daemon_process.read_until_any_line_matches(
- status_active, timeout=read_until_timeout)
+ status_active, timeout=read_until_timeout)
else:
time.sleep(start_until_timeout)
logging.info("Created %s daemon process with parent PID %d.",
@@ -1841,6 +1843,7 @@ class QVirtioFSDev(QDaemonDev):
"""
Virtiofs pseudo device.
"""
+
def __init__(self, aobject, binary, sock_path, source, extra_options=None):
"""
:param aobject: The aobject of virtiofs daemon.
@@ -1895,6 +1898,7 @@ class QSwtpmDev(QDaemonDev):
"""
Virtual swtpm pseudo device.
"""
+
def __init__(self, aobject, binary, sock_path, storage_path,
version=None, extra_options=None):
"""
diff --git a/virttest/qemu_monitor.py b/virttest/qemu_monitor.py
index 3f910bc491..c827ea5b65 100644
--- a/virttest/qemu_monitor.py
+++ b/virttest/qemu_monitor.py
@@ -1694,7 +1694,7 @@ def netdev_add(self, backend, name, **kwargs):
"""
kwargs = self._build_args(**kwargs)
extra_args = "".join([",%s=%s" % (k, v if not isinstance(v, bool) else
- "on" if v else "off") for k, v in kwargs.items()])
+ "on" if v else "off") for k, v in kwargs.items()])
netdev_cmd = "netdev_add type=%s,id=%s%s" % (backend, name, extra_args)
return self.cmd(netdev_cmd)
diff --git a/virttest/qemu_storage.py b/virttest/qemu_storage.py
index cc346e0449..de309528dc 100755
--- a/virttest/qemu_storage.py
+++ b/virttest/qemu_storage.py
@@ -96,8 +96,8 @@ def filename_to_file_opts(filename):
'volume': matches.group('volume'),
'path': matches.group('path')}
file_opts.update({'server.{i}.{k}'.format(i=i, k=k): v
- for i, server in enumerate(servers)
- for k, v in six.iteritems(server)})
+ for i, server in enumerate(servers)
+ for k, v in six.iteritems(server)})
elif re.match(r'nbd(\+\w+)?://', filename):
filename_pattern = re.compile(
r'nbd(\+(?:.+))?://((?P[^/:?]+)(:(?P\d+))?)?'
@@ -113,7 +113,7 @@ def filename_to_file_opts(filename):
if host:
# 10890 is the default port for tcp connection
port = matches.group('port') if matches.group(
- 'port') else '10809'
+ 'port') else '10809'
server = {'server.type': 'inet',
'server.host': host,
'server.port': port}
@@ -245,9 +245,9 @@ def _get_image_meta(image, params, root_dir):
peers.append({'host': peer['host'],
'type': peer.get('type', 'inet'),
'port': '%s' % peer.get('port', '0')})
- meta['file'].update({'server.{i}.{k}'.format(i=i+1, k=k): v
- for i, server in enumerate(peers)
- for k, v in six.iteritems(server)})
+ meta['file'].update({'server.{i}.{k}'.format(i=i + 1, k=k): v
+ for i, server in enumerate(peers)
+ for k, v in six.iteritems(server)})
elif auth_info.storage_type == 'nbd':
# qemu-img, as a client, accesses nbd storage
if auth_info.tls_creds:
@@ -312,7 +312,7 @@ def get_image_repr(image, params, root_dir, representation=None):
func = mapping.get(representation, None)
if func is None:
image_secret = storage.ImageSecret.image_secret_define_by_params(
- image, params)
+ image, params)
access_needed = False
auth_info = storage.StorageAuth.auth_info_define_by_params(image,
@@ -418,7 +418,7 @@ class QemuImg(storage.QemuImg):
"commit_drop": "-d",
"compare_strict_mode": "-s",
"compare_second_image_format": "-F"
- }
+ }
create_cmd = ("create {secret_object} {tls_creds_object} {image_format} "
"{backing_file} {backing_format} {unsafe!b} {options} "
"{image_filename} {image_size}")
@@ -1526,7 +1526,7 @@ def resize(self, size, shrink=False, preallocation=None):
"resize_preallocation": preallocation,
"image_filename": self.image_filename,
"image_size": size,
- }
+ }
if self.encryption_config.key_secret:
cmd_dict["image_filename"] = "'%s'" % get_image_json(
self.tag, self.params, self.root_dir)
@@ -1574,7 +1574,7 @@ def measure(self, target_fmt, size=None, output="human"):
target_image_params["image_format"] = "luks"
target_image_params["image_secret"] = target_image_secret
target_image_object = QemuImg(
- target_image_params, self.root_dir, target_image)
+ target_image_params, self.root_dir, target_image)
cmd_list.append(target_image_object._secret_objects[-1])
cmd_list.append('-o key-secret=%s' %
target_image_object.encryption_config.key_secret.aid)
@@ -1590,7 +1590,7 @@ def measure(self, target_fmt, size=None, output="human"):
cmd_list.append("'%s'" % image_json_str)
else:
cmd_list.extend([("-f %s" % self.image_format),
- self.image_filename])
+ self.image_filename])
cmd_result = process.run(" ".join(cmd_list), ignore_status=True)
return cmd_result
diff --git a/virttest/remote.py b/virttest/remote.py
index a99ef33d29..47e352957b 100644
--- a/virttest/remote.py
+++ b/virttest/remote.py
@@ -612,7 +612,7 @@ def __init__(self, params):
self.vm_user = params.get("vm_user", 'root')
self.port = params.get("port", 22)
if not all([self.remote_host, self.remote_user, self.remote_pwd,
- self.vm_ip, self.vm_pwd]):
+ self.vm_ip, self.vm_pwd]):
raise exceptions.TestError("At least one of [remote_host|"
"remote_user|remote_pwd|vm_ip|"
"vm_pwd] is invalid!")
diff --git a/virttest/remote_commander/remote_interface.py b/virttest/remote_commander/remote_interface.py
index df47c840cd..77fc3cc2d2 100644
--- a/virttest/remote_commander/remote_interface.py
+++ b/virttest/remote_commander/remote_interface.py
@@ -132,6 +132,7 @@ def __setstate__(self, state):
class CmdQuery(object):
"""Command-msg-request from VM to avocado-vt test.
"""
+
def __init__(self, *args, **kargs):
"""
Command for asking from VM to avocado-vt.
@@ -146,6 +147,7 @@ def __init__(self, *args, **kargs):
class CmdRespond(object):
"""Command-msg-answer from avocado-test to VM.
"""
+
def __init__(self, respond):
"""
Command for answering avocado-vt to VM.
diff --git a/virttest/staging/service.py b/virttest/staging/service.py
index 6d5687ad1d..a28e12e074 100644
--- a/virttest/staging/service.py
+++ b/virttest/staging/service.py
@@ -897,6 +897,7 @@ class Service(object):
"""
class to handle service operations in Remote machine/Guest
"""
+
def __init__(self, service_name, session=None, timeout=120):
"""
Initialize the service return Factory object if session is None
diff --git a/virttest/storage.py b/virttest/storage.py
index 5794098625..16e12adefd 100644
--- a/virttest/storage.py
+++ b/virttest/storage.py
@@ -344,7 +344,7 @@ def get_iso_filename(cdrom_params, root_dir, basename=False):
iso = cdrom_params.get("cdrom")
if iso:
iso = os.path.basename(iso) if basename else utils_misc.get_path(
- root_dir, iso)
+ root_dir, iso)
return iso
@@ -568,6 +568,7 @@ class ImageAccessInfo(object):
Access info to the logical image, which can include the network
storage image only, or the image and its backing images.
"""
+
def __init__(self, image, image_auth, image_backing_auth):
"""
:param image: image tag name
@@ -613,7 +614,7 @@ def retrieve_access_info(image, params):
for img in images:
auth = StorageAuth.auth_info_define_by_params(
- img, params.object_params(img))
+ img, params.object_params(img))
if auth is not None:
access_info[img] = auth
@@ -801,7 +802,7 @@ def __init__(self, params, root_dir, tag):
self.snapshot_format = ss_params.get("image_format")
self.image_access = ImageAccessInfo.access_info_define_by_params(
- self.tag, self.params)
+ self.tag, self.params)
self.data_file = self.external_data_file_defined_by_params(
params, root_dir, tag)
diff --git a/virttest/test_setup.py b/virttest/test_setup.py
index af79ae648b..30f6087b19 100644
--- a/virttest/test_setup.py
+++ b/virttest/test_setup.py
@@ -818,7 +818,7 @@ def __init__(self, params=None):
if self.physical_nic.split(':', 1)[0] == "shell":
self.physical_nic = process.run(
self.physical_nic.split(':', 1)[1], shell=True
- ).stdout_text.strip()
+ ).stdout_text.strip()
if self.physical_nic not in utils_net.get_host_iface():
raise exceptions.TestSetupFail("Physical network '%s'"
"does not exist" %
@@ -1538,7 +1538,7 @@ def set_linkvf_ib(self):
logging.info("The key %s corresponds to %s", key, pids[key])
for subkey in pids[key].keys():
status = process.system("echo %s > %s" % (pids[key][subkey],
- os.path.join(key, subkey)), shell=True)
+ os.path.join(key, subkey)), shell=True)
if status != 0:
return False
return True
diff --git a/virttest/utils_iptables.py b/virttest/utils_iptables.py
index 7802e97d0d..bbf1fd063c 100644
--- a/virttest/utils_iptables.py
+++ b/virttest/utils_iptables.py
@@ -89,6 +89,7 @@ class Firewall_cmd(object):
"""
class handles firewall-cmd methods
"""
+
def __init__(self, session=None):
"""
initialises the firewall cmd objects
diff --git a/virttest/utils_libvirt/libvirt_keywrap.py b/virttest/utils_libvirt/libvirt_keywrap.py
index bab4194903..ac56a1a828 100644
--- a/virttest/utils_libvirt/libvirt_keywrap.py
+++ b/virttest/utils_libvirt/libvirt_keywrap.py
@@ -11,6 +11,7 @@ class ProtectedKeyHelper(object):
"""
Helper class to test for protected key support on s390x
"""
+
def __init__(self, session=None):
self.session = session
self.sysfs = "/sys/devices/virtual/misc/pkey/protkey"
diff --git a/virttest/utils_misc.py b/virttest/utils_misc.py
index 368759e847..abea047697 100644
--- a/virttest/utils_misc.py
+++ b/virttest/utils_misc.py
@@ -2518,7 +2518,7 @@ def get_winutils_vol(session, label="WIN_UTILS"):
:return: volume ID.
"""
return wait_for(lambda: get_win_disk_vol(session,
- condition="VolumeName='%s'" % label), 240)
+ condition="VolumeName='%s'" % label), 240)
def set_winutils_letter(session, cmd, label="WIN_UTILS"):
diff --git a/virttest/utils_selinux.py b/virttest/utils_selinux.py
index 3835122ca5..971f41aa73 100644
--- a/virttest/utils_selinux.py
+++ b/virttest/utils_selinux.py
@@ -533,7 +533,7 @@ def diff_defcon(pathname, dirdesc=False, selinux_force=False):
:return: List of tuple(pathname, from context, to context)
"""
return _format_changes(_run_restorecon(pathname, dirdesc,
- selinux_force=selinux_force))
+ selinux_force=selinux_force))
def apply_defcon(pathname, dirdesc=False, selinux_force=False):
diff --git a/virttest/utils_split_daemons.py b/virttest/utils_split_daemons.py
index f953acbd25..ea2fa174a5 100644
--- a/virttest/utils_split_daemons.py
+++ b/virttest/utils_split_daemons.py
@@ -414,7 +414,7 @@ def is_modular_daemon(session=None):
"virtstoraged.socket", "virtproxyd.socket"]
if any([service.Factory.create_service(d, run=runner).status()
- for d in daemons]):
+ for d in daemons]):
IS_MODULAR_DAEMON[host_key] = True
else:
IS_MODULAR_DAEMON[host_key] = False
diff --git a/virttest/utils_test/libvirt_domjobinfo.py b/virttest/utils_test/libvirt_domjobinfo.py
index 44b7ccada6..2d7fafcb21 100644
--- a/virttest/utils_test/libvirt_domjobinfo.py
+++ b/virttest/utils_test/libvirt_domjobinfo.py
@@ -36,7 +36,7 @@ def _search_jobinfo(jobinfo, ignore_status=False):
groups = re.findall(r'[0-9.]+', item.strip())
logging.debug("In '%s' search '%s'\n", item, groups[0])
if (math.fabs(float(groups[0]) - float(compare_to_value)) //
- float(compare_to_value) > diff_rate):
+ float(compare_to_value) > diff_rate):
err_msg = ("{} {} has too much difference from "
"{}".format(jobinfo_item,
groups[0],
diff --git a/virttest/utils_test/qemu/migration.py b/virttest/utils_test/qemu/migration.py
index 67fa36b28d..0f227040ed 100644
--- a/virttest/utils_test/qemu/migration.py
+++ b/virttest/utils_test/qemu/migration.py
@@ -1225,7 +1225,6 @@ class MigrationBase(object):
"""Class that provides some general functions for multi-host migration."""
def __setup__(self, test, params, env, srchost, dsthost):
-
"""initialize some public params
"""
@@ -1276,7 +1275,6 @@ def __setup__(self, test, params, env, srchost, dsthost):
@error.context_aware
def run_pre_sub_test(self):
-
"""
run sub test on src before migration
"""
@@ -1293,7 +1291,6 @@ def run_pre_sub_test(self):
@error.context_aware
def run_post_sub_test(self):
-
"""
run sub test on dst after migration
"""
@@ -1306,7 +1303,6 @@ def run_post_sub_test(self):
self.env, self.post_sub_test)
def prepare_vm(self, vm_name):
-
"""
Prepare, start vm and return vm.
:param vm_name: vm name to be started.
@@ -1327,7 +1323,6 @@ def prepare_vm(self, vm_name):
return vm
def start_worker(self):
-
"""
run background command on src before migration
"""
@@ -1344,7 +1339,6 @@ def start_worker(self):
time.sleep(5)
def check_worker(self):
-
"""
check background command on dst after migration
"""
@@ -1368,7 +1362,6 @@ def check_worker(self):
def ping_pong_migrate(self, mig_type, sync, start_work=None,
check_work=None):
-
"""
ping pong migration test
@@ -1389,7 +1382,7 @@ def ping_pong_migrate(self, mig_type, sync, start_work=None,
vm = self.env.get_vm(self.params["main_vm"])
if vm.is_dead():
self.stop_migrate = True
- elif self.migrate_count-1 == 0:
+ elif self.migrate_count - 1 == 0:
self.stop_migrate = True
else:
self.dsthost, self.srchost = self.srchost, self.dsthost
@@ -1398,7 +1391,6 @@ def ping_pong_migrate(self, mig_type, sync, start_work=None,
@error.context_aware
def get_migration_info(self, vm):
-
"""
get info after migration, focus on if keys in returned disc.
@@ -1421,7 +1413,6 @@ def get_migration_info(self, vm):
@error.context_aware
def get_migration_capability(self, index=0):
-
"""
Get the state of migrate-capability.
@@ -1445,7 +1436,6 @@ def get_migration_capability(self, index=0):
@error.context_aware
def set_migration_capability(self, state, capability):
-
"""
Set the capability of migrate to state.
@@ -1461,7 +1451,6 @@ def set_migration_capability(self, state, capability):
@error.context_aware
def get_migration_cache_size(self, index=0):
-
"""
Get the xbzrle cache size.
@@ -1481,7 +1470,6 @@ def get_migration_cache_size(self, index=0):
@error.context_aware
def set_migration_cache_size(self, value):
-
"""
Set the cache size of migrate to value.
@@ -1495,7 +1483,6 @@ def set_migration_cache_size(self, value):
@error.context_aware
def get_migration_parameter(self, index=0):
-
"""
Get the value of parameter.
@@ -1519,7 +1506,6 @@ def get_migration_parameter(self, index=0):
@error.context_aware
def set_migration_parameter(self, index=0):
-
"""
Set the value of parameter.
@@ -1537,7 +1523,6 @@ def set_migration_parameter(self, index=0):
@error.context_aware
def set_migration_speed(self, value):
-
"""
Set maximum speed (in bytes/sec) for migrations.
@@ -1551,7 +1536,6 @@ def set_migration_speed(self, value):
@error.context_aware
def set_migration_downtime(self, value):
-
"""
Set maximum tolerated downtime (in seconds) for migration.
@@ -1565,7 +1549,6 @@ def set_migration_downtime(self, value):
@error.context_aware
def set_migration_cancel(self):
-
"""
Cancel migration after it is beginning
"""
@@ -1577,7 +1560,6 @@ def set_migration_cancel(self):
@error.context_aware
def get_migration_cancelled(self):
-
"""
check the migration cancelled
"""
@@ -1594,7 +1576,6 @@ def get_migration_cancelled(self):
@error.context_aware
def clean_up(self, kill_bg_cmd, vm):
-
"""
kill background cmd on dst after migration
@@ -1626,7 +1607,6 @@ def clean_up(self, kill_bg_cmd, vm):
@error.context_aware
def start_stress(self):
-
"""
start stress test on src before migration
"""
@@ -1652,7 +1632,6 @@ def check_running():
@error.context_aware
def install_stressapptest(self):
-
"""
install stressapptest
"""
diff --git a/virttest/utils_windows/drive.py b/virttest/utils_windows/drive.py
index 09e39bb364..b3f3d049d0 100644
--- a/virttest/utils_windows/drive.py
+++ b/virttest/utils_windows/drive.py
@@ -10,7 +10,7 @@ def _logical_disks(session, cond=None, props=None):
cmd = wmic.make_query("LogicalDisk", cond, props,
get_swch=wmic.FMT_TYPE_LIST)
out = utils_misc.wait_for(lambda: wmic.parse_list(session.cmd(cmd,
- timeout=120)), 240)
+ timeout=120)), 240)
return out if out else []