[virt-manager PATCH 1/2] diskbackend: convert to long the calculated size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If we convert to long the disk size, it may end up "0".  The size is
in GiB so it can be "0.1".

Introduced by commit <fab55c128ff3f092039bb950ecfd337568d2a9a8>.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 virtinst/diskbackend.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/virtinst/diskbackend.py b/virtinst/diskbackend.py
index 5979e6e6..de745f4d 100644
--- a/virtinst/diskbackend.py
+++ b/virtinst/diskbackend.py
@@ -389,7 +389,7 @@ class CloneStorageCreator(_StorageCreator):
         msg = None
         vfs = os.statvfs(os.path.dirname(self._path))
         avail = vfs[statvfs.F_FRSIZE] * vfs[statvfs.F_BAVAIL]
-        need = long(self._size) * long(1024) * long(1024) * long(1024)
+        need = long(self._size * 1024 * 1024 * 1024)
         if need > avail:
             if self._sparse:
                 msg = _("The filesystem will not have enough free space"
@@ -409,9 +409,8 @@ class CloneStorageCreator(_StorageCreator):
         text = (_("Cloning %(srcfile)s") %
                 {'srcfile': os.path.basename(self._input_path)})
 
-        size_bytes = (long(self.get_size()) *
-                      long(1024) * long(1024) * long(1024))
-        progresscb.start(filename=self._output_path, size=long(size_bytes),
+        size_bytes = long(self.get_size() * 1024 * 1024 * 1024)
+        progresscb.start(filename=self._output_path, size=size_bytes,
                          text=text)
 
         # Plain file clone
-- 
2.13.6

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux