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

HyperV builders has wrong params #1194

Closed
BoGnY opened this issue Apr 24, 2019 · 4 comments · Fixed by #1217
Closed

HyperV builders has wrong params #1194

BoGnY opened this issue Apr 24, 2019 · 4 comments · Fixed by #1217
Labels
Status: Untriaged An issue that has yet to be triaged.

Comments

@BoGnY
Copy link

BoGnY commented Apr 24, 2019

Version:

Cloned on 2019/04/24 with commit 9c5a0c4

Environment:

Windows 10 Pro build 1809
Packer v1.4.0

Scenario:

Building ubuntu-18.04.2-amd64 image

Steps to Reproduce:

packer validate ./ubuntu/ubuntu-18.04.2-amd64.json

Expected Result:

Validating packer image...
Template validation succeeded, but there were some warnings.
These are ONLY WARNINGS, and Packer will attempt to build the
template despite them, but they should be paid attention to.

Warnings for build 'hyperv-iso':

* Hyper-V might fail to create a VM if there is not enough free memory in the system.

Actual Result:

Validating packer image...
[warning] Fixable configuration found.
You may need to run `packer fix` to get your build to run
correctly. See debug log for more information.

Template validation failed. Errors are shown below.

Errors validating build 'hyperv-iso'. 2 errors occurred:
        * unknown configuration key: "cpu"
        * unknown configuration key: "ram_size"

I've solved the problem by changing ubuntu-18.04-amd64.json#L240 from:

"cpu": "{{ user `cpus` }}",

To:

"cpus": "{{user `cpus`}}",

And changing ubuntu-18.04-amd64.json#L249 from:

"ram_size": "{{user `memory`}}",

To:

"memory": "{{user `memory`}}",

I've rapidly see that all ubuntu-x64 json are misconfigured, so it's not limitated to v18.04..

For repo owner, can I make PR to fix it??

@BoGnY BoGnY added the Status: Untriaged An issue that has yet to be triaged. label Apr 24, 2019
@cheeseplus
Copy link
Contributor

I was the one who added and built these (they aren't regularly built) so these options definitely worked in the past. I think Packer changed this internally at some point so a PR is welcome if that's no longer valid.

@BoGnY
Copy link
Author

BoGnY commented Apr 26, 2019

Ok, but anyone can merge #1192 before???
So I can fix HyperV params in all builds, even 19.04, with a single commit/PR??

@cheeseplus
Copy link
Contributor

#1192 has been merged.

@markschuh
Copy link

The HyperV params were indeed changed due to conformity with hashicorp/packer#7447.

The change within packer includes a fixer, so running on a linux with packer version >=1.4.0 in path a command like

for template in $(grep --recursive --include=\*.json --files-with-matches '"type"\s*:\s*"hyperv-iso"' .); do
  packer fix $template >$template.fixed && mv $template.fixed $template
done

should do the necessary template changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Untriaged An issue that has yet to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants