drop support for virtualbox

This commit is contained in:
Rui Lopes
2024-03-21 13:02:03 +00:00
parent a2c08f8bb1
commit b51b7d4f8a
6 changed files with 8 additions and 114 deletions

View File

@@ -5,13 +5,12 @@ VAR_FILE :=
VAR_FILE_OPTION := $(addprefix -var-file=,$(VAR_FILE))
help:
@echo type make build-libvirt, make build-uefi-libvirt, make build-proxmox, make build-uefi-proxmox, make build-virtualbox, make build-hyperv, or make build-vsphere
@echo type make build-libvirt, make build-uefi-libvirt, make build-proxmox, make build-uefi-proxmox, make build-hyperv, or make build-vsphere
build-libvirt: proxmox-ve-amd64-libvirt.box
build-uefi-libvirt: proxmox-ve-uefi-amd64-libvirt.box
build-proxmox: proxmox-ve-amd64-proxmox.box
build-uefi-proxmox: proxmox-ve-uefi-amd64-proxmox.box
build-virtualbox: proxmox-ve-amd64-virtualbox.box
build-hyperv: proxmox-ve-amd64-hyperv.box
build-vsphere: proxmox-ve-amd64-vsphere.box
@@ -73,20 +72,6 @@ proxmox-ve-uefi-amd64-proxmox.box: provisioners/*.sh proxmox-ve.pkr.hcl Vagrantf
PKR_VAR_vagrant_box=$@ \
packer build -only=proxmox-iso.proxmox-ve-uefi-amd64 -on-error=abort -timestamp-ui $(VAR_FILE_OPTION) proxmox-ve.pkr.hcl
proxmox-ve-amd64-virtualbox.box: provisioners/*.sh proxmox-ve.pkr.hcl Vagrantfile.template $(VAR_FILE)
rm -f $@
CHECKPOINT_DISABLE=1 \
PACKER_LOG=1 \
PACKER_LOG_PATH=$@.init.log \
packer init proxmox-ve.pkr.hcl
PACKER_OUTPUT_BASE_DIR=$${PACKER_OUTPUT_BASE_DIR:-.} \
CHECKPOINT_DISABLE=1 \
PACKER_LOG=1 \
PACKER_LOG_PATH=$@.log \
PKR_VAR_vagrant_box=$@ \
packer build -only=virtualbox-iso.proxmox-ve-amd64 -on-error=abort -timestamp-ui $(VAR_FILE_OPTION) proxmox-ve.pkr.hcl
@./box-metadata.sh virtualbox proxmox-ve-amd64 $@
proxmox-ve-amd64-hyperv.box: provisioners/*.sh proxmox-ve.pkr.hcl Vagrantfile.template $(VAR_FILE)
rm -f $@
mkdir -p tmp
@@ -124,4 +109,4 @@ proxmox-ve-amd64-vsphere.box: provisioners/*.sh proxmox-ve-vsphere.pkr.hcl $(VAR
clean:
rm -rf packer_cache $${PACKER_OUTPUT_BASE_DIR:-.}/output-proxmox-ve*
.PHONY: help build-libvirt build-virtualbox build-hyperv clean
.PHONY: help build-libvirt build-uefi-libvirt build-proxmox build-uefi-proxmox build-hyperv build-vsphere clean

View File

@@ -12,25 +12,25 @@ After the example vagrant environment is started, you can access the [Proxmox We
For a cluster example see [rgl/proxmox-ve-cluster-vagrant](https://github.com/rgl/proxmox-ve-cluster-vagrant).
## libvirt/VirtualBox
## libvirt
Create the base box:
```bash
make build-libvirt # or build-virtualbox
make build-libvirt
```
Add the base box as suggested in make output:
```bash
vagrant box add -f proxmox-ve-amd64 proxmox-ve-amd64-libvirt.box # or proxmox-ve-amd64-virtualbox.box
vagrant box add -f proxmox-ve-amd64 proxmox-ve-amd64-libvirt.box
```
Start the example vagrant environment with:
```bash
cd example
vagrant up --no-destroy-on-error --provider=libvirt # or --provider=virtualbox
vagrant up --no-destroy-on-error --provider=libvirt
```
## Proxmox
@@ -211,7 +211,7 @@ tied to a specific Proxmox VE version. Also take care when you decide to overrid
Create the base box:
```bash
make build-libvirt VAR_FILE=example.pkrvars.hcl # or build-virtualbox or build-hyperv
make build-libvirt VAR_FILE=example.pkrvars.hcl
```
The following content of `example.pkrvars.hcl`:

View File

@@ -9,7 +9,4 @@ Vagrant.configure(2) do |config|
lv.channel :type => 'unix', :target_name => 'org.qemu.guest_agent.0', :target_type => 'virtio'
lv.channel :type => 'spicevmc', :target_name => 'com.redhat.spice.0', :target_type => 'virtio'
end
config.vm.provider 'virtualbox' do |vb|
vb.customize ['modifyvm', :id, '--firmware', 'efi']
end
end

6
example/Vagrantfile vendored
View File

@@ -18,12 +18,6 @@ Vagrant.configure('2') do |config|
lv.machine_virtual_size = VM_ROOT_DISK_SIZE_GB
config.vm.synced_folder '.', '/vagrant', type: 'nfs', nfs_version: '4.2', nfs_udp: false
end
config.vm.provider :virtualbox do |vb|
vb.linked_clone = true
vb.memory = VM_MEMORY_GB*1024
vb.cpus = VM_CPU
vb.customize ['modifyvm', :id, '--nested-hw-virt', 'on']
end
config.vm.provider :hyperv do |hv, config|
hv.vmname = "#{File.basename(File.dirname(File.dirname(__FILE__)))}-example"
hv.linked_clone = true

View File

@@ -39,25 +39,7 @@ chown -R vagrant:vagrant .
popd
# install the Guest Additions.
if [ -n "$(lspci | grep VirtualBox)" ]; then
# install the VirtualBox Guest Additions.
# this will be installed at /opt/VBoxGuestAdditions-VERSION.
# NB You can unpack the VBoxLinuxAdditions.run file contents with:
# VBoxLinuxAdditions.run --target /tmp/VBoxLinuxAdditions.run.contents --noexec
# NB REMOVE_INSTALLATION_DIR=0 is to fix a bug in VBoxLinuxAdditions.run.
# See http://stackoverflow.com/a/25943638.
apt-get -y -q install gcc dkms pve-headers
mkdir -p /mnt
mount /dev/sr1 /mnt
while [ ! -f /mnt/VBoxLinuxAdditions.run ]; do sleep 1; done
# NB we ignore exit code 2 (cannot find vboxguest module) because of what
# seems to be a bug in VirtualBox 5.1.20. there isn't actually a problem
# loading the module.
REMOVE_INSTALLATION_DIR=0 /mnt/VBoxLinuxAdditions.run --target /tmp/VBoxGuestAdditions || [ $? -eq 2 ]
rm -rf /tmp/VBoxGuestAdditions
umount /mnt
eject /dev/sr1
elif [ -n "$(lspci | grep VMware | head -1)" ]; then
if [ -n "$(lspci | grep VMware | head -1)" ]; then
# install the VMware Guest Additions.
# NB the open-vm-tools package was already installed from the packer boot_command.
true

View File

@@ -10,11 +10,6 @@ packer {
version = "1.1.7"
source = "github.com/hashicorp/proxmox"
}
# see https://github.com/hashicorp/packer-plugin-virtualbox
virtualbox = {
version = "1.0.5"
source = "github.com/hashicorp/virtualbox"
}
# see https://github.com/hashicorp/packer-plugin-hyperv
hyperv = {
version = "1.1.3"
@@ -375,63 +370,6 @@ source "proxmox-iso" "proxmox-ve-uefi-amd64" {
]
}
source "virtualbox-iso" "proxmox-ve-amd64" {
guest_os_type = "Debian_64"
guest_additions_mode = "upload"
headless = true
http_directory = "."
vboxmanage = [
["modifyvm", "{{.Name}}", "--memory", var.memory],
["modifyvm", "{{.Name}}", "--cpus", var.cpus],
["modifyvm", "{{.Name}}", "--nested-hw-virt", "on"],
["modifyvm", "{{.Name}}", "--vram", "16"],
["modifyvm", "{{.Name}}", "--graphicscontroller", "vmsvga"],
["modifyvm", "{{.Name}}", "--audio", "none"],
["modifyvm", "{{.Name}}", "--nictype1", "82540EM"],
["modifyvm", "{{.Name}}", "--nictype2", "82540EM"],
["modifyvm", "{{.Name}}", "--nictype3", "82540EM"],
["modifyvm", "{{.Name}}", "--nictype4", "82540EM"],
]
vboxmanage_post = [
["storagectl", "{{.Name}}", "--name", "IDE Controller", "--remove"],
]
disk_size = var.disk_size
hard_drive_interface = "sata"
hard_drive_discard = true
iso_url = var.iso_url
iso_checksum = var.iso_checksum
output_directory = "${var.output_base_dir}/output-{{build_name}}"
ssh_username = "root"
ssh_password = "vagrant"
ssh_timeout = "60m"
boot_wait = "5s"
boot_command = [
"<enter>",
"<wait5m>",
"<enter><wait>",
"<enter><wait>",
"${var.step_country}<tab><wait>",
"${var.step_timezone}<tab><wait>",
"${var.step_keyboard_layout}<tab><wait>",
"<tab><wait>",
"<enter><wait5>",
"vagrant<tab><wait>",
"vagrant<tab><wait>",
"${var.step_email}<tab><wait>",
"<tab><wait>",
"<enter><wait5>",
"${var.step_hostname}<tab><wait>",
"<tab><wait>",
"<tab><wait>",
"<tab><wait>",
"<tab><wait>",
"<tab><wait>",
"<enter><wait5>",
"<enter><wait5>",
]
shutdown_command = "poweroff"
}
source "hyperv-iso" "proxmox-ve-amd64" {
temp_path = "tmp"
headless = true
@@ -495,7 +433,6 @@ build {
"source.qemu.proxmox-ve-uefi-amd64",
"source.proxmox-iso.proxmox-ve-amd64",
"source.proxmox-iso.proxmox-ve-uefi-amd64",
"source.virtualbox-iso.proxmox-ve-amd64",
"source.hyperv-iso.proxmox-ve-amd64",
]
@@ -512,7 +449,6 @@ build {
only = [
"qemu.proxmox-ve-amd64",
"hyperv-iso.proxmox-ve-amd64",
"virtualbox-iso.proxmox-ve-amd64",
]
output = var.vagrant_box
vagrantfile_template = "Vagrantfile.template"