-
Bug
-
Resolution: Unresolved
-
Normal
-
None
-
Quality / Stability / Reliability
-
0.42
-
False
-
-
False
-
NEW
-
-
Moderate
-
No
Description of problem:
When attempting to hot-plug an interface to a guest VM using `virtctl addinterface` command, without creating a backing bridge on the node first, the command fails as expected, but the message doesn't notify the user what is missing:
```
$ virtctl addinterface vm-fedora --network-attachment-definition-name hp-br-nad --name hp2
the server could not find the requested resource
```
The VM and the NetworkAttachmentDefinition are there (in the same namespace), and what is missing is the `hp-br` bridge interface on the nodes, which the NAD refers to:
```$ oc get vm
NAME AGE STATUS READY
vm-fedora 16m Running True
$
$ oc get net-attach-def hp-br-nad -o yaml
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
annotations:
k8s.v1.cni.cncf.io/resourceName: bridge.network.kubevirt.io/hp-br
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"k8s.cni.cncf.io/v1","kind":"NetworkAttachmentDefinition","metadata":{"annotations":
,"name":"hp-br-nad","namespace":"yoss-ns"},"spec":{"config":"{\"cniVersion\": \"0.3.1\", \"name\": \"hp-br\", \"plugins\": [
{\"type\": \"cnv-bridge\", \"bridge\": \"hp-br\"}]}"}}
creationTimestamp: "2023-06-29T18:37:35Z"
generation: 1
name: hp-br-nad
namespace: yoss-ns
resourceVersion: "313420"
uid: 44422089-e2e0-417a-811e-ff4367a1789e
spec:
config: '{"cniVersion": "0.3.1", "name": "hp-br", "plugins": [
]}'
```
Version-Release number of selected component (if applicable):
CNV 4.14.0
virtctl version:
Client Version: version.Info
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 NetworkattachmentDefinition.
$ 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-name> --network-attachment-definition-name <net-attach-def-name> --name <interface-name>
$ virtctl addinterface vm-fedora --network-attachment-definition-name hp-br-nad --name hp2
Actual results:
Failure message doesn't specify which is the missing resource, which can be quite confusing for the user:
```
the server could not find the requested resource
```
Expected results:
A clearer message, which indicates which is the missing resource.
In this case, for example:
```
the server could not find bridge resource 'hp-br', which is referenced in NetworkAttachmentDefinition `hp-br-nad`.
```