-
Notifications
You must be signed in to change notification settings - Fork 180
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
base: main
Are you sure you want to change the base?
Conversation
Added below new functionality: 1 get_default_internal_switch 2 configure_dhcp
This PR has a dependency on #3573 |
lisa/tools/hyperv.py
Outdated
|
||
def _install(self) -> bool: | ||
assert isinstance(self.node.os, Windows) | ||
|
||
service: Service = self.node.tools[Service] |
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.
Move this line to when it's used. So when _check_exists
returns, it doesn't need to initialize the Service tool.
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.
Fixed
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.
It's not fixed, it should be moved above service.wait_for_service_start("vmms")
service: Service = self.node.tools[Service] | ||
|
||
# Install DHCP server | ||
self.node.tools[WindowsFeatureManagement].install_feature("DHCP") |
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.
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.
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.
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.
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.
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.
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.
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.
@@ -221,20 +235,21 @@ def exists_switch(self, name: str) -> bool: | |||
) | |||
return bool(output.strip() != "") | |||
|
|||
def delete_switch(self, name: str) -> None: | |||
def delete_switch(self, name: str, fail_on_error: bool = True) -> None: |
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.
remove the unused fail_on_error
flag.
Added below new functionality:
1. get_default_internal_switch
2. configure_dhcp