Vagrant: Hyper-V Configuration Version Checks

Created on 8 Nov 2018  ·  7Comments  ·  Source: hashicorp/vagrant

Prior to import check the configuration version of the Hyper-V VM and validate the host is able to support the version.

Reference: https://github.com/hashicorp/vagrant/issues/9317#issuecomment-437025611

enhancement providehyperv

Most helpful comment

@cbj4074 You can also add the following key to the homestead.yaml file;
version: 6.3.0

All 7 comments

Thanks for making this change, @chrisroberts .

I'm still wrestling with https://github.com/laravel/homestead/issues/974 , and with this change in place (Vagrant 2.2.1), I now see the following on the initial vagrant up, instead of an empty string for the Error:

Bringing machine 'homestead-7' up with 'hyperv' provider...
==> homestead-7: Verifying Hyper-V is enabled...
==> homestead-7: Verifying Hyper-V is accessible...
==> homestead-7: Importing a Hyper-V instance
    homestead-7: Creating and registering the VM...
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: import_vm.ps1
Error:

Failed to import a virtual machine.

Error Code: 32784
Cause: VM version is unsupported

What does VM version is unsupported actually mean, though? In other words, what values are being examined and compared when making this determination? In looking at https://github.com/hashicorp/vagrant/blob/master/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1#L368 , the error code seems to come straight out of WMI, from the Msvm_ConcreteJob table.

Albeit a bit dated, https://support.microsoft.com/en-us/help/2868279/importing-a-vm-that-is-exported-from-windows-server-2012-r2-into-windo says of error code 32784:

Hyper-V did not find virtual machines to import from the location .

How shall I determine what the real issue is here?

Everything I've read, e.g.,

suggests that VMs configured for older versions of Hyper-V should work in newer versions (just not the other way around).

Given that the maximum supported configuration version on my machine is 8.3, which I believe to be the latest available, I'm surprised to receive this error when trying to import.

Thanks for any further light you may be able to shed on this error condition! I really appreciate your time.

My apologies; it's definitely an issue with the box, because I tried a slightly older version of it and it works with the Hyper-V provider. So, it seems to be some type of regression.

And, the problem has nothing to do with Vagrant, as evidenced by the fact that if I attempt to import the VM directly through the Hyper-V Manager, it reports No virtual machine files found in the box directory, so something is definitely wrong with the box and/or its configuration.

Thanks again for making this error message much more helpful than in versions past. 👍

@cbj4074 You can also add the following key to the homestead.yaml file;
version: 6.3.0

Thanks @vmadev ! I ended-up baking my own box with Packer because I didn't want to be "stuck" on an aging box until my organization rolls-out Windows 10 Build 1809 (the one that has been infamously disastrous thus far).

Ultimately, the problem was that Homestead >= 6.4.0 is made on Windows 10 Build 1809, and thus requires Hyper-V configuration >= 9.0. While I wish the error message was more explicit about that, it's probably not within Vagrant's purview to be that specific as to the underlying reason. I'm just happy that the error is no longer an empty string. :)

It is unfortunate that people are posting HyperV boxes that cannot even support a 2 year old OS version (1803). Corporate images are not updated so often.

@genotrance Indeed. I suspect that it is mostly out of ignorance and not so much by choice.

The fact is that configuration version 8.0 is plenty adequate for most boxes (it includes all of the modern sleep/hibernate capabilities that make earlier configuration versions less than ideal) and it supports Windows 10 at least as far back as 1803.

Anyone who is interested in how to specify an arbitrary target configuration version in Packer can take a look at the discussion in https://github.com/laravel/homestead/issues/974#issuecomment-502788988 for examples.

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings