Repository navigation
Conversation
fc292e4 to
cfbfdb6
Compare
Bischoff
left a comment
There was a problem hiding this comment.
Eric
Thanks a lot for this PR!
For the next ones, would it be possible to have a PR description? I only had the PR's title, and for the rest I had to guess your intentions.
I also notice no unit tests, no documentation.
Claude, prompted by Eric
I reviewed the current head of the branch (cfbfdb6). Configuring the IP address of a Network Express interface is a useful addition. However, I found a regression and several bugs, so I think the PR needs more work.
tox -e pep8 passes, and the existing unit tests show no new failure, but only because none of them covers the changed paths.
Bugs
- Regression on FCP
In smtLayer/getVM.py, posOpsList = {...}, ends with a comma, so it becomes a tuple instead of a dict.
Positional operands of all GETVM subfunctions are then ignored, including the existing FCPINFO used by SMTClient.get_fcp_info_by_status(): parsing getvm TESTVM fcpinfo free gives parms = {} instead of {'status': 'free'}.
No unit test covers this path, which explains the issue went undetected.
- Configuration files removed too broadly
NetworkOPS._create_neth_configuration_files() generates rm -f /etc/sysconfig/network-scripts/ifcfg-{intf_name[:2]}*. For enc1600, this
removes every ifcfg-en* file, including the configuration of the guest's regular NIC.
- DHCP and optional fields
_create_neth_configuration_files() reads net['cidr'], net['gateway_addr'] and net['ip_addr'] unconditionally, so method dhcp (accepted by the validation) or a network without gateway raises KeyError or concatenates None.
- Only one network
The loop overwrites cfg_str, so only the last entry of guest_networks is written.
- pcif parameter
The REST schema does not list pcif as required, but VMHandler.configure_network_interface_ip() reads interface['pcif'], which gives a 500 error when it is missing.
- PCIF matching
getVM.getNethIntInfo() looks for pcif[-4:] as a substring of the PCI address, which can match the wrong device. Comparing the domain field exactly would be safer.
Design questions
- The generated file is
/etc/sysconfig/network-scripts/ifcfg-*, which only works for RHEL up to 8, not for RHEL 9 and later (NetworkManager), SLES (/etc/sysconfig/network/) or Ubuntu (netplan), whileos_versionis required but not used.
Which distributions are meant to be supported?
-
zdirect_network_configuration()always reboots the guest, even withactive=True. Is this intended? It should at least be documented. -
The input validation in
SDKAPI.guest_configure_network_interface_ip()is a copy/paste ofguest_create_network_interface(), including the error messages that still mentionguest_create_network_interface. I suggest adapting it. Optionally, factor it into a common helper.
Tests and documentation
-
There are no unit tests for the new API, the network configuration generation and
getNethIntInfo(). -
Documentation: nothing in
doc/source/restapi.rst,parameters.yamlorzvmsdk/tests/fvt/api_templates/for POST/guests/{userid}/interface/ip. It would be nice to also document the prerequisites (guest running and reachable through IUCV, PCIF attached), the supported distributions, and the reboot. -
PR description
That would help reviewers too.
c3af7f4 to
6f1d7a6
Compare
Review of #970 (head 6f1d7a6)Review bodyThanks for adding NETH IP configuration. The main blockers are below; details are inline.
Smaller points:
Generated by Claude Code Inline commentszvmsdk/networkops.py:384 —
|
4d5b6b1 to
faf72f3
Compare
|
Thank you for your comments Updated all the review comments. Kindly check it |
faf72f3 to
ee7307f
Compare
|
Open A guest whose primary NIC was set up by cloud-init or the image, not by guest_create_network_interface, has net_set=0. After the forced reboot it comes back with only the NETH interface. This API writes one file per interface, so it doesn't need the clean at all. Suggest dropping it, and with it the update_guestdb_with_net_set side effect. |
Add guest_configure_network_interface_ip (POST /guests/{userid}/interface/ip)
to configure the IP settings of a Network Express (NETH) interface.
- getVM NETHINTERFACEINFO: resolve the interface name from the s390 PCI
function_id in sysfs, validating pcif before it is used in the command
- dist: add get_neth_cfg for rhel, sles, ubuntu16 and ubuntu20+ with shared
parsing in _parse_neth_params; omit empty gateway/broadcast lines
- networkops: zdirect_network_configuration punches the config and
activates it with the distro specific zvmguestconfigure command;
temp folder is always cleaned up
- rhcos is not supported and is rejected with SDKFunctionNotImplementError
- REST client/server, schema, docs and unit tests
Signed-off-by: Malar2703 <ponmalarkaruppasamy@gmail.com>
ee7307f to
a190e76
Compare
|
@Rajat-0 Fixed other review comments
|
PR Info:
Exposed an API to assign an IP address to the interface created by the VM when the PCIF is attached.
This PR accepts network information and the PCIF ID as input. The PCIF ID is used to identify the corresponding network interface name (e.g., ens327) configured on the VM. The IP address is then assigned to the identified interface by creating the appropriate ifcfg-en* configuration file in the OS-specific /etc directory. Finally, the VM must be restarted to apply the updated network configuration.
API Info:
POST /guests/{userid}/interface/ip
Configure the IP address and network settings for a Network Express (NETH)
interface on a running guest. The guest must be powered on and reachable
through IUCV, and the NETH PCI function (
pcif) must already be attachedto the guest before this call is made.
The operation writes the network configuration file into the guest via the
SMT layer, then reboots the guest so that the new settings take effect.
Supported distributions:
rhel6.x,rhel7.x,rhel8.x,rhel9.x,sles11.x,sles12.x,sles15.x,ubuntu16.x,ubuntu20.x,ubuntu22.x,ubuntu24.xandubuntu25.x(all case-insensitive).
rhcos4.xis not supported by this API.Request Body: