You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2022/08/15 15:20:34 UTC
[GitHub] [cloudstack] mlsorensen opened a new pull request, #6640: Add usermode interface option to Libvirt Domain XML builder
mlsorensen opened a new pull request, #6640:
URL: https://github.com/apache/cloudstack/pull/6640
### Description
This PR provides constructors and the associated changes to use LibvirtVMDef for creating user mode network interfaces.
While this isn't used directly in the CloudStack KVM agent today, it could be used in the future for e.g. pod networking/management networks without needing to assign a pod IP. The VIF driver used by the CloudStack Agent is also pluggable, so this allows plugin code to create user mode network interfaces as well.
Note that the user mode network already exists in the GuestNetType enum, but wasn't usable prior to this change.
Also included unit test to ensure we continue to create the expected XML.
Additionally, this uncovered a null pointer on `_networkRateKBps` and this PR fixes it. The decision to add bandwidth throttling assumes this field is not null and simply checks for `> 0`.
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] Enhancement (improves an existing feature and functionality)
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
### Feature/Enhancement Scale or Bug Severity
#### Feature/Enhancement Scale
- [ ] Major
- [x] Minor
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [ ] Major
- [ ] Minor
- [ ] Trivial
### Screenshots (if appropriate):
### How Has This Been Tested?
Unit tests. Also created a test VIF driver and configured CloudStack Agent with it to test it out manually.
<!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] DaanHoogland commented on a diff in pull request #6640: Add usermode interface option to Libvirt Domain XML builder
Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on code in PR #6640:
URL: https://github.com/apache/cloudstack/pull/6640#discussion_r946507851
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java:
##########
@@ -1421,13 +1438,18 @@ public String getContent() {
netBuilder.append(_dpdkExtraLines);
}
- if (_netType != GuestNetType.VHOSTUSER) {
+ if (_netType != GuestNetType.VHOSTUSER && _netType != GuestNetType.USER) {
netBuilder.append("<link state='" + (_linkStateUp ? "up" : "down") +"'/>\n");
}
if (_slot != null) {
netBuilder.append(String.format("<address type='pci' domain='0x0000' bus='0x00' slot='0x%02x' function='0x0'/>\n", _slot));
}
+
+ if (StringUtils.isNotBlank(_userIp4Network) && _userIp4Prefix != null) {
+ netBuilder.append(String.format("<ip family='ipv4' address='%s' prefix='%s'/>\n", _userIp4Network, _userIp4Prefix));
Review Comment:
It is not serious @mlsorensen , just a trivial warning and i am just mentioning it without a request for change. We only run this on Linux AFAIK. If you want to bother go ahead, we could also create a ticket to change all occurrences of `\n` to `%n` in `String.format()` occurrences. But I know I can be over-pedantic in these matters so I tend to not push for these formalities.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] borisstoyanov commented on pull request #6640: Add usermode interface option to Libvirt Domain XML builder
Posted by GitBox <gi...@apache.org>.
borisstoyanov commented on PR #6640:
URL: https://github.com/apache/cloudstack/pull/6640#issuecomment-1216254880
@blueorangutan test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] sonarcloud[bot] commented on pull request #6640: Add usermode interface option to Libvirt Domain XML builder
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #6640:
URL: https://github.com/apache/cloudstack/pull/6640#issuecomment-1215270642
SonarCloud Quality Gate failed. [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache_cloudstack&pullRequest=6640)
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6640&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6640&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6640&resolved=false&types=BUG)
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6640&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6640&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6640&resolved=false&types=VULNERABILITY)
[![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_cloudstack&pullRequest=6640&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_cloudstack&pullRequest=6640&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_cloudstack&pullRequest=6640&resolved=false&types=SECURITY_HOTSPOT)
[![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6640&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6640&resolved=false&types=CODE_SMELL) [3 Code Smells](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6640&resolved=false&types=CODE_SMELL)
[![74.4%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '74.4%')](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=6640&metric=new_coverage&view=list) [74.4% Coverage](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=6640&metric=new_coverage&view=list)
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=6640&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=6640&metric=new_duplicated_lines_density&view=list)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #6640: Add usermode interface option to Libvirt Domain XML builder
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on PR #6640:
URL: https://github.com/apache/cloudstack/pull/6640#issuecomment-1216255433
@borisstoyanov a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #6640: Add usermode interface option to Libvirt Domain XML builder
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on PR #6640:
URL: https://github.com/apache/cloudstack/pull/6640#issuecomment-1216420109
@rohityadavcloud a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #6640: Add usermode interface option to Libvirt Domain XML builder
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on PR #6640:
URL: https://github.com/apache/cloudstack/pull/6640#issuecomment-1215227571
@DaanHoogland a 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] rohityadavcloud commented on pull request #6640: Add usermode interface option to Libvirt Domain XML builder
Posted by GitBox <gi...@apache.org>.
rohityadavcloud commented on PR #6640:
URL: https://github.com/apache/cloudstack/pull/6640#issuecomment-1216418284
@blueorangutan test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #6640: Add usermode interface option to Libvirt Domain XML builder
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on PR #6640:
URL: https://github.com/apache/cloudstack/pull/6640#issuecomment-1217195687
<b>Trillian test result (tid-4706)</b>
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 40759 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr6640-t4706-kvm-centos7.zip
Smoke tests completed. 100 look OK, 1 have errors
Only failed tests results shown below:
Test | Result | Time (s) | Test File
--- | --- | --- | ---
test_08_upgrade_kubernetes_ha_cluster | `Failure` | 815.93 | test_kubernetes_clusters.py
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #6640: Add usermode interface option to Libvirt Domain XML builder
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on PR #6640:
URL: https://github.com/apache/cloudstack/pull/6640#issuecomment-1216292274
<b>Trillian Build Failed (tid-4703)<b/>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] rohityadavcloud merged pull request #6640: Add usermode interface option to Libvirt Domain XML builder
Posted by GitBox <gi...@apache.org>.
rohityadavcloud merged PR #6640:
URL: https://github.com/apache/cloudstack/pull/6640
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] DaanHoogland commented on pull request #6640: Add usermode interface option to Libvirt Domain XML builder
Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on PR #6640:
URL: https://github.com/apache/cloudstack/pull/6640#issuecomment-1215227012
@blueorangutan package
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] codecov[bot] commented on pull request #6640: Add usermode interface option to Libvirt Domain XML builder
Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #6640:
URL: https://github.com/apache/cloudstack/pull/6640#issuecomment-1215259079
# [Codecov](https://codecov.io/gh/apache/cloudstack/pull/6640?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#6640](https://codecov.io/gh/apache/cloudstack/pull/6640?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (2205c26) into [main](https://codecov.io/gh/apache/cloudstack/commit/152a2748457344c974b3541a0e7a833c2962f955?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (152a274) will **increase** coverage by `0.00%`.
> The diff coverage is `84.61%`.
```diff
@@ Coverage Diff @@
## main #6640 +/- ##
=========================================
Coverage 5.87% 5.87%
Complexity 3933 3933
=========================================
Files 2454 2454
Lines 242633 242645 +12
Branches 37970 37971 +1
=========================================
+ Hits 14246 14257 +11
Misses 226811 226811
- Partials 1576 1577 +1
```
| [Impacted Files](https://codecov.io/gh/apache/cloudstack/pull/6640?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...om/cloud/hypervisor/kvm/resource/LibvirtVMDef.java](https://codecov.io/gh/apache/cloudstack/pull/6640/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGx1Z2lucy9oeXBlcnZpc29ycy9rdm0vc3JjL21haW4vamF2YS9jb20vY2xvdWQvaHlwZXJ2aXNvci9rdm0vcmVzb3VyY2UvTGlidmlydFZNRGVmLmphdmE=) | `62.60% <84.61%> (+0.30%)` | :arrow_up: |
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] DaanHoogland commented on a diff in pull request #6640: Add usermode interface option to Libvirt Domain XML builder
Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on code in PR #6640:
URL: https://github.com/apache/cloudstack/pull/6640#discussion_r945922356
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java:
##########
@@ -1421,13 +1438,18 @@ public String getContent() {
netBuilder.append(_dpdkExtraLines);
}
- if (_netType != GuestNetType.VHOSTUSER) {
+ if (_netType != GuestNetType.VHOSTUSER && _netType != GuestNetType.USER) {
netBuilder.append("<link state='" + (_linkStateUp ? "up" : "down") +"'/>\n");
}
if (_slot != null) {
netBuilder.append(String.format("<address type='pci' domain='0x0000' bus='0x00' slot='0x%02x' function='0x0'/>\n", _slot));
}
+
+ if (StringUtils.isNotBlank(_userIp4Network) && _userIp4Prefix != null) {
+ netBuilder.append(String.format("<ip family='ipv4' address='%s' prefix='%s'/>\n", _userIp4Network, _userIp4Prefix));
Review Comment:
sonar advice , i think it makes sense, even though we are pretty sure we run on linux ;)
```suggestion
netBuilder.append(String.format("<ip family='ipv4' address='%s' prefix='%s'/>%n", _userIp4Network, _userIp4Prefix));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] mlsorensen commented on a diff in pull request #6640: Add usermode interface option to Libvirt Domain XML builder
Posted by GitBox <gi...@apache.org>.
mlsorensen commented on code in PR #6640:
URL: https://github.com/apache/cloudstack/pull/6640#discussion_r947009958
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java:
##########
@@ -1421,13 +1438,18 @@ public String getContent() {
netBuilder.append(_dpdkExtraLines);
}
- if (_netType != GuestNetType.VHOSTUSER) {
+ if (_netType != GuestNetType.VHOSTUSER && _netType != GuestNetType.USER) {
netBuilder.append("<link state='" + (_linkStateUp ? "up" : "down") +"'/>\n");
}
if (_slot != null) {
netBuilder.append(String.format("<address type='pci' domain='0x0000' bus='0x00' slot='0x%02x' function='0x0'/>\n", _slot));
}
+
+ if (StringUtils.isNotBlank(_userIp4Network) && _userIp4Prefix != null) {
+ netBuilder.append(String.format("<ip family='ipv4' address='%s' prefix='%s'/>\n", _userIp4Network, _userIp4Prefix));
Review Comment:
I'd probably opt to leave it as-is, rather than potentially inserting one random carriage return or something different on one line of the file compared to all of the other lines.
I don't think a theoretical libvirt server would care/require a carriage or alternate whitespace on Windows or other OS anyway.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] mlsorensen commented on a diff in pull request #6640: Add usermode interface option to Libvirt Domain XML builder
Posted by GitBox <gi...@apache.org>.
mlsorensen commented on code in PR #6640:
URL: https://github.com/apache/cloudstack/pull/6640#discussion_r945931836
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java:
##########
@@ -1421,13 +1438,18 @@ public String getContent() {
netBuilder.append(_dpdkExtraLines);
}
- if (_netType != GuestNetType.VHOSTUSER) {
+ if (_netType != GuestNetType.VHOSTUSER && _netType != GuestNetType.USER) {
netBuilder.append("<link state='" + (_linkStateUp ? "up" : "down") +"'/>\n");
}
if (_slot != null) {
netBuilder.append(String.format("<address type='pci' domain='0x0000' bus='0x00' slot='0x%02x' function='0x0'/>\n", _slot));
}
+
+ if (StringUtils.isNotBlank(_userIp4Network) && _userIp4Prefix != null) {
+ netBuilder.append(String.format("<ip family='ipv4' address='%s' prefix='%s'/>\n", _userIp4Network, _userIp4Prefix));
Review Comment:
Good catch @DaanHoogland - my only reservation is that it would be different from all of the other XML formatting strings in this `getContent()` method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #6640: Add usermode interface option to Libvirt Domain XML builder
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on PR #6640:
URL: https://github.com/apache/cloudstack/pull/6640#issuecomment-1215349250
Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 3991
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] rohityadavcloud commented on pull request #6640: Add usermode interface option to Libvirt Domain XML builder
Posted by GitBox <gi...@apache.org>.
rohityadavcloud commented on PR #6640:
URL: https://github.com/apache/cloudstack/pull/6640#issuecomment-1216419339
@blueorangutan test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org