summaryrefslogtreecommitdiffstats
path: root/src/virtBootstrap/sources/file_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/file_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/file_source.py')
-rw-r--r--src/virtBootstrap/sources/file_source.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/virtBootstrap/sources/file_source.py b/src/virtBootstrap/sources/file_source.py
index 412db8a..69f024c 100644
--- a/src/virtBootstrap/sources/file_source.py
+++ b/src/virtBootstrap/sources/file_source.py
@@ -64,14 +64,16 @@ class FileSource(object):
utils.untar_layers(layer, dest, self.progress)
elif self.output_format == 'qcow2':
- # Remove the old path
- file_name = os.path.basename(self.path)
- qcow2_file = os.path.realpath('{}/{}.qcow2'.format(dest,
- file_name))
-
self.progress("Extracting files into qcow2 image", value=0,
logger=logger)
- utils.create_qcow2(self.path, qcow2_file)
+
+ img = utils.BuildImage(
+ layers=layer,
+ dest=dest,
+ progress=self.progress
+ )
+ img.create_base_layer()
+
else:
raise Exception("Unknown format:" + self.output_format)