kiwi.storage.subformat Package

Submodules

kiwi.storage.subformat.base Module

class kiwi.storage.subformat.base.DiskFormatBase(xml_state, root_dir, target_dir, custom_args=None)[source]

Bases: object

Base class to create disk formats from a raw disk image

Parameters:
  • xml_state (object) – Instance of XMLState
  • root_dir (string) – root directory path name
  • arch (string) – platform.machine
  • target_dir (string) – target directory path name
  • custom_args (dict) – custom format options dictionary
create_image_format()[source]

Create disk format

Implementation in specialized disk format class required

get_qemu_option_list(custom_args)[source]

Create list of qemu options from custom_args dict

Parameters:custom_args (dict) – arguments
Returns:qemu option list
Return type:list
get_target_file_path_for_format(format_name)[source]

Create target file path name for specified format

Parameters:format_name (string) – disk format name
Returns:file path name
Return type:str
has_raw_disk()[source]

Check if the base raw disk image exists

Returns:True or False
Return type:bool
post_init(custom_args)[source]

Post initialization method

Implementation in specialized disk format class if required

Parameters:custom_args (list) – unused
resize_raw_disk(size_bytes, append=False)[source]

Resize raw disk image to specified size. If the request would actually shrink the disk an exception is raised. If the disk got changed the method returns True, if the new size is the same as the current size nothing gets resized and the method returns False

Parameters:size (int) – size in bytes
Returns:True or False
Return type:bool
store_to_result(result)[source]

Store result file of the format conversion into the provided result instance.

By default only the converted image file will be stored as compressed file. Subformats which creates additional metadata files or want to use other result flags needs to overwrite this method

Parameters:result (object) – Instance of Result

kiwi.storage.subformat.gce Module

class kiwi.storage.subformat.gce.DiskFormatGce(xml_state, root_dir, target_dir, custom_args=None)[source]

Bases: kiwi.storage.subformat.base.DiskFormatBase

Create GCE - Google Compute Engine image format

create_image_format()[source]

Create GCE disk format and manifest

get_target_file_path_for_format(format_name)[source]

Google requires the image name to follow their naming convetion. Therefore it’s required to provide a suitable name by overriding the base class method

Parameters:format_name (string) – gce
Returns:file path name
Return type:str
post_init(custom_args)[source]

GCE disk format post initialization method

Store disk tag from custom args

Parameters:custom_args (dict) –

custom gce argument dictionary

{‘–tag’: ‘billing_code’}
store_to_result(result)[source]

Store result file of the gce format conversion into the provided result instance. In this case compression is unwanted because the gce tarball is already created as a compressed archive

Parameters:result (object) – Instance of Result

kiwi.storage.subformat.ova Module

class kiwi.storage.subformat.ova.DiskFormatOva(xml_state, root_dir, target_dir, custom_args=None)[source]

Bases: kiwi.storage.subformat.base.DiskFormatBase

Create ova disk format, based on vmdk

create_image_format()[source]

Create ova disk format using ovftool from https://www.vmware.com/support/developer/ovf

post_init(custom_args)[source]

vmdk disk format post initialization method

Store qemu options as list from custom args dict

Parameters:custom_args (dict) – custom qemu arguments dictionary
store_to_result(result)[source]

Store the resulting ova file into the provided result instance.

Parameters:result (object) – Instance of Result

kiwi.storage.subformat.qcow2 Module

class kiwi.storage.subformat.qcow2.DiskFormatQcow2(xml_state, root_dir, target_dir, custom_args=None)[source]

Bases: kiwi.storage.subformat.base.DiskFormatBase

Create qcow2 disk format

create_image_format()[source]

Create qcow2 disk format

post_init(custom_args)[source]

qcow2 disk format post initialization method

Store qemu options as list from custom args dict

Parameters:custom_args (dict) – custom qemu arguments dictionary

kiwi.storage.subformat.vagrant_libvirt Module

class kiwi.storage.subformat.vagrant_libvirt.DiskFormatVagrantLibVirt(xml_state, root_dir, target_dir, custom_args=None)[source]

