Ayal Baron has posted comments on this change.

Change subject: Making getVSize and getVTrueSize SD methods.
......................................................................


Patch Set 4: Code-Review-1

(8 comments)

....................................................
Commit Message
Line 5: CommitDate: 2013-09-16 04:46:07 +0300
Line 6: 
Line 7: Making getVSize and getVTrueSize SD methods.
Line 8: 
Line 9: Units sanitized. The two methods returns now size in bytes,
s/returns/return/
Line 10: like st_size.
Line 11: getVTrueSize() renamed to getAllocSize().
Line 12: 
Line 13: TODO:


Line 10: like st_size.
Line 11: getVTrueSize() renamed to getAllocSize().
Line 12: 
Line 13: TODO:
Line 14: This two method should be unified in a future patch since the
s/This/These/
s/method/methods/
Line 15: two values are returned in the same call for file volumes and
Line 16: the two values are identical for block volumes.
Line 17: 
Line 18: Required to reduce the volume size functions proliferation.


Line 12: 
Line 13: TODO:
Line 14: This two method should be unified in a future patch since the
Line 15: two values are returned in the same call for file volumes and
Line 16: the two values are identical for block volumes.
so unify them now while you're refactoring. I see no reason to wait.
Line 17: 
Line 18: Required to reduce the volume size functions proliferation.
Line 19: 
Line 20: Change-Id: I3d9772cedd74431e71d6068399546e1b4aae69e9


....................................................
File vdsm/storage/blockSD.py
Line 132:     return LVM_ENC_ESCAPE.sub(lambda c: unichr(int(c.groups()[0])), s)
Line 133: 
Line 134: 
Line 135: def _get_st_size(devPath):
Line 136:     """ Size in bytes of a dm device workaround.
???
Line 137: 
Line 138:     stat.st_size (in /sys/block/dm-*/stat) is identically 0.
Line 139:     """
Line 140:     with open(devPath, "rb") as f:


Line 134: 
Line 135: def _get_st_size(devPath):
Line 136:     """ Size in bytes of a dm device workaround.
Line 137: 
Line 138:     stat.st_size (in /sys/block/dm-*/stat) is identically 0.
???
Line 139:     """
Line 140:     with open(devPath, "rb") as f:
Line 141:         f.seek(0, 2)
Line 142:         return f.tell()


Line 620:             return False
Line 621:         return True
Line 622: 
Line 623:     def getVSize(self, imgUUID, volUUID):
Line 624:         """ Return the block volume size in bytes. Like st_size."""
s/Like st_size//
Line 625:         try:
Line 626:             size = _get_st_size(lvm.lvPath(self.sdUUID, volUUID))
Line 627:         except IOError as e:
Line 628:             if e.errno == os.errno.ENOENT:


Line 634:                 raise
Line 635: 
Line 636:         return size
Line 637: 
Line 638:     getVAllocSize = getVSize
redundant, unify the methods/
Line 639: 
Line 640:     @classmethod
Line 641:     def validateCreateVolumeParams(cls, volFormat, preallocate, 
srcVolUUID):
Line 642:         """


....................................................
File vdsm/storage/volume.py
Line 477:             # match the apparent size (eg: physical extent 
granularity in LVM)
Line 478:             # we need to update the size value so that the metadata 
reflects
Line 479:             # the correct state.
Line 480:             if volFormat == RAW_FORMAT:
Line 481:                 # TODO: fix size in [sectors]! "I tawt I taw a puddy 
tat!"
sub/incorrect quote//g
And please spare us of redundant comments (both in code and in reviews)
Line 482:                 apparentSize = int(dom.getVSize(imgUUID, volUUID) / 
BLOCK_SIZE)
Line 483:                 if apparentSize < size:
Line 484:                     cls.log.error("The volume %s apparent size %s is 
smaller "
Line 485:                                   "than the requested size %s",


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3d9772cedd74431e71d6068399546e1b4aae69e9
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewars...@redhat.com>
Gerrit-Reviewer: Ayal Baron <aba...@redhat.com>
Gerrit-Reviewer: Elad Ben Aharon <eladba1...@gmail.com>
Gerrit-Reviewer: Yeela Kaplan <ykap...@redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to