diskbackend: convert to long the calculated size

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>
This commit is contained in:
Pavel Hrdina 2017-10-03 13:56:20 +02:00
parent 9617d1267d
commit e73abe5a3a
1 changed files with 3 additions and 4 deletions

View File

@ -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