Change in vdsm[master]: pep8: hooks cleanups for pep-1.5.x

fromani at redhat.com fromani at redhat.com
Thu Apr 3 08:53:07 UTC 2014


Francesco Romani has uploaded a new change for review.

Change subject: pep8: hooks cleanups for pep-1.5.x
......................................................................

pep8: hooks cleanups for pep-1.5.x

hooks/* is now pep8 1.5.x clean.

Change-Id: I18ed1b38dc3bff8b04e26a712f5968184d0391b0
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm_hooks/fileinject/before_vm_start.py
M vdsm_hooks/isolatedprivatevlan/before_vm_start.py
M vdsm_hooks/openstacknet/before_device_create.py
M vdsm_hooks/promisc/after_vm_start.py
M vdsm_hooks/qos/before_vm_start.py
M vdsm_hooks/vmdisk/before_vm_start.py
M vdsm_hooks/vmfex_dev/vmfex_vnic.py
7 files changed, 27 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/83/26383/1

diff --git a/vdsm_hooks/fileinject/before_vm_start.py b/vdsm_hooks/fileinject/before_vm_start.py
index 0f571e8..a0535a9 100755
--- a/vdsm_hooks/fileinject/before_vm_start.py
+++ b/vdsm_hooks/fileinject/before_vm_start.py
@@ -92,15 +92,15 @@
 
                     rawcount += 1
 
-                  # disk format can be raw or qcow2
-                  # http://libguestfs.org/guestfs.3.html#guestfs_add_drive_opts
+                    # disk format can be raw or qcow2
+                    # http://libguestfs.org/guestfs.3.html#guestfs_add_drive_opts
                     path = None
                     if source.hasAttribute('file'):
                         path = source.attributes['file'].value
                     elif source.hasAttribute('dev'):
                         path = source.attributes['dev'].value
 
-                    if not path is None:
+                    if path is not None:
                         injected = inject_file(filepath, content,
                                                path, diskformat)
 
diff --git a/vdsm_hooks/isolatedprivatevlan/before_vm_start.py b/vdsm_hooks/isolatedprivatevlan/before_vm_start.py
index 6f839ed..722bf59 100755
--- a/vdsm_hooks/isolatedprivatevlan/before_vm_start.py
+++ b/vdsm_hooks/isolatedprivatevlan/before_vm_start.py
@@ -9,7 +9,7 @@
 
 
 def addInterfaceFilter(domxml, interface, gateway, ip):
-    if not ip is None:
+    if ip is not None:
         filterref = domxml.createElement('filterref')
         filterref.setAttribute('filter', 'clean-traffic')
         interface.appendChild(filterref)
diff --git a/vdsm_hooks/openstacknet/before_device_create.py b/vdsm_hooks/openstacknet/before_device_create.py
index e322ec3..de7a896 100755
--- a/vdsm_hooks/openstacknet/before_device_create.py
+++ b/vdsm_hooks/openstacknet/before_device_create.py
@@ -118,11 +118,11 @@
 
         mac = iface.getElementsByTagName('mac')[0].getAttribute('address')
         executeOrExit([ovs_vsctl.cmd, '--', '--may-exist', 'add-port',
-                      INTEGRATION_BRIDGE, vethOvs,
-                      '--', 'set', 'Interface', vethOvs,
-                      'external-ids:iface-id=%s' % portId,
-                      'external-ids:iface-status=active',
-                      'external-ids:attached-mac=%s' % mac])
+                       INTEGRATION_BRIDGE, vethOvs,
+                       '--', 'set', 'Interface', vethOvs,
+                       'external-ids:iface-id=%s' % portId,
+                       'external-ids:iface-status=active',
+                       'external-ids:attached-mac=%s' % mac])
 
     defineLinuxBridge(domxml, iface, portId, brName)
 
@@ -166,8 +166,8 @@
 
 
 def mockExecuteOrExit(command):
-    print ("Mocking successful execution of: %s"
-           % subprocess.list2cmdline(command))
+    print("Mocking successful execution of: %s"
+          % subprocess.list2cmdline(command))
     return (0, '', '')
 
 
diff --git a/vdsm_hooks/promisc/after_vm_start.py b/vdsm_hooks/promisc/after_vm_start.py
index e315159..ea62347 100755
--- a/vdsm_hooks/promisc/after_vm_start.py
+++ b/vdsm_hooks/promisc/after_vm_start.py
@@ -116,14 +116,14 @@
                     if mode == MODE_MIRROR:
                         captureNetwork(network, ifaceName, mode)
                     else:
-                    # NOTE:
-                    # in in-line mode we don't filter a network
-                    # the network parameter here is a tap device for the
-                    # security vm, so we switch the ifaceName and network
-                    # parameter order
-                    # TODO: it may be right to use the mirror as we do with the
-                    # in-line mode now, ie not filter the network but filter
-                    # the vm interface
+                        # NOTE:
+                        # in in-line mode we don't filter a network
+                        # the network parameter here is a tap device for the
+                        # security vm, so we switch the ifaceName and network
+                        # parameter order
+                        # TODO: it may be right to use the mirror as we do
+                        # with the in-line mode now, ie not filter the network
+                        # but filter the vm interface
                         captureNetwork(ifaceName, network, mode)
 
     except:
diff --git a/vdsm_hooks/qos/before_vm_start.py b/vdsm_hooks/qos/before_vm_start.py
index 2371e90..d9a3ada 100755
--- a/vdsm_hooks/qos/before_vm_start.py
+++ b/vdsm_hooks/qos/before_vm_start.py
@@ -38,7 +38,7 @@
 def add_attributes(node, attributes):
     data = ast.literal_eval(attributes)
     for key in data.keys():
-        if not key in keys:
+        if key not in keys:
             sys.stderr.write('qos hook: bad attribute name %s\n' % key)
             sys.exit(2)
 
diff --git a/vdsm_hooks/vmdisk/before_vm_start.py b/vdsm_hooks/vmdisk/before_vm_start.py
index c08c645..e599b6c 100755
--- a/vdsm_hooks/vmdisk/before_vm_start.py
+++ b/vdsm_hooks/vmdisk/before_vm_start.py
@@ -82,7 +82,7 @@
                                  '/path/disk.img:qcow2\n')
                 sys.exit(2)
 
-            if not drivertype in driver_types:
+            if drivertype not in driver_types:
                 sys.stderr.write('vmdisk: input error, driver '
                                  'type: raw or qcow2\n')
                 sys.exit(2)
diff --git a/vdsm_hooks/vmfex_dev/vmfex_vnic.py b/vdsm_hooks/vmfex_dev/vmfex_vnic.py
index fdc101f..2f811b4 100755
--- a/vdsm_hooks/vmfex_dev/vmfex_vnic.py
+++ b/vdsm_hooks/vmfex_dev/vmfex_vnic.py
@@ -142,15 +142,15 @@
     </interface>
     """).getElementsByTagName('interface')[0]
 
-    print ("Interface before attaching to VM-FEX: %s" %
-           interface.toprettyxml(encoding='UTF-8'))
+    print("Interface before attaching to VM-FEX: %s" %
+          interface.toprettyxml(encoding='UTF-8'))
 
     attachProfileToInterfaceXml(interface, 'Profail')
-    print ("Interface after attaching to VM-FEX port: %s" %
-           interface.toprettyxml(encoding='UTF-8'))
+    print("Interface after attaching to VM-FEX port: %s" %
+          interface.toprettyxml(encoding='UTF-8'))
 
-    print ('Available interfaces for the VM-FEX direct pool in the current '
-           'host: %s' % getUsableNics())
+    print('Available interfaces for the VM-FEX direct pool in the current '
+          'host: %s' % getUsableNics())
 
 
 def main():


-- 
To view, visit http://gerrit.ovirt.org/26383
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I18ed1b38dc3bff8b04e26a712f5968184d0391b0
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