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

[machine]:windows node setup #13

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

bobsira
Copy link

@bobsira bobsira commented Sep 20, 2024

This pull request introduces significant changes to the Hyper-V driver to support Windows Server VHD images. The most important changes include adding new fields to the Driver struct, updating the driver creation and pre-create check methods, and implementing a new method for handling SSH keys in VHDX files.

Support for Windows Server VHD:

  • drivers/hyperv/hyperv.go: Added new fields WindowsVHDUrl and OS to the Driver struct, and set default values for Windows Server VHD URL and image filename. Updated the NewDriver function to initialize WindowsVHDUrl with the default value. [1] [2] [3]

Driver creation and pre-create check updates:

  • drivers/hyperv/hyperv.go: Modified the PreCreateCheck and Create methods to handle the download and setup of Windows Server VHD images. Added logic to differentiate between Linux and Windows guest OS during the creation process. [1] [2] [3] [4]

New method for handling SSH keys in VHDX files:

  • drivers/hyperv/hyperv.go: Implemented the writeSSHKeyToVHDX method to mount the VHDX file, create the necessary directories, and write the public SSH key to the appropriate location.

Updates to libmachine:

  • libmachine/libmachine.go: Added GuestOS field to the Host struct and updated the NewHost method to accept a guestOS parameter. Introduced the DefineGuest method to set the guest OS utility. [1] [2] [3] [4]

Enhancements to b2d utilities:

  • libmachine/mcnutils/b2d.go: Added methods to handle VHD paths and check for VHD existence. Introduced DownloadVHD and UpdateVHDCache methods for downloading and caching Windows Server VHD images. [1] [2] [3] [4] [5]

@bobsira bobsira marked this pull request as ready for review January 1, 2025 09:22
@bobsira bobsira changed the title [DRAFT] Windows node setup Windows node setup Jan 1, 2025
@bobsira bobsira changed the title Windows node setup windows node setup Feb 27, 2025
@bobsira bobsira changed the title windows node setup [machine]:windows node setup Feb 27, 2025
@@ -560,3 +558,50 @@ func (d *Driver) generateDiskImage() (string, error) {

return diskImage, nil
}

func writeSSHKeyToVHDX(vhdxPath, publicSSHKeyPath string) error {
mountDir := "E:\\"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail if I have an existing drive E on my computer. Can we retrieve the assigned drive letter after mount?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants