Francesco Romani has uploaded a new change for review.

Change subject: clientIF: replace type() with isinstance()
......................................................................

clientIF: replace type() with isinstance()

the very first line of prepareVolumePath is a type() check.
this is not very pythonic and, most important, the remainder
of the code doesn't have evidences of a such a strict requirement.

this patch replaces the type() check with a more pythonic
and extendible isinstance() check.

http://effbot.org/pyfaq/how-do-i-check-if-an-object-is-an-instance-of-a-given-class-or-of-a-subclass-of-it.htm

Change-Id: Ic53afef3476a2aedbc5dac830a99f6ee9c093688
Signed-off-by: Francesco Romani <[email protected]>
---
M vdsm/clientIF.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/56/23056/1

diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 4a737bf..50921db 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -234,7 +234,7 @@
             raise vm.VolumeError(uuid)
 
     def prepareVolumePath(self, drive, vmId=None):
-        if type(drive) is dict:
+        if isinstance(drive, dict):
             # PDIV drive format
             if drive['device'] == 'disk' and vm.isVdsmImage(drive):
                 res = self.irs.prepareImage(


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic53afef3476a2aedbc5dac830a99f6ee9c093688
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to