-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(azure): add apply_network_config_set_name option to disable renames #6807
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -295,6 +295,7 @@ def get_resource_disk_on_freebsd(port_id) -> Optional[str]: | |||||
| "disk_aliases": {"ephemeral0": RESOURCE_DISK_PATH}, | ||||||
| "apply_network_config": True, # Use IMDS published network configuration | ||||||
| "apply_network_config_for_secondary_ips": True, # Configure secondary ips | ||||||
| "apply_network_config_set_name": True, # Use set-name for NICs | ||||||
| "experimental_skip_ready_report": False, # Skip final ready report | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -362,6 +363,10 @@ def _unpickle(self, ci_pkl_version: int) -> None: | |||||
| self._system_uuid = None | ||||||
| self._vm_id = None | ||||||
| self._wireserver_endpoint = DEFAULT_WIRESERVER_ENDPOINT | ||||||
| self.ds_cfg.setdefault( | ||||||
| "apply_network_config_set_name", | ||||||
| BUILTIN_DS_CONFIG["apply_network_config_set_name"], | ||||||
| ) | ||||||
|
|
||||||
| def __str__(self): | ||||||
| root = sources.DataSource.__str__(self) | ||||||
|
|
@@ -1619,6 +1624,9 @@ def _generate_network_config(self): | |||||
| apply_network_config_for_secondary_ips=self.ds_cfg.get( | ||||||
| "apply_network_config_for_secondary_ips" | ||||||
| ), | ||||||
| apply_network_config_set_name=self.ds_cfg.get( | ||||||
| "apply_network_config_set_name" | ||||||
| ), | ||||||
|
Comment on lines
1624
to
+1629
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that |
||||||
| ) | ||||||
| except Exception as e: | ||||||
| LOG.error( | ||||||
|
|
@@ -2095,6 +2103,7 @@ def generate_network_config_from_instance_network_metadata( | |||||
| network_metadata: dict, | ||||||
| *, | ||||||
| apply_network_config_for_secondary_ips: bool, | ||||||
| apply_network_config_set_name: bool = True, | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need a default value on this mandatory param as we are setting it in both
Suggested change
|
||||||
| ) -> dict: | ||||||
| """Convert imds network metadata dictionary to network v2 configuration. | ||||||
|
|
||||||
|
|
@@ -2108,7 +2117,11 @@ def generate_network_config_from_instance_network_metadata( | |||||
| # First IPv4 and/or IPv6 address will be obtained via DHCP. | ||||||
| # Any additional IPs of each type will be set as static | ||||||
| # addresses. | ||||||
| nicname = "eth{idx}".format(idx=idx) | ||||||
| mac = normalize_mac_address(intf["macAddress"]) | ||||||
| if apply_network_config_set_name: | ||||||
| nicname = "eth{idx}".format(idx=idx) | ||||||
| else: | ||||||
| nicname = "enx{mac}".format(mac=mac.replace(":", "")) | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I confirm predictable interface naming convention prefix aligns with predictable naming expectations in systemd
Comment on lines
+2120
to
+2124
|
||||||
| dhcp_override = {"route-metric": (idx + 1) * 100} | ||||||
| # DNS resolution through secondary NICs is not supported, disable it. | ||||||
| if idx > 0: | ||||||
|
|
@@ -2152,10 +2165,9 @@ def generate_network_config_from_instance_network_metadata( | |||||
| "{ip}/{prefix}".format(ip=privateIp, prefix=netPrefix) | ||||||
| ) | ||||||
| if dev_config and has_ip_address: | ||||||
| mac = normalize_mac_address(intf["macAddress"]) | ||||||
| dev_config.update( | ||||||
| {"match": {"macaddress": mac.lower()}, "set-name": nicname} | ||||||
| ) | ||||||
| dev_config["match"] = {"macaddress": mac.lower()} | ||||||
| if apply_network_config_set_name: | ||||||
| dev_config["set-name"] = nicname | ||||||
| driver = determine_device_driver_for_mac(mac) | ||||||
| if driver: | ||||||
| dev_config["match"]["driver"] = driver | ||||||
|
|
||||||
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.
Good coverage of unpickle case across upgrade path && system reboot.
While we are here, shouldn't we also be setting apply_network_config_for_secondary_ips within
_unpickletoo to ensure those defaults under which the prior instance launch are preserved in the unpickled datasource?I think we also have a preexisting test coverage gap which should have alerted us to this potential _unpickle initialization issue w.r.t.
apply_network_config_for_secondary_ipsThis test change above also found another disparity with experimental_skip_ready_report too.