-
Notifications
You must be signed in to change notification settings - Fork 2
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 Discussion - use existing VHD #12
Comments
That's a very specific use-case you have there, and I'm not entirely sure if the best solution is to link it that tightly into the plugin. Especially seeing as all three of those suggested new requests are entirely Hyper-V unrelated. (The only reason I have delete-item in there is because that's literally the only way to remove a VHD) My suggestion to you would be to have a different process instead - with the addition of the fields I mentioned;
|
Hey, Thanks, that makes perfect sense! Kevin |
Hey Ace,
Currently, I have a puppet workflow that works like this:
Ensure d:\data\images exists on every hyperv server. Ensure base images (.vhdx) exist within it.
I specify the required VMs in hiera data as follows:
Based on the OS, the required image is copied from the data folder to the new directory for the VM. It is renamed to match the parent folder (the VM name).
Prepare_Vhd.ps1 is copied to the same directory, and executed. Prepare_VHD updates an unattend.xml file, copies the latest puppet agent msi, and sets puppet install to run on first boot:
I'm investigating options for porting this to the foreman. I'm currently thinking of something roughly like this.
Fog-hyperv:
New Methods:
requests/get_childitems.rb (generic) OR requests/get_vhds.rb:
Return array of VHDs found in path.
requests/copy_item.rb
requests/invoke_expression.rb
![image](https://user-images.githubusercontent.com/34070189/33447238-b2ac782a-d5d0-11e7-961e-f4a226f5993b.png)
New Models:
If using get_childitem,
Foreman_hyperv:
Add text field to virtual machine tab called “Path”. Set this as path to be used during vm creation.
Add an button to the virtual machine tab storage area called “Use local VHD”
If selected, display a select field (similar to the one used in app/views/compute_resources_vms/form/hyperv/_network.html.erb to show the switches).
Populate the options either using names for each item in an array of items returned by either get_childitem with *.vhdx as filter, or get_vhds.
Set a flag called useExistingVHD to true.
In /app/models/foreman_hyperv/hyperv.rb, if flag is true, set bootdevice to VHD. Add “path” option to vm creation.
If flag is set, do the following instead of create_volume.
It may be better to split it in to two parts, one part in foreman_hyperv that copies the required VHD and set's it as the boot device on the VM, and a second provisioning template that prepares the VHD before turning it on, but I'm not sure.
Do you think that's a reasonable plan?
Thanks,
Kevin
The text was updated successfully, but these errors were encountered: