Skip to content

Commit

Permalink
Merge remote-tracking branch 'ldoktor/bitshift'
Browse files Browse the repository at this point in the history
Signed-off-by: Cleber Rosa <[email protected]>
  • Loading branch information
clebergnu committed Jun 26, 2019
2 parents 689c385 + 8f4c027 commit 17fbd21
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions virttest/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,12 +476,10 @@ def is_disk_size_enough(required, available):
"""Check if available disk size is enough for the data copy."""
minimum_disk_free = 1.2 * required
if available < minimum_disk_free:
# bitshift trick to do a quick convert (MB) for the log
bitshift = 20
logging.error("Free space: %s MB", (available >> bitshift))
logging.error("Backup size: %s MB", (required >> bitshift))
logging.error("Free space: %s MB", (available / 1048576.))
logging.error("Backup size: %s MB", (required / 1048576.))
logging.error("Minimum free space acceptable: %s MB",
(minimum_disk_free >> bitshift))
(minimum_disk_free / 1048576.))
logging.error("Available disk space is not enough. Skipping...")
return False
return True
Expand Down

0 comments on commit 17fbd21

Please sign in to comment.