diff --git a/iso/empanadas/empanadas/scripts/build_image.py b/iso/empanadas/empanadas/scripts/build_image.py index 3ee5427..429af9e 100644 --- a/iso/empanadas/empanadas/scripts/build_image.py +++ b/iso/empanadas/empanadas/scripts/build_image.py @@ -146,16 +146,19 @@ class ImageBuild: ] if self.image_type in ["Vagrant"]: _map = { - "Vbox": {"format": "vmdk", "provider": "virtualbox"}, + "Vbox": {"format": "vmdk", "provider": "virtualbox", "convertOptions": ["-o", "subformat=streamOptimized"]}, "Libvirt": {"format": "qcow2", "provider": "libvirt", "virtual_size": 10}, "VMware": {"format": "vmdk", "provider": "vmware_desktop"} } output = f"{_map[self.variant]['format']}" #type: ignore - options = _map[self.variant]['convertOptions'] if 'convertOptions' in _map[self.variant].keys() else '' #type: ignore provider = f"{_map[self.variant]['provider']}" # type: ignore + # pop from the options map that will be passed to the vagrant metadata.json + convert_options = _map[self.variant].pop('convertOptions') if 'convertOptions' in _map[self.variant].keys() else '' #type: ignore + + self.stage_commands = [ - ["qemu-img", "convert", "-c", "-f", "raw", "-O", output, *options, lambda: f"{STORAGE_DIR}/{self.target_uuid}.body", f"{self.outdir}/{self.outname}.{output}"], + ["qemu-img", "convert", "-c", "-f", "raw", "-O", output, *convert_options, lambda: f"{STORAGE_DIR}/{self.target_uuid}.body", f"{self.outdir}/{self.outname}.{output}"], ["tar", "-C", self.outdir, "-czf", f"/tmp/{self.outname}.box", '.'], ["mv", f"/tmp/{self.outname}.box", self.outdir] ] diff --git a/iso/empanadas/empanadas/templates/vagrant/Vagrantfile.Vbox b/iso/empanadas/empanadas/templates/vagrant/Vagrantfile.Vbox index e69de29..36281be 100644 --- a/iso/empanadas/empanadas/templates/vagrant/Vagrantfile.Vbox +++ b/iso/empanadas/empanadas/templates/vagrant/Vagrantfile.Vbox @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + + # Example configuration of new VM.. + # + #config.vm.define :test_vm do |test_vm| + # Box name + # + #test_vm.vm.box = "rockylinux" + + # Domain Specific Options + # + # See README for more info. + + # Interfaces for VM + # + # Networking features in the form of `config.vm.network` + # + #test_vm.vm.network :private_network, :ip => '10.20.30.40' + #test_vm.vm.network :public_network, :ip => '10.20.30.41' + #end + + config.vm.base_mac = "080027FCE996" +end