Skip to content

Commit db7f718

Browse files
authored
fix calculation of summary table in provisioner (#949) (#950)
Signed-off-by: guochao <[email protected]>
1 parent df70c7f commit db7f718

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

csi/volumeutils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def mount_and_select_hosting_volume(pv_hosting_volumes, required_size):
231231
# file not exists even in case of ENOTCONN
232232
mntdir_stat = retry_errors(os.statvfs, [mntdir], [ENOTCONN])
233233
with SizeAccounting(hvol, mntdir) as acc:
234-
acc.update_summary(mntdir_stat.f_bavail * mntdir_stat.f_bsize)
234+
acc.update_summary(mntdir_stat.f_blocks * mntdir_stat.f_bsize)
235235
pv_stats = acc.get_stats()
236236
reserved_size = pv_stats["free_size_bytes"] * RESERVED_SIZE_PERCENTAGE/100
237237

@@ -436,7 +436,7 @@ def is_hosting_volume_free(hostvol, requested_pvsize):
436436
# file not exists even in case of ENOTCONN
437437
mntdir_stat = retry_errors(os.statvfs, [mntdir], [ENOTCONN])
438438
with SizeAccounting(hostvol, mntdir) as acc:
439-
acc.update_summary(mntdir_stat.f_bavail * mntdir_stat.f_bsize)
439+
acc.update_summary(mntdir_stat.f_blocks * mntdir_stat.f_bsize)
440440
pv_stats = acc.get_stats()
441441
reserved_size = pv_stats["free_size_bytes"] * RESERVED_SIZE_PERCENTAGE/100
442442

0 commit comments

Comments
 (0)