-
Notifications
You must be signed in to change notification settings - Fork 24
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
fix: #7 #115
fix: #7 #115
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @remi-espie,
Thanks for this PR!
By curiosity, have you tested it in your setup since you hit the problem described in the issue? Did that fix it?
I'm not a Hyper-V expert at all, so I'll have to rely on your expertise here, but the code looks good to me, just want to confirm it does work at least in your env, and I left a quick suggestion regarding the removal of the image.
Let me know when you have time to address the suggestion I left, and I'll do a second pass after that.
Co-authored-by: Lucas Bajolet <[email protected]>
Hello ! Thanks for the great suggestion, I just added it ! To answer your initial question :
I'm not a Hyper-V expert either, I just worked with it recently. I tested it one time and it worked flawlessly: the VM is still registered in Hyper-V and you can use it without issue afterward. However, as I said, the artifacts stay located in the build directory in the user's TEMP folder, which does not seems to be ideal. |
This is a good point, I'm not sure what the artifact produced by Packer looks like for Hyper-V, but in this case it might be a good idea to export the files in a separate location then? This may signal we should have an If you agree and decide to go with the Let us know what you think, and thanks for the quick turnaround time! |
For Hyper-V, the artifacts consists of a few folder with data about the VM (like network interface, CPU number, etc) in .vmxc files and the VM as a .vhdx file. I believe Windows does not flush the TEMP folder at each shutdown, however I also think that an I won't be able to work on this new option in the following weeks, so it may be better to create a new PR that would add the |
I don't think we'll be able to work on this soon as well, so regarding this PR that's up to you, I don't mind leaving it open with the discussion readily available, and either you can pick it up when you have time, or someone else may piggyback off it and add the missing attribute. If you prefer to start with a clean slate, feel free to close it and we'll review the output directory PR when available for sure. Thanks! |
Hello @lbajolet-hashicorp . I just noticed that the Hyper-V plugin has a What do you think I should do ? I may supersede |
Hi @remi-espie, Regarding the We could probably rename the attribute to something more explicit regarding how it's meant to be used (I'm thinking something like In the end then yes, let's continue with this PR so the directory doesn't get wiped, and let's point out that Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the rerolls @remi-espie !
Something still off with the combination of parms to get this to work I have the following params that I believe are relevant to delivering a working VM in Hyper-V manager:
I have no HyperV "Virtual Machine" files appear to remain in the build folder below The VM listed in HyperV manager will not start - complains about missing disk files. WHen I move the Virtual DIsk folder below the build folder, then complains about incorrect perms. Ulitimately perhaps I'm abusing packer to create VM instances rather than images, but then perhaps packer 1.9.4 with hyperv plugin 1.1.3 |
Hello @pmcevoy, I've tested your configuration, and turns out, |
When the
keep_registered
flag was true, the VM stayed in HyperV manager, but its files were deleted anyway, making it impossible to use the VM as-is.This PR makes the VM's files cleanup look for the
keep_registered
flag, and if set to true, will not delete the VM files, keeping it usable.However, the VM files stays in the temp folder. We may want to move the files to another location beforehand if the flag is up.
This PR closes #7 .