Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement Request: Support configuration of default storage controller and type VirtIO #13506

Open
VanNostrand opened this issue Oct 4, 2024 · 0 comments

Comments

@VanNostrand
Copy link

I want to configure the default storage controller to be of type virtio but at the moment it seems to be impossible to configure the default storage controller in any way.
I mean I can create a new virtualbox instance with vagrant, open the GUI and just switch the type from AHCI to virtio-scsi. It is trivial and the VM works - but there is no such function in vagrant.

In the Vagrantfile I could always add a controller via e.g.

vb.customize ["storagectl", :id, "--name", "VirtIO Controller", "--add", "virtio", "--controller", "VirtIO"]

but the default SATA AHCI controller has already been created before that happens.
It also means the default disk is attached to that controller automatically and I have no chance to plug it into the other one.
And when I remove the SATA AHCI controller via vagrant then the system has no disk attached.

And if I try to attach the system disk that has previously and automatically been created I found out that either Vagrant or Virtualbox always tries to look in the current directory for the vmdk file instead of ~/.VirtualBox/Machines/myvm/. I tried to trick it by providing a path with a couple of ../../../ entries to ensure the path points to the box.vmdk in the ~/.VirtualBox/Machines/myvm/ subdirectory but then the VirtualBox tooling tells me that this file was supposed to not be attached to that controller because some of its dumb xml files says so (sorry, I did not keep the error, because I was about to shoot the computer after 12 hours of dealing with that issue) and in another approach I also specified the disk's UUID, which according to the VBoxManage help would be a valid option, but VBoxManage tried to treat that UUID as a literal filename...

I am not sure how Vagrant exactly configures the default controller and disk. In action.rb I can see this:

      b.use CleanupDisks
      b.use Disk
      b.use Customize, "pre-boot"
      b.use Boot
      b.use Customize, "post-boot"

and if all customize commands are implied to be used in the pre-boot stage (like setting the amount of CPUs and RAM size etc), then I have no influence on setting the default disk.

When I grep through the sources, the virtio driver is never mentioned anywhere too. I can see the following:

  class StorageController
    IDE_CONTROLLER_TYPES = ["PIIX4", "PIIX3", "ICH6"].map(&:freeze).freeze
    SATA_CONTROLLER_TYPES = ["IntelAhci"].map(&:freeze).freeze
    SCSI_CONTROLLER_TYPES = [ "LsiLogic", "BusLogic"].map(&:freeze).freeze

But there is no virtio. My storagectl from above probably just works because it is passed 1:1 to VBoxManage somehow:

VBoxManage storagectl <uuid | vmname> <--name=controller-name> [--add= floppy | ide | pcie | sas | sata | scsi | usb ] [--controller= BusLogic | I82078 | ICH6 | IntelAhci | LSILogic | LSILogicSAS | NVMe | PIIX3 | PIIX4 | USB | VirtIO ] [--bootable= on | off ] [--hostiocache= on | off ] [--portcount=count] [--remove] [--rename=new-controller-name]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant