I am trying to provision identical drives for a ZFS sandbox vm to learn ZFS 
but it seems to only create the first drive and then fail

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"
  (1..5).each do |hd|
      config.vm.provider :virtualbox do |v|
                puts "harddrive #{hd}"
                v.customize ['createmedium', '--filename', 
"./disk#{hd}.vdi",'--variant', 'Fixed', '--size', 20 * 1024]

                v.customize ['storageattach', :id,  '--storagectl', 'IDE', 
'--device', hd, '--type', 'hdd', '--medium', "./disk#{hd}.vdi"]
  end
  end
end


Output....
$vagrant up

harddrive 1
harddrive 2
harddrive 3
harddrive 4
harddrive 5
harddrive 1
harddrive 2
harddrive 3
harddrive 4
harddrive 5
harddrive 1
harddrive 2
harddrive 3
harddrive 4
harddrive 5
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'centos/7' version '1905.1' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
A customization command failed:

["createmedium", "--filename", "./disk1.vdi", "--variant", "Fixed", 
"--size", 20480]

The following error was experienced:

#<Vagrant::Errors::VBoxManageError: There was an error while executing 
`VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["createmedium", "--filename", "./disk1.vdi", "--variant", 
"Fixed", "--size", "20480"]

Stderr: 0%...
Progress state: VBOX_E_FILE_ERROR
VBoxManage: error: Failed to create medium
VBoxManage: error: Could not create the medium storage unit 
'/home/brian/projects/centos/disk1.vdi'.
VBoxManage: error: VDI: cannot create image 
'/home/brian/projects/centos/disk1.vdi' (VERR_ALREADY_EXISTS)
VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component 
MediumWrap, interface IMedium
VBoxManage: error: Context: "RTEXITCODE handleCreateMedium(HandlerArg*)" at 
line 462 of file VBoxManageDisk.cpp
>

Please fix this customization and try again.



-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/126acb4c-ad09-40bf-bc11-8e15c84a091a%40googlegroups.com.

Reply via email to