[virt-tools-list] [virt-bootstrap][PATCH v2 1/6] docker: only one layer drive per guestfs appliance

Cédric Bosdonnat cbosdonnat at suse.com
Thu Sep 7 11:45:11 UTC 2017


The current code was trying to save time by adding all drives to the
guestfs handle and launch the instance from it. However, this doesn't
fly since backing chain images would be used more than once.

To bad for performance, but sticking to one layer per guestfs launch
is safer and gets the tests to the pass.
---
 src/virtBootstrap/utils.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/virtBootstrap/utils.py b/src/virtBootstrap/utils.py
index a72c52c..6dbea87 100644
--- a/src/virtBootstrap/utils.py
+++ b/src/virtBootstrap/utils.py
@@ -119,12 +119,11 @@ class BuildImage(object):
                 backingformat='qcow2'
             )
             self.g.add_drive(self.qcow2_files[i], format='qcow2')
-        self.g.launch()
-        devices = self.g.list_devices()
-        # Tar-in layers (skip the base layer)
-        for index in range(1, self.nlayers):
-            self.extract_layer(index, devices[index - 1])
-        self.g.shutdown()
+            self.g.launch()
+
+            devices = self.g.list_devices()
+            self.extract_layer(i, devices[0])
+            self.g.shutdown()
 
     def extract_layer(self, index, dev):
         """
-- 
2.13.2




More information about the virt-tools-list mailing list