Skip to content

Commit

Permalink
(t) avoid recalculating pool free rockstor#2386
Browse files Browse the repository at this point in the history
Remove a redundant re-calculation of pool.free in PUT (remove) pool command when the
exact same calculation has already been made via an earlier and current Pool object
@Property instantiation.
  • Loading branch information
phillxnet committed Jun 28, 2022
1 parent afa3e41 commit 9323650
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/rockstor/storageadmin/views/pool.py
Expand Up @@ -26,7 +26,6 @@
from storageadmin.models import Disk, Pool, Share, PoolBalance
from fs.btrfs import (
add_pool,
pool_usage,
resize_pool_cmd,
umount_root,
btrfs_uuid,
Expand Down Expand Up @@ -697,11 +696,10 @@ def put(self, request, pid, command):
)
handle_exception(Exception(e_msg), request)

usage = pool_usage("/{}/{}".format(settings.MNT_PT, pool.name))
size_cut = 0
for d in disks: # to be removed
size_cut += d.allocated
available_free = pool.size - usage
available_free = pool.free
if size_cut >= available_free:
e_msg = (
"Removing disks ({}) may shrink the pool by "
Expand Down

0 comments on commit 9323650

Please sign in to comment.