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

Feature request: hyperv-iso builder vm configuration version #5984

Closed
SDedik opened this issue Mar 7, 2018 · 11 comments · Fixed by #7136
Closed

Feature request: hyperv-iso builder vm configuration version #5984

SDedik opened this issue Mar 7, 2018 · 11 comments · Fixed by #7136

Comments

@SDedik
Copy link

SDedik commented Mar 7, 2018

Hello,
At the moment packer hyperv-iso builder creates virtual machine with the latest configuration version available on the host. This is default Windows behavior as well. If virtual machine is created on Windows Server 2016 it has default configuration version of 8.0. Virtual machines created on Windows Server 2012 R2 have configuration version of 5.0.
Version of existing virtual machines can be seen with command below.
Get-VM | Select name, version

The problem is that Microsoft has significantly changed virtual machine configuration files between configuration versions 5.0 and 8.0 and they are not backwards compatible. In other words, if I create a vm template on Server 2016 I cannot import that template on Server 2012 due to configuration version incompatibility.
When creating virtual machine manually from PowerShell, this can be overwritten using -Version parameter like this:

New-VM -Name vm1 -Version 5.0
New-VM -Name vm2 -Version 8.0

It would be good to add this option to packer to produce virtual machine templates that can be imported on older versions of Hyper-V even if packer itself runs on the latest server version.

@bbrala
Copy link

bbrala commented Jul 13, 2018

I have the same problem, would be awesome, and seems to be quite straightforward to implement.

@SwampDragons SwampDragons added this to the v1.3.4 milestone Dec 6, 2018
@SwampDragons SwampDragons removed this from the v1.3.4 milestone Dec 6, 2018
@externl
Copy link

externl commented Dec 19, 2018

I just ran into this issue. Built a box on Windows 10. Tried to import into Windows Server 2016 and I'm getting the error:

Cause: VM version is unsupported

@SwampDragons
Copy link
Contributor

I've written a patch that allows you to set "configuration_version" on the hyper-v builder; see the linked PR for the patch. I'd love it if someone could test it out for me and verify that it works for you.

@azr azr closed this as completed in #7136 Jan 9, 2019
@SDedik
Copy link
Author

SDedik commented Jan 21, 2019

Thank you for implementing it!
A kind reminder though that respective documentation page hasn't been updated and this configuration option may be hard to discover for new users.

@SwampDragons
Copy link
Contributor

That's because the feature isn't released with Packer yet; We update the website and docs when the release goes live on our website. Currently this feature is only available on the master branch, so the docs aren't live yet.

@SwampDragons
Copy link
Contributor

oh, but that PR doesn't include docs-- adding them so they'll go out with the next release.

@SDedik
Copy link
Author

SDedik commented Jan 23, 2019

Much obliged!

@cbj4074
Copy link

cbj4074 commented Jun 17, 2019

Thanks for implementing this @SwampDragons !

I'm confused as to how, exactly, one should specify the configuration_version.

The documentation says only:

configuration_version (string) - This allows you to set the vm version when calling New-VM to generate the vm.

That doesn't tell me how to call New-VM to generate the vm. I've looked pretty hard and I can't find a single usage example that demonstrates how and where this directive should be specified.

Adding "configuration_version": "8.0", for example, to the builders object in bento\ubuntu\ubuntu-18.04-amd64.json does not in itself cause the generated VM to use the specified configuration version.

What additional step is required?

Thanks in advance for any guidance!

@cbj4074
Copy link

cbj4074 commented Jun 17, 2019

My apologies; I failed to realize that Packer 1.4.1 is required for this to work, and it does indeed work now that I've upgraded! 👏

@SwampDragons
Copy link
Contributor

Oh, good. This will become much clearer once we manage to implement versioned docs.

@ghost
Copy link

ghost commented Mar 28, 2020

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.

@hashicorp hashicorp locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants