Blame SOURCES/virt-manager-diskbackend-convert-to-long-the-calculated-size.patch

66a46e
From f217c44698f5d28a12ca534536268b639bafd335 Mon Sep 17 00:00:00 2001
66a46e
Message-Id: <f217c44698f5d28a12ca534536268b639bafd335@dist-git>
66a46e
From: Pavel Hrdina <phrdina@redhat.com>
66a46e
Date: Tue, 3 Oct 2017 13:56:20 +0200
66a46e
Subject: [PATCH] diskbackend: convert to long the calculated size
66a46e
66a46e
If we convert to long the disk size, it may end up "0".  The size is
66a46e
in GiB so it can be "0.1".
66a46e
66a46e
Introduced by commit <fab55c128ff3f092039bb950ecfd337568d2a9a8>.
66a46e
66a46e
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
66a46e
(cherry picked from commit e73abe5a3acaa8e30363fb2ab8c9828b1fdb2589)
66a46e
66a46e
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1450908
66a46e
66a46e
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
66a46e
---
66a46e
 virtinst/diskbackend.py | 7 +++----
66a46e
 1 file changed, 3 insertions(+), 4 deletions(-)
66a46e
66a46e
diff --git a/virtinst/diskbackend.py b/virtinst/diskbackend.py
66a46e
index 5979e6e6..de745f4d 100644
66a46e
--- a/virtinst/diskbackend.py
66a46e
+++ b/virtinst/diskbackend.py
66a46e
@@ -389,7 +389,7 @@ class CloneStorageCreator(_StorageCreator):
66a46e
         msg = None
66a46e
         vfs = os.statvfs(os.path.dirname(self._path))
66a46e
         avail = vfs[statvfs.F_FRSIZE] * vfs[statvfs.F_BAVAIL]
66a46e
-        need = long(self._size) * long(1024) * long(1024) * long(1024)
66a46e
+        need = long(self._size * 1024 * 1024 * 1024)
66a46e
         if need > avail:
66a46e
             if self._sparse:
66a46e
                 msg = _("The filesystem will not have enough free space"
66a46e
@@ -409,9 +409,8 @@ class CloneStorageCreator(_StorageCreator):
66a46e
         text = (_("Cloning %(srcfile)s") %
66a46e
                 {'srcfile': os.path.basename(self._input_path)})
66a46e
 
66a46e
-        size_bytes = (long(self.get_size()) *
66a46e
-                      long(1024) * long(1024) * long(1024))
66a46e
-        progresscb.start(filename=self._output_path, size=long(size_bytes),
66a46e
+        size_bytes = long(self.get_size() * 1024 * 1024 * 1024)
66a46e
+        progresscb.start(filename=self._output_path, size=size_bytes,
66a46e
                          text=text)
66a46e
 
66a46e
         # Plain file clone
66a46e
-- 
66a46e
2.14.3
66a46e