From 6ca9a3f7eccae0411f73d7aa8df759eb09be8955 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sat, 26 Aug 2017 21:42:03 +0100 Subject: Create qcow2 images with guestfs-python Use the python bindings of libguestfs to create qcow2 image with backing chains to mimic the layers of container image. This commit also changes the behavior of FileSource when 'qcow2' output format is used. Now the string layer-0.qcow2 will be used as name of the output file. This change is applied in the test suite as an update to the function get_image_path(). --- src/virtBootstrap/sources/docker_source.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/virtBootstrap/sources/docker_source.py') diff --git a/src/virtBootstrap/sources/docker_source.py b/src/virtBootstrap/sources/docker_source.py index 2dadb42..a6ea3e6 100644 --- a/src/virtBootstrap/sources/docker_source.py +++ b/src/virtBootstrap/sources/docker_source.py @@ -272,7 +272,15 @@ class DockerSource(object): elif self.output_format == 'qcow2': self.progress("Extracting container layers into qcow2 images", value=50, logger=logger) - utils.extract_layers_in_qcow2(self.layers, dest, self.progress) + + img = utils.BuildImage( + layers=self.layers, + dest=dest, + progress=self.progress + ) + img.create_base_layer() + img.create_backing_chains() + else: raise Exception("Unknown format:" + self.output_format) -- cgit