38 lines
1.6 KiB
Diff
38 lines
1.6 KiB
Diff
|
Subject: diskbackend: convert to long the calculated size
|
||
|
From: Pavel Hrdina phrdina@redhat.com Tue Oct 3 13:56:20 2017 +0200
|
||
|
Date: Thu Oct 19 09:06:44 2017 +0200:
|
||
|
Git: e73abe5a3acaa8e30363fb2ab8c9828b1fdb2589
|
||
|
|
||
|
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@redhat.com>
|
||
|
|
||
|
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
|