server: set Default NIC when VM has no default NIC#7859
Conversation
Codecov Report
@@ Coverage Diff @@
## 4.18 #7859 +/- ##
============================================
+ Coverage 13.02% 13.06% +0.04%
- Complexity 9029 9108 +79
============================================
Files 2720 2720
Lines 257010 257548 +538
Branches 40083 40156 +73
============================================
+ Hits 33467 33658 +191
- Misses 219342 219660 +318
- Partials 4201 4230 +29
... and 60 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
@blueorangutan package |
|
@kiranchavala a [SF] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 6765 |
|
@hsato03 |
DaanHoogland
left a comment
There was a problem hiding this comment.
clgtm, but can you extract the new code into separate methods for readability please
6b4c1e3 to
7017eab
Compare
@weizhouapache Yes, done. |
|
@blueorangutan package |
|
@DaanHoogland a [SF] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 6777 |
|
@hsato03 can you describe how to reproduce the issue the PR aim to fix ? |
|
@blueorangutan test rocky8 vmware-70u3 keepEnv |
|
@DaanHoogland a [SF] Trillian-Jenkins test job (rocky8 mgmt + vmware-70u3) has been kicked to run smoke tests |
@weizhouapache If an error occurs with the network adapter while importing a VM, it's necessary to remove the NIC via VCenter and create a new one in ACS. You can reproduce this by doing the following:
|
|
[SF] Trillian test result (tid-7420)
|
|
@hsato03 , I am not allowed to import without NIC: I am trying your scenario from #7859 (comment) |
@DaanHoogland The problem this PR intends to solve is that, when we have a VM without NIC and we add a NIC to it, we cannot set it as the default NIC. A way to reproduce this situation is importing a VM that does not have a NIC in VMware.
Then, I imported the VM to ACS. This is the import form when a VM does not have NIC on vCenter (the With that, the VM is successfully imported to ACS, however, without NIC: Without this patch, we can attach a NIC to the VM, however, it would not be the default NIC and we would not be able to set it as the default NIC; ACS returns the message @DaanHoogland, could you try following these steps? Despite this PR solves the situation where we cannot set the default NIC of the VM (given the situation I mentioned), should ACS allow importing VMs without NICs, as ACS does not allow creating VMs without NIC neither remove the default NIC?. @DaanHoogland, what do you think? I can open the discussion in an issue or in the mailing list if valid. |
|
Hello @DaanHoogland, Did you manage to reproduce the situation? Regarding importing the VM without NICs, do you think it is valid to open a discussion or we should block it? |
I have not. I must admit I let other issues take precedence, however.
I think your question warrants a [DISCUSS] thread on dev@ . I am not against allowing it, but there may be some technical, procedural or plain historical objections. In that light it is always good to hide the behaviour of allowing VMs without NIC behind a global setting. A discuss thread should also resolve that question. |
|
@hsato03 I have seen no significant discussions on your thread. Let's proceed. I would say a good implementation displays a warning asking to stop or create a default NIC. What do you think? |
|
@DaanHoogland Good idea. I have added a warning message. |
|
@blueorangutan package |
|
@DaanHoogland a [SF] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
@blueorangutan package |
|
@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 7430 |
|
@blueorangutan test alma8 vmware-70u3 |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (alma8 mgmt + vmware-70u3) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-8010)
|




Description
ACS allows you to add NICs to a VM without them, although it is not possible to set them as default since the
updateDefaultNicForVirtualMachineAPI only updates the default NIC if a default NIC already exists, otherwise an exception is thrown.For this reason, when a NIC is added and the VM that the NIC is being created for has no default NIC, the NIC will be marked as default.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Imported a VM without NICs, added some NICs and the first one was set as default.