[virt-tools-list] [virt-bootstrap] [PATCH v4 13/26] Use libguestfs python's binding

Radostin Stoyanov rstoyanov1 at gmail.com
Thu Aug 3 13:13:11 UTC 2017


---
 src/virtBootstrap/sources/docker_source.py |  6 +++++-
 src/virtBootstrap/sources/file_source.py   | 11 +++++------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/virtBootstrap/sources/docker_source.py b/src/virtBootstrap/sources/docker_source.py
index 63865d8..9d7c187 100644
--- a/src/virtBootstrap/sources/docker_source.py
+++ b/src/virtBootstrap/sources/docker_source.py
@@ -267,7 +267,11 @@ 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)
+                utils.Build_QCOW2_Image(
+                    tar_files=self.tar_files,
+                    dest=dest,
+                    progress=self.progress
+                )
             else:
                 raise Exception("Unknown format:" + self.output_format)
 
diff --git a/src/virtBootstrap/sources/file_source.py b/src/virtBootstrap/sources/file_source.py
index c02f735..760e50a 100644
--- a/src/virtBootstrap/sources/file_source.py
+++ b/src/virtBootstrap/sources/file_source.py
@@ -63,14 +63,13 @@ class FileSource(object):
             utils.safe_untar(self.path, dest)
 
         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)
+            utils.Build_QCOW2_Image(
+                tar_files=[self.path],
+                dest=dest,
+                progress=self.progress
+            )
         else:
             raise Exception("Unknown format:" + self.output_format)
 
-- 
2.13.3




More information about the virt-tools-list mailing list