Bug 2219143

Summary: [hot-plug] No error message when attempting to hot-plugging the same interface again
Product: Container Native Virtualization (CNV) Reporter: Yossi Segev <ysegev>
Component: NetworkingAssignee: Petr Horáček <phoracek>
Status: CLOSED WONTFIX QA Contact: Nir Rozen <nrozen>
Severity: low Docs Contact:
Priority: low    
Version: 4.14.0CC: alkaplan
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-07-27 10:37:56 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:

Description Yossi Segev 2023-07-02 12:38:29 UTC
Description of problem:
When attempting to hot-plug an interface, that was already hot-plugged (i.e. same interface name), there is no error message, so it gives the impression that the action succeeeds.


Version-Release number of selected component (if applicable):
Client Version: version.Info{GitVersion:"v1.0.0-beta.0-449-g2d9380079", GitCommit:"2d93800792c87fd0f744a13f80ce82260dd6e279", GitTreeState:"clean", BuildDate:"2023-06-28T15:10:11Z", GoVersion:"go1.19.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{GitVersion:"v1.0.0-beta.0-449-g2d9380079", GitCommit:"2d93800792c87fd0f744a13f80ce82260dd6e279", GitTreeState:"clean", BuildDate:"2023-06-28T15:10:09Z", GoVersion:"go1.19.9", Compiler:"gc", Platform:"linux/amd64"}


How reproducible:
Always


Steps to Reproduce:
1. Create and run a basic VM (no secondary NICs).
$ oc create ns yoss-ns
namespace/yoss-ns created
$ oc project yoss-ns
Now using project "yoss-ns" on server "https://api.net-ys-414o.rhos-psi.cnv-qe.rhood.us:6443".
$ oc apply -f vm-fedora.yaml 
virtualmachine.kubevirt.io/vm-fedora created
$ virtctl start vm-fedora
VM vm-fedora was scheduled to start

2. Create a bridge interface over one of the nodes secondary NICs using a NodeNetworkConfigurationPolicy.
$ oc apply -f nncp-linux-bridge.yaml 
oc get nncp -w
nodenetworkconfigurationpolicy.nmstate.io/hotplug-linux-bridge created
ysegev@ysegev-fedora (hotplug) $ oc get nncp -w
NAME                   STATUS   REASON
hotplug-linux-bridge            
hotplug-linux-bridge   Progressing   ConfigurationProgressing
hotplug-linux-bridge   Progressing   ConfigurationProgressing
...
hotplug-linux-bridge   Available     SuccessfullyConfigured

3. Create a NetworkattachmentDefinition for the bridge.
$ oc apply -f bridge-nad.yaml 
networkattachmentdefinition.k8s.cni.cncf.io/hp-br-nad created

4. Run the command to add the new interface to the VM:
$ virtctl addinterface vm-fedora --network-attachment-definition-name hp-br-nad --name hp2

5. Repeat the last command again:
$ virtctl addinterface vm-fedora --network-attachment-definition-name hp-br-nad --name hp2


Actual results:
No failure message, looks like the question succeeds.


Expected results:
Alerting the user that the interface already exists.


Additional info:
In action nothing happens - no new entry is created in the VM spec in either `networks` and `interfaces`.

Comment 4 Alona Kaplan 2023-07-23 07:33:58 UTC
I don't think that the described scenario is a bug. The user tries to hotplug an interface, the interface is already there, nothing has to be done.
Maybe a warning can be added, but not an error.

Yossi, what do you think?

Comment 5 Yossi Segev 2023-07-25 07:33:05 UTC
(In reply to Alona Kaplan from comment #4)
> I don't think that the described scenario is a bug. The user tries to
> hotplug an interface, the interface is already there, nothing has to be done.
> Maybe a warning can be added, but not an error.
> 
> Yossi, what do you think?

A warning can also be valid solution, as long as the user gets notified that the addinterface action failed/didn't do anything.
The status now is that the response in CLI is the same for both successful action (hot-plugging a new interface) or failed action (trying to hot-plug the same interface again).

Comment 6 Alona Kaplan 2023-07-27 10:37:56 UTC
Closing since this bug has low priority and anyway won't be relevant on 4.15.
On 4.15 the API is changed and the user will have to edit the VM template spec to add/remove interfaces. virtctl add/removeIntreface and restapi endpoints won't exist any more.