@@ -721,10 +721,7 @@ def scan(self, uuid):
721721 util .roundup (lvutil .LVM_SIZE_INCREMENT ,
722722 vhdutil .calcOverheadEmpty (lvhdutil .MSIZE ))
723723 else :
724- utilisation = lvhdutil .calcSizeVHDLV (
725- int (size ),
726- vhdutil .getBlockSize (lvPath )
727- )
724+ utilisation = lvhdutil .calcSizeVHDLV (int (size ))
728725
729726 vdi_ref = self .session .xenapi .VDI .db_introduce (
730727 vdi_uuid ,
@@ -992,10 +989,7 @@ def _undoCloneOp(self, lvs, origUuid, baseUuid, clonUuid):
992989
993990 # inflate the parent to fully-allocated size
994991 if base .vdiType == vhdutil .VDI_TYPE_VHD :
995- fullSize = lvhdutil .calcSizeVHDLV (
996- vhdInfo .sizeVirt ,
997- vhdutil .getBlockSize (basePath )
998- )
992+ fullSize = lvhdutil .calcSizeVHDLV (vhdInfo .sizeVirt )
999993 lvhdutil .inflate (self .journaler , self .uuid , baseUuid , fullSize )
1000994
1001995 # rename back
@@ -1184,7 +1178,7 @@ def _undoAllVHDJournals(self):
11841178 util .SMlog ("Found VHD journal %s, reverting %s" % (uuid , vdi .path ))
11851179 self .lvActivator .activate (uuid , vdi .lvname , False )
11861180 self .lvmCache .activateNoRefcount (jlvName )
1187- fullSize = lvhdutil .calcSizeVHDLV (vdi .size , vdi . block_size )
1181+ fullSize = lvhdutil .calcSizeVHDLV (vdi .size )
11881182 lvhdutil .inflate (self .journaler , self .uuid , vdi .uuid , fullSize )
11891183 try :
11901184 jFile = os .path .join (self .path , jlvName )
@@ -1195,7 +1189,7 @@ def _undoAllVHDJournals(self):
11951189 util .SMlog ("VHD revert failed but VHD ok: removing journal" )
11961190 # Attempt to reclaim unused space
11971191 vhdInfo = vhdutil .getVHDInfo (vdi .path , lvhdutil .extractUuid , False )
1198- NewSize = lvhdutil .calcSizeVHDLV (vhdInfo .sizeVirt , vdi . block_size )
1192+ NewSize = lvhdutil .calcSizeVHDLV (vhdInfo .sizeVirt )
11991193 if NewSize < fullSize :
12001194 lvhdutil .deflate (self .lvmCache , vdi .lvname , int (NewSize ))
12011195 lvhdutil .lvRefreshOnAllSlaves (self .session , self .uuid ,
@@ -1450,10 +1444,7 @@ def attach(self, sr_uuid, vdi_uuid):
14501444 needInflate = False
14511445 else :
14521446 self ._loadThis ()
1453- if (
1454- self .utilisation >=
1455- lvhdutil .calcSizeVHDLV (self .size , self .block_size )
1456- ):
1447+ if self .utilisation >= lvhdutil .calcSizeVHDLV (self .size ):
14571448 needInflate = False
14581449
14591450 if needInflate :
@@ -1473,7 +1464,7 @@ def detach(self, sr_uuid, vdi_uuid):
14731464 util .SMlog ("LVHDVDI.detach for %s" % self .uuid )
14741465 self ._loadThis ()
14751466 already_deflated = (self .utilisation < \
1476- lvhdutil .calcSizeVHDLV (self .size , self . block_size ))
1467+ lvhdutil .calcSizeVHDLV (self .size ))
14771468 needDeflate = True
14781469 if self .vdi_type == vhdutil .VDI_TYPE_RAW or already_deflated :
14791470 needDeflate = False
@@ -1514,7 +1505,7 @@ def resize(self, sr_uuid, vdi_uuid, size):
15141505 '(current size: %d, new size: %d)' % (self .size , size ))
15151506 raise xs_errors .XenError ('VDISize' , opterr = 'shrinking not allowed' )
15161507
1517- size = vhdutil .validate_and_round_vhd_size (int (size ), self . block_size )
1508+ size = vhdutil .validate_and_round_vhd_size (int (size ))
15181509
15191510 if size == self .size :
15201511 return VDI .VDI .get_params (self )
@@ -1524,7 +1515,7 @@ def resize(self, sr_uuid, vdi_uuid, size):
15241515 lvSizeNew = util .roundup (lvutil .LVM_SIZE_INCREMENT , size )
15251516 else :
15261517 lvSizeOld = self .utilisation
1527- lvSizeNew = lvhdutil .calcSizeVHDLV (size , self . block_size )
1518+ lvSizeNew = lvhdutil .calcSizeVHDLV (size )
15281519 if self .sr .provision == "thin" :
15291520 # VDI is currently deflated, so keep it deflated
15301521 lvSizeNew = lvSizeOld
@@ -1690,7 +1681,7 @@ def _snapshot(self, snapType, cloneOp=False, cbtlog=None, cbt_consistency=None):
16901681 self .issnap = self .session .xenapi .VDI .get_is_a_snapshot ( \
16911682 self .sr .srcmd .params ['vdi_ref' ])
16921683
1693- fullpr = lvhdutil .calcSizeVHDLV (self .size , self . block_size )
1684+ fullpr = lvhdutil .calcSizeVHDLV (self .size )
16941685 thinpr = util .roundup (lvutil .LVM_SIZE_INCREMENT , \
16951686 vhdutil .calcOverheadEmpty (lvhdutil .MSIZE ))
16961687 lvSizeOrig = thinpr
0 commit comments