From b677f0434ae9e6f9b1e2027689148eaadb6f571d Mon Sep 17 00:00:00 2001
From: Nikos Skalkotos <skalkoto@grnet.gr>
Date: Fri, 26 Sep 2014 16:39:51 +0300
Subject: [PATCH] Fix a bug in host bundling size computation

Fix a bug in host-bundling operation were in some cases the computed
new image size was wrong.
---
 image_creator/bundle_volume.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/image_creator/bundle_volume.py b/image_creator/bundle_volume.py
index 51b7fd1..b39760c 100644
--- a/image_creator/bundle_volume.py
+++ b/image_creator/bundle_volume.py
@@ -177,8 +177,6 @@ class BundleVolume(object):
         shrink the partition before that. Make sure it can still host all the
         files the corresponding host file system hosts
         """
-        new_end = self.disk.device.length
-
         image_disk = parted.Disk(parted.Device(image))
 
         is_extended = lambda p: p.type == parted.PARTITION_EXTENDED
@@ -187,6 +185,7 @@ class BundleVolume(object):
         partitions = self._get_partitions(self.disk)
 
         last = partitions[-1]
+        new_end = last.end
         if last.fs == 'linux-swap(v1)':
             MB = 2 ** 20
             size = (last.end - last.start + 1) * self.disk.device.sectorSize
-- 
GitLab