Change in vdsm[master]: virt: fixes for pep8 1.6.x

fromani at redhat.com fromani at redhat.com
Wed Apr 13 12:50:55 UTC 2016


Francesco Romani has uploaded a new change for review.

Change subject: virt: fixes for pep8 1.6.x
......................................................................

virt: fixes for pep8 1.6.x

pep8 1.6.x added another round of strict checks.
This patch reformats the code to adhere to the standards.
There are no intended changes in behaviour

Change-Id: I5e06319d0be2cc927ecd3f2bf15f0688bdac11dc
Format-Only: yes
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/virt/vm.py
M vdsm/virt/vmdevices/storage.py
M vdsm/virt/vmtune.py
3 files changed, 19 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/56084/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index b4f4cc8..495c32c 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2582,9 +2582,8 @@
 
     def _findDeviceByNameOrPath(self, device_name, device_path):
         for device in self._devices[hwclass.DISK]:
-            if ((device.name == device_name
-                or ("path" in device and device["path"] == device_path))
-                    and isVdsmImage(device)):
+            if (isVdsmImage(device) and (device.name == device_name or
+               ("path" in device and device["path"] == device_path))):
                 return device
         else:
             return None
@@ -3468,8 +3467,8 @@
         # Looking for the replication blockJob info (checking its presence)
         blkJobInfo = self._dom.blockJobInfo(drive.name, 0)
 
-        if (not isinstance(blkJobInfo, dict)
-                or 'cur' not in blkJobInfo or 'end' not in blkJobInfo):
+        if (not isinstance(blkJobInfo, dict) or
+           'cur' not in blkJobInfo or 'end' not in blkJobInfo):
             self.log.error("Replication job not found for disk %s (%s)",
                            drive.name, srcDisk)
 
@@ -4648,9 +4647,9 @@
                       reason)
 
     def _setUnresponsiveIfTimeout(self, stats, statsAge):
-        if (not self.isMigrating()
-                and statsAge > config.getint('vars', 'vm_command_timeout')
-                and stats['monitorResponse'] != '-1'):
+        if (not self.isMigrating() and
+           statsAge > config.getint('vars', 'vm_command_timeout') and
+           stats['monitorResponse'] != '-1'):
             self.log.warning('monitor become unresponsive'
                              ' (command timeout, age=%s)',
                              statsAge)
diff --git a/vdsm/virt/vmdevices/storage.py b/vdsm/virt/vmdevices/storage.py
index 8a0f7fc..824dc7c 100644
--- a/vdsm/virt/vmdevices/storage.py
+++ b/vdsm/virt/vmdevices/storage.py
@@ -109,8 +109,8 @@
                 # verify that the cached path is the one used in libvirt.
                 # We already hit few times the problem that after a live
                 # migration the paths were not in sync anymore (BZ#1059482).
-                if (hasattr(d, 'alias') and d.alias == alias
-                        and d.path != devPath):
+                if (hasattr(d, 'alias') and d.alias == alias and
+                   d.path != devPath):
                     vm.log.warning('updating drive %s path from %s to %s',
                                    d.alias, d.path, devPath)
                     d.path = devPath
@@ -129,8 +129,8 @@
             for dev in vm.conf['devices']:
                 # See comment in previous loop. This part is used to update
                 # the vm configuration as well.
-                if ('alias' in dev and dev['alias'] == alias
-                        and dev['path'] != devPath):
+                if ('alias' in dev and dev['alias'] == alias and
+                   dev['path'] != devPath):
                     vm.log.warning('updating drive %s config path from %s '
                                    'to %s', dev['alias'], dev['path'],
                                    devPath)
diff --git a/vdsm/virt/vmtune.py b/vdsm/virt/vmtune.py
index a6effcd..8f6e94c 100644
--- a/vdsm/virt/vmtune.py
+++ b/vdsm/virt/vmtune.py
@@ -196,12 +196,12 @@
 
     for limit_object in tunables:
         old_tune = None
-        if ("name" in limit_object
-                and limit_object["name"] in ioTuneByName):
+        if ("name" in limit_object and
+           limit_object["name"] in ioTuneByName):
             old_tune = ioTuneByName[limit_object["name"]]
             ioTune.removeChild(old_tune)
-        elif ("path" in limit_object
-                and limit_object["path"] in ioTuneByPath):
+        elif ("path" in limit_object and
+              limit_object["path"] in ioTuneByPath):
             old_tune = ioTuneByPath[limit_object["path"]]
             ioTune.removeChild(old_tune)
 
@@ -215,12 +215,12 @@
 
         # Make sure everything is OK when the same name is passed
         # twice by updating the index
-        if ("name" in limit_object
-                and limit_object["name"] in ioTuneByName):
+        if ("name" in limit_object and
+           limit_object["name"] in ioTuneByName):
             ioTuneByName[limit_object["name"]] = new_tune
 
-        if ("path" in limit_object
-                and limit_object["path"] in ioTuneByPath):
+        if ("path" in limit_object and
+           limit_object["path"] in ioTuneByPath):
             ioTuneByPath[limit_object["path"]] = new_tune
 
     return count


-- 
To view, visit https://gerrit.ovirt.org/56084
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5e06319d0be2cc927ecd3f2bf15f0688bdac11dc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list