Bug 2173219

Summary: iscsi installs fail due to incorrect call: NM.SettingIPConfig.get_dns_search() takes exactly 2 arguments (1 given)
Product: [Fedora] Fedora Reporter: Adam Williamson <awilliam>
Component: anacondaAssignee: Vladimír Slávik <vslavik>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: anaconda-maint-list, panospolychronis, vponcova, vslavik, w
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: openqa
Fixed In Version: anaconda-39.6-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-04-03 14:26:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2143446    

Description Adam Williamson 2023-02-24 20:15:59 UTC
Since ff8e1c37a5eb86b9cc45fb2b68c8fd33b79de64c landed, iSCSI installs fail. A crash happens near the end of the install process. The logs show this (not including all the context as the ultimate error is clear):

  File "/usr/lib/python3.11/site-packages/dasbus/client/handler.py", line 483, in _get_method_reply
    return self._handle_method_error(error)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/lib/python3.11/site-packages/dasbus/client/handler.py", line 509, in _handle_method_error
    raise exception from None

pyanaconda.modules.common.errors.general.AnacondaError: NM.SettingIPConfig.get_dns_search() takes exactly 2 arguments (1 given)

Per a random copy of the API docs I found at https://lazka.github.io/pgi-docs/NM-1.0/classes/SettingIPConfig.html - I can't seem to find an 'official' copy - that function requires a parameter: "idx (int) – index number of the DNS search domain to return", but we're calling it just as `get_dns_search()`.

Comment 1 Adam Williamson 2023-02-24 20:17:39 UTC
Proposing as an F39 Final blocker: "The installer must be able to detect (if possible) and install to supported network-attached storage devices", with footnote "Supported network-attached storage types include iSCSI, Fibre Channel and Fibre Channel over Ethernet (FCoE)."

Comment 2 Adam Williamson 2023-03-03 18:51:07 UTC
The underlying C function here is https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/main/src/libnm-core-impl/nm-setting-ip-config.c#L4242 . It has behaved the same way since it was added in 2014:

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/commit/3f30c6f1c2f

and the similar functions it replaced behaved the same too (they both required an index to be specified).

There is a `get_num_dns_searches()`, so we should probably call that first to find out how many search domains there are, then retrieve them all. Right now we're expecting `get_dns_search()` to return a comma-separated list, but it...doesn't. It never has.

Comment 3 Adam Williamson 2023-03-03 18:57:46 UTC
untested patch:

diff --git a/pyanaconda/modules/network/nm_client.py b/pyanaconda/modules/network/nm_client.py
index 455caa5a2e..4e4c351b40 100644
--- a/pyanaconda/modules/network/nm_client.py
+++ b/pyanaconda/modules/network/nm_client.py
@@ -1601,9 +1601,9 @@ def _update_ip4_config_kickstart_network_data(connection, network_data):
 
     # dns
     network_data.ipv4_ignore_auto_dns = s_ip4_config.get_ignore_auto_dns()
-    ip4_dns_search = s_ip4_config.get_dns_search()
-    if ip4_dns_search:
-        network_data.ipv4_dns_search = ip4_dns_search
+    domains = [s_ip4_config.get_dns_search(idx) for idx in range(0, s_ip4_config.get_num_dns_searches())]
+    if domains:
+        network_data.ipv4_dns_search = ",".join(domains)
 
 
 def _update_ip6_config_kickstart_network_data(connection, network_data):
@@ -1634,9 +1634,9 @@ def _update_ip6_config_kickstart_network_data(connection, network_data):
 
     # dns
     network_data.ipv6_ignore_auto_dns = s_ip6_config.get_ignore_auto_dns()
-    ip6_dns_search = s_ip6_config.get_dns_search()
-    if ip6_dns_search:
-        network_data.ipv6_dns_search = ip6_dns_search
+    domains = [s_ip6_config.get_dns_search(idx) for idx in range(0, s_ip6_config.get_num_dns_searches())]
+    if domains:
+        network_data.ipv6_dns_search = ",".join(domains)
 
 
 def _update_vlan_kickstart_network_data(nm_client, connection, network_data):

Comment 4 Adam Williamson 2023-03-04 02:06:52 UTC
unfortunately I can't test the patch very easily in openQA because the test uses static networking and usually sets it up in the anaconda GUI, I'd have to remember the params to set it up on the cmdline so it could grab the updates.img...

Comment 5 Vladimír Slávik 2023-03-06 18:14:30 UTC
Oops, sorry. But it's as you say - there are no good docs for this.

https://github.com/rhinstaller/anaconda/pull/4594

Comment 6 Vladimír Slávik 2023-03-17 17:31:14 UTC
With https://github.com/rhinstaller/anaconda/pull/4614 as well, all should be fixed.

...or rather, I believe so.

Comment 7 Adam Williamson 2023-03-17 18:15:31 UTC
Awesome. Once we get a Rawhide compose with the fixes in, openQA will let us know.

Comment 8 Vladimír Slávik 2023-03-21 14:07:06 UTC
*** Bug 2176226 has been marked as a duplicate of this bug. ***