Bases: kiwi.storage.subformat.base.DiskFormatBase

Create vagrant box for libvirt provider

create_image_format()[source]

Create vagrant box for libvirt provider. This includes

  • creation of qcow2 disk image format as box.img
  • creation of box metadata.json
  • creation of box Vagrantfile
  • creation of result format tarball from the files created above
post_init(custom_args)[source]

vagrant disk format post initialization method

store vagrantconfig information provided via custom_args

Parameters:custom_args (dict) –

Contains instance of xml_parse::vagrantconfig

{‘vagrantconfig’: object}
store_to_result(result)[source]

Store result file of the vagrant format conversion into the provided result instance. In this case compression is unwanted because the box is already created as a compressed tarball

Parameters:result (object) – Instance of Result

kiwi.storage.subformat.vdi Module

class kiwi.storage.subformat.vdi.DiskFormatVdi(xml_state, root_dir, target_dir, custom_args=None)[source]

Bases: kiwi.storage.subformat.base.DiskFormatBase

Create vdi disk format

create_image_format()[source]

Create vdi disk format

post_init(custom_args)[source]

vdi disk format post initialization method

Store qemu options as list from custom args dict

Parameters:custom_args (dict) – custom qemu arguments dictionary

kiwi.storage.subformat.vhd Module

class kiwi.storage.subformat.vhd.DiskFormatVhd(xml_state, root_dir, target_dir, custom_args=None)[source]

Bases: kiwi.storage.subformat.base.DiskFormatBase

Create vhd disk format

create_image_format()[source]

Create vhd disk format

post_init(custom_args)[source]

vhd disk format post initialization method

Store qemu options as list from custom args dict

Parameters:custom_args (dict) – custom qemu arguments dictionary

kiwi.storage.subformat.vhdfixed Module

class kiwi.storage.subformat.vhdfixed.DiskFormatVhdFixed(xml_state, root_dir, target_dir, custom_args=None)[source]

Bases: kiwi.storage.subformat.base.DiskFormatBase

Create vhd image format in fixed subformat

create_image_format()[source]

Create vhd fixed disk format

post_init(custom_args)[source]

vhd disk format post initialization method

Store qemu options as list from custom args dict Extract disk tag from custom args

Parameters:custom_args (dict) –

custom vhdfixed and qemu argument dictionary

{‘–tag’: ‘billing_code’, ‘–qemu-opt’: ‘value’}
store_to_result(result)[source]

Store result file of the vhdfixed format conversion into the provided result instance. In this case compressing the result is preferred as vhdfixed is not a compressed or dynamic format.

Parameters:result (object) – Instance of Result

kiwi.storage.subformat.vhdx Module

class kiwi.storage.subformat.vhdx.DiskFormatVhdx(xml_state, root_dir, target_dir, custom_args=None)[source]

Bases: kiwi.storage.subformat.base.DiskFormatBase

Create vhdx image format in dynamic subformat

create_image_format()[source]

Create vhdx dynamic disk format

post_init(custom_args)[source]

vhdx disk format post initialization method

Store qemu options as list from custom args dict

Parameters:custom_args (dict) – custom qemu arguments dictionary

kiwi.storage.subformat.vmdk Module

class kiwi.storage.subformat.vmdk.DiskFormatVmdk(xml_state, root_dir, target_dir, custom_args=None)[source]

Bases: kiwi.storage.subformat.base.DiskFormatBase

Create vmdk disk format

create_image_format()[source]

Create vmdk disk format and machine settings file

post_init(custom_args)[source]

vmdk disk format post initialization method

Store qemu options as list from custom args dict

Parameters:custom_args (dict) – custom qemu arguments dictionary
store_to_result(result)[source]

Store result files of the vmdk format conversion into the provided result instance. This includes the vmdk image file and the VMware settings file

Parameters:result (object) – Instance of Result

Module Contents

class kiwi.storage.subformat.DiskFormat[source]

Bases: object

DiskFormat factory

Parameters:
  • name (string) – Format name
  • xml_state (object) – Instance of XMLState
  • root_dir (string) – root directory path name
  • target_dir (string) – target directory path name