summaryrefslogtreecommitdiffstats
path: root/src/virtBootstrap/sources/docker_source.py
diff options
context:
space:
mode:
authorRadostin Stoyanov <rstoyanov1@gmail.com>2017-08-26 21:42:03 +0100
committerRadostin Stoyanov <rstoyanov1@gmail.com>2017-08-28 16:03:05 +0100
commit6ca9a3f7eccae0411f73d7aa8df759eb09be8955 (patch)
tree13b5f28e1911201ccb4a073d6841c444226fc457 /src/virtBootstrap/sources/docker_source.py
parentdba42986a04d5b5a9d4926d65479744812c00f3f (diff)
downloadvirt-bootstrap.git-6ca9a3f7eccae0411f73d7aa8df759eb09be8955.tar.gz
virt-bootstrap.git-6ca9a3f7eccae0411f73d7aa8df759eb09be8955.tar.xz
virt-bootstrap.git-6ca9a3f7eccae0411f73d7aa8df759eb09be8955.zip
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().
Diffstat (limited to 'src/virtBootstrap/sources/docker_source.py')
-rw-r--r--src/virtBootstrap/sources/docker_source.py10
1 files changed, 9 insertions, 1 deletions
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)