[virt-tools-list] [virt-bootstrap] [PATCH v6 14/26] Create qcow2 images with guestfs-python

Radostin Stoyanov rstoyanov1 at gmail.com
Sat Aug 19 12:59:32 UTC 2017



On 19/08/17 13:54, Cedric Bosdonnat wrote:
> On Thu, 2017-08-17 at 10:39 +0100, Radostin Stoyanov wrote:
>> 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 behaviour 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 appied in the test suite as an update to the function
> typo: 'applied'
>
>> get_image_path().
>>
>> Note: The following commits which introduce UID/GID mapping
>> and setting root password for 'qcow2' with FileSource will apply
>> these changes to layer-1.qcow2 image with backing file layer-0.qcow2.
> What is the interest of this note for this commit? The info could be
> interesting in the corresponding commit though.
Ok I will change this, but it was to explain these changes...
> +    def get_image_path(self, n=0):
>>          """
>>          Returns the path where the qcow2 image will be stored.
>>          """
>>          return os.path.join(
>>              self.dest_dir,
>> -            "%s.qcow2" % os.path.basename(self.tar_file)
>> +            "layer-%d.qcow2" % n
>>          )
>>  
>>      def runTest(self):
>> @@ -92,7 +92,7 @@ class Qcow2OwnershipMapping(Qcow2BuildImage):
>>              gid_map=self.gid_map
>>          )
>>          self.apply_mapping()
>> -        self.check_qcow2_images(self.get_image_path())
>> +        self.check_qcow2_images(self.get_image_path(1))
>>  
>>  
>>  @unittest.skip("Not implemented")
>> @@ -114,7 +114,7 @@ class Qcow2SettingRootPassword(Qcow2BuildImage):
>>              root_password=self.root_password
>>          )
>>          self.check_image = self.validate_shadow_file_in_image
>> -        self.check_qcow2_images(self.get_image_path())
>> +        self.check_qcow2_images(self.get_image_path(1))
>>




More information about the virt-tools-list mailing list