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 improvements for DHCP and default switch #3578

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

Conversation

SRIKKANTH
Copy link
Collaborator

@SRIKKANTH SRIKKANTH commented Jan 2, 2025

Added below new functionality:
1. get_default_internal_switch
2. configure_dhcp

These changes improve the HyperV tool by adding new functionality to get the default internal switch and configure DHCP to set HyperV environment in an Azure Windows Server Host.

Reference doc:
https://techcommunity.microsoft.com/blog/itopstalkblog/how-to-setup-nested-virtualization-for-azure-vmvhd/1115338

@SRIKKANTH
Copy link
Collaborator Author

This PR has a dependency on #3573

lisa/tools/hyperv.py Outdated Show resolved Hide resolved
lisa/tools/hyperv.py Outdated Show resolved Hide resolved
lisa/tools/hyperv.py Outdated Show resolved Hide resolved
lisa/tools/hyperv.py Outdated Show resolved Hide resolved
service: Service = self.node.tools[Service]

# Install DHCP server
self.node.tools[WindowsFeatureManagement].install_feature("DHCP")
Copy link
Member

Choose a reason for hiding this comment

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

When is it needed? Hyper-V can assign IP addresses to VMs, it doens't need the DHCP server. When using the DHCP server, it's need to be careful, because it may conflict with lab DHCP.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In Lab, nested VMs will get IPs from LAN DHCP using external Hyper-V Switch.
In Azure Windows Hyper-V hosts, We need to setup our own DHCP server with Internal Switch.

This will be used only in "HyperVPreparationTransformer" not in common Hyper-V environment setup.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In Lab, nested VMs will get IPs from LAN DHCP using external Hyper-V Switch.
In Azure Windows Hyper-V hosts, We need to setup our own DHCP server with Internal Switch.

This will be used only in "HyperVPreparationTransformer" not in common Hyper-V environment setup.

Copy link
Member

Choose a reason for hiding this comment

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

In Azure Windows Hyper-V hosts, We need to setup our own DHCP server with Internal Switch.

Can you include a reference of official public document on how it works in the code comment? I need to take a look, and the code needs to be documented by comments also. My understanding is that the internal network is managed by HyperV, including IP address assignment. And the external switch doesn't work, if no extra IP address is assigned in the subnet on Azure.

Copy link
Collaborator Author

@SRIKKANTH SRIKKANTH Jan 9, 2025

Choose a reason for hiding this comment

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

I added the reference doc to the PR description. Repasting it here as well.

https://techcommunity.microsoft.com/blog/itopstalkblog/how-to-setup-nested-virtualization-for-azure-vmvhd/1115338

" My understanding is that the internal network is managed by HyperV, including IP address assignment." - This may be true on Windows desktop versions but I found DHCP config needed on Win server 2025.

lisa/tools/hyperv.py Outdated Show resolved Hide resolved
lisa/tools/hyperv.py Outdated Show resolved Hide resolved
Hyperv improvements for DHCP and default switch

Added below new functionality:
    1 get_default_internal_switch
    2 configure_dhcp
@SRIKKANTH SRIKKANTH force-pushed the smyakam/hyperv_changes_01_02_2024 branch from a2981fe to e0f68ab Compare January 9, 2025 19:45
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