From 315cfe1edd461e69fcd29e5ae48a20f627c6af66 Mon Sep 17 00:00:00 2001
From: Kri5 <christophe.courtaut@gmail.com>
Date: Fri, 3 May 2024 11:20:45 +0200
Subject: [PATCH] Fixes additional disks with Virtualbox for Vagrant (#11091)

When using the kube_node_instancers_with_disks* variables, there were
no configuration block using those to provision disks with the
VirtualBox provider.

This commit fixes it.
---
 Vagrantfile | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Vagrantfile b/Vagrantfile
index 9ad139975..604231d1a 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -185,6 +185,14 @@ Vagrant.configure("2") do |config|
             lv.storage :file, :device => "hd#{driverletters[d]}", :path => "disk-#{i}-#{d}-#{DISK_UUID}.disk", :size => $kube_node_instances_with_disks_size, :bus => "scsi"
           end
         end
+        node.vm.provider :virtualbox do |vb|
+          # always make /dev/sd{a/b/c} so that CI can ensure that
+          # virtualbox and libvirt will have the same devices to use for OSDs
+          (1..$kube_node_instances_with_disks_number).each do |d|
+            vb.customize ['createhd', '--filename', "disk-#{i}-#{driverletters[d]}-#{DISK_UUID}.disk", '--size', $kube_node_instances_with_disks_size] # 10GB disk
+            vb.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', d, '--device', 0, '--type', 'hdd', '--medium', "disk-#{i}-#{driverletters[d]}-#{DISK_UUID}.disk", '--nonrotational', 'on', '--mtype', 'normal']
+          end
+        end
       end
 
       if $expose_docker_tcp
-- 
GitLab