Change in vdsm[master]: pep8: fix remaining vdsm/*.py

zhshzhou at linux.vnet.ibm.com zhshzhou at linux.vnet.ibm.com
Fri Nov 30 03:32:21 UTC 2012


Zhou Zheng Sheng has posted comments on this change.

Change subject: pep8: fix remaining vdsm/*.py
......................................................................


Patch Set 2: Verified; I would prefer that you didn't submit this

(2 inline comments)

Pass autobuild.sh.

pydiff find some changes.

pydiff vdsm/dumpStorageTable.py.in   ../diffs/vdsm/dumpStorageTable.py.in
3 difference(s)
  first file: vdsm/dumpStorageTable.py.in
  second file: ../diffs/vdsm/dumpStorageTable.py.in

((55,
  "Subscript(CallFunc(Getattr(Getattr(Name('self'), 'serverConncetion'), 'getImageDomainsList'), [Name('pool'), Name('image')], None, None), 'OP_APPLY', [Const('domainslist')])"),
 (58, "Getattr(Name('self'), 'serverConncetion')"))

((55, 'sd'), (58, 's'))

(('55 +', None),
 (59,
  Assign([AssName('sd', 'OP_ASSIGN')], Subscript(CallFunc(Getattr(Name('s'), 'getImageDomainsList'), [Name('pool'), Name('image')], None, None), 'OP_APPLY', [Const('domainslist')]))))

These all are about introducing a intermediate variable, acceptable.


pydiff vdsm/hooking.py               ../diffs/vdsm/hooking.py
1 difference(s)
first file: vdsm/hooking.py
second file: ../diffs/vdsm/hooking.py

((48, '=='), (49, 'is'))

Use 'is' when comparing to None, acceptable.


-1 for a minor problem in the mkimage.py.

....................................................
File vdsm/mkimage.py
Line 81:         command = [EXT_MKFS_MSDOS, '-C', floppy, '1440']
Line 82:         rc, out, err = storage.misc.execCmd(command, raw=True)
Line 83:         if rc:
Line 84:             raise OSError(errno.EIO, "could not create floppy file: \
Line 85:                     code %s, out %s\nerr %s" % (rc, out, err))
Wrapping a string like this will introduce extra spaces in the result.

It should be as follow.
            raise OSError(errno.EIO, "could not create floppy file: "
                          "code %s, out %s\nerr %s" % (rc, out, err))
Line 86: 
Line 87:         dirname = tempfile.mkdtemp()
Line 88:         m = storage.mount.Mount(floppy, dirname)
Line 89:         m.mount(mntOpts='loop')


Line 107:         command = [EXT_MKISOFS, '-r', '-o', isopath, dirname]
Line 108:         rc, out, err = storage.misc.execCmd(command, raw=True)
Line 109:         if rc:
Line 110:             raise OSError(errno.EIO, "could not create iso file: \
Line 111:                     code %s, out %s\nerr %s" % (rc, out, err))
Same as line 85
Line 112:     finally:
Line 113:         _commonCleanFs(dirname, isopath)
Line 114: 
Line 115:     return isopath


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie4e0a0bdeb5f8a014b336fe32583cf9fc9c3cec4
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>


More information about the vdsm-patches mailing list