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 7 commits into
base: main
Choose a base branch
from

Conversation

SRIKKANTH
Copy link
Collaborator

Added below new functionality:
1. get_default_internal_switch
2. configure_dhcp

Added below new functionality:
    1 get_default_internal_switch
    2 configure_dhcp
@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

def _install(self) -> bool:
assert isinstance(self.node.os, Windows)

service: Service = self.node.tools[Service]
Copy link
Member

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Member

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")
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.

@@ -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:
Copy link
Member

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.

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