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

WSL2/HyperV additional disk is created in incorrect directory and it is not cleaned/fails on reup #12069

Open
Venthe opened this issue Nov 23, 2020 · 2 comments

Comments

@Venthe
Copy link

Venthe commented Nov 23, 2020

Vagrant version

2.2.14

Host operating system

Windows 10 20h2 (19042.630)

Guest operating system

generic/ubuntu2010

Vagrantfile

VAGRANTFILE_API_VERSION ||= "2"
IMAGE_NAME ||= "generic/ubuntu2010"
IMAGE_VERSION ||= "3.1.6"
DEPLOYMENT_NAME ||= "test-k8s"

NODE_COUNT ||= 1
WORKER_NODE_NAME ||= "#{DEPLOYMENT_NAME}-worker-node"
WORKER_NODE_MEMORY ||= 8192
WORKER_NODE_CPU_COUNT ||= 4

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    config.vm.box = IMAGE_NAME
    config.vm.box_version = IMAGE_VERSION
    config.vm.provider "hyperv"

    config.vm.provider :hyperv do |hyperv|
        hyperv.enable_virtualization_extensions = true
        hyperv.linked_clone = true
    end

    config.vm :hyperv do |vm|
        vm.synced_folder ".", "/vagrant", disabled: true
        vm.network "public_network"
    end

    (1..NODE_COUNT ).each do |i|
        config.vm.define "#{WORKER_NODE_NAME}-#{i}" do |workerNode|
            [:virtualbox, :hyperv].each do |provider|
                workerNode.vm.provider provider do |vm_provider|
                    vm_provider.memory = WORKER_NODE_MEMORY
                    vm_provider.cpus = WORKER_NODE_CPU_COUNT
                end
            end
            workerNode.vm.provider :hyperv do |hyperv|
                hyperv.vmname = "#{WORKER_NODE_NAME}-#{i}"
                hyperv.maxmemory = WORKER_NODE_MEMORY
            end
            workerNode.vm.disk :disk, name: "./cephfs-#{i}", size: "100GB"
        end
    end
end

Expected behavior

Disk is cleaned and I am able to run vagrant
Disks are created in \mnt\i\PATH_TO_VAGRANTFILE

Actual behavior

An error occurred while executing a PowerShell script. This error                                                                                                                                                                                                                             is shown below. Please read the error message and see if this is                                                                                                                                                                                                                              a configuration error with your system. If it is not, then please                                                                                                                                                                                                                             report a bug.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               Script: new_vhd.ps1                                                                                                                                                                                                                                                                           Error:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Failed to create disk : Failed to create the virtual hard disk.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             The system failed to create 'I:\mnt\i\Repositories\Personal-Development-Pipeline\provisioning\cluster_vagrant\.vagrant\machines\test-k8s-worker-node-1\hyperv\Virtual Hard Disks\cephfs-1.vhdx'.                                                                                                                                                                                                                                                                                                                                                                                            Failed to create the virtual hard disk.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     The system failed to create 'I:\mnt\i\Repositories\Personal-Development-Pipeline\provisioning\cluster_vagrant\.vagrant\machines\test-k8s-worker-node-1\hyperv\Virtual Hard Disks\cephfs-1.vhdx': The file exists. (0x80070050).

Disks are created in i:\mnt\i\PATH_TO_VAGRANTFILE

Steps to reproduce

Configured Windows 10 and WSL2

echo 'export VAGRANT_WSL_WINDOWS_ACCESS_USER_HOME_PATH="/mnt/i"' >> ~/.bashrc
echo 'export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"' >> ~/.bashrc
echo 'export VAGRANT_DEFAULT_PROVIDER=hyperv' >> ~/.bashrc
echo 'export VAGRANT_EXPERIMENTAL="disks"' >> ~/.bashrc
# Set in /etc/wsl.conf I have the follow configuration
[automount]
enabled = true
root = /mnt/
options = "metadata,umask=22,fmask=11"
  1. Open Ubuntu WSL2 as administrator.
  2. Run vagrant up
  3. Run vagrant destroy --force
  4. Run vagrant up

Please note: Project is in WSL2 mountpoint of /mnt/i/PATH_TO_VAGRANTFILE, but actual disk is provided from i:\mnt\i\PATH_TO_VAGRANTFILE

@Venthe
Copy link
Author

Venthe commented Nov 23, 2020

Pinging @briancain

@haydenseitz
Copy link

This may be a similar issue to #12643. If so, it may be resolved with my pending PR: #12690 (waiting for a reviewer)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants