diff --git a/bootstrapvz/base/fs/__init__.py b/bootstrapvz/base/fs/__init__.py index fecc99230..baccf9ffc 100644 --- a/bootstrapvz/base/fs/__init__.py +++ b/bootstrapvz/base/fs/__init__.py @@ -26,6 +26,7 @@ def load_volume(data, bootloader): from bootstrapvz.common.fs.virtualmachinedisk import VirtualMachineDisk from bootstrapvz.common.fs.folder import Folder from bootstrapvz.common.fs.logicalvolume import LogicalVolume + from bootstrapvz.common.fs.qcow2volume import Qcow2Volume volume_backing = {'raw': LoopbackVolume, 's3': LoopbackVolume, 'vdi': VirtualDiskImage, @@ -33,7 +34,8 @@ def load_volume(data, bootloader): 'vmdk': VirtualMachineDisk, 'ebs': EBSVolume, 'folder': Folder, - 'lvm': LogicalVolume + 'lvm': LogicalVolume, + 'qcow2': Qcow2Volume }.get(data['backing']) # Instantiate the partition map diff --git a/bootstrapvz/common/fs/qcow2volume.py b/bootstrapvz/common/fs/qcow2volume.py new file mode 100644 index 000000000..e9e623f05 --- /dev/null +++ b/bootstrapvz/common/fs/qcow2volume.py @@ -0,0 +1,7 @@ +from qemuvolume import QEMUVolume + + +class Qcow2Volume(QEMUVolume): + + extension = 'qcow2' + qemu_format = 'qcow2' diff --git a/bootstrapvz/providers/kvm/README.rst b/bootstrapvz/providers/kvm/README.rst index 274edf8dc..232a0aa34 100644 --- a/bootstrapvz/providers/kvm/README.rst +++ b/bootstrapvz/providers/kvm/README.rst @@ -6,7 +6,7 @@ virtual images for Linux Kernel-based Virtual Machines. It supports the installation of `virtio kernel modules `__ (paravirtualized drivers for IO operations). -It also supports creating an image with LVM as a disk backend. +It also supports creating an image with LVM and qcow2 as a disk backend. Manifest settings ----------------- diff --git a/bootstrapvz/providers/kvm/manifest-schema.yml b/bootstrapvz/providers/kvm/manifest-schema.yml index e28bf00d4..931c3cfd7 100644 --- a/bootstrapvz/providers/kvm/manifest-schema.yml +++ b/bootstrapvz/providers/kvm/manifest-schema.yml @@ -32,7 +32,8 @@ properties: properties: backing: type: string - enum: + enum: + - qcow2 - raw - lvm logicalvolume: {type: string} diff --git a/manifests/README.rst b/manifests/README.rst index 953865284..ae45b2a51 100644 --- a/manifests/README.rst +++ b/manifests/README.rst @@ -276,7 +276,7 @@ boot, root and swap. - ``backing``: Specifies the volume backing. This setting is very provider specific. - Valid values: ``ebs``, ``s3``, ``vmdk``, ``vdi``, ``raw`` + Valid values: ``ebs``, ``s3``, ``vmdk``, ``vdi``, ``raw``, ``qcow2``, ``lvm`` ``required`` - ``partitions``: A map of the partitions that should be created on the volume. diff --git a/manifests/examples/kvm/jessie-qcow2.yml b/manifests/examples/kvm/jessie-qcow2.yml new file mode 100644 index 000000000..34c0b1595 --- /dev/null +++ b/manifests/examples/kvm/jessie-qcow2.yml @@ -0,0 +1,24 @@ +--- +name: debian-qcow2-example +provider: + name: kvm +bootstrapper: + workspace: /target +system: + release: jessie + architecture: amd64 + bootloader: grub + charmap: UTF-8 + locale: en_US + timezone: UTC +volume: + backing: qcow2 + partitions: + type: gpt + root: + filesystem: ext4 + size: 1GB +packages: {} +plugins: + root_password: + password: test