Skip to content

Support network-scope settings and add setting to override vr service offering - #6918

Closed
soreana wants to merge 41 commits into
apache:mainfrom
leaseweb:override-vr-service-offering
Closed

soreana wants to merge 41 commits into
apache:mainfrom
leaseweb:override-vr-service-offering

Conversation

@soreana

@soreana soreana commented Nov 23, 2022

Copy link
Copy Markdown
Member

Description

As of now, it is possible to override the virtual router service offering with global, domain, and account level configurations. What if a customer wants to change the service offering for only one network? There isn't such an option in Cloudstack. As an admin, you can only override the network offering for a domain, account, or global, affecting all the networks in that domain, account, or zone. This pull request aims to add a network-level setting to override the virtual router service offering per network.

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)
  • 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
  • Minor

How Has This Been Tested?

To test this feature, please follow the below steps:

  1. Create a network
  2. Create VM in that network (to create a VR)
  3. List the network and get the UUID of the network
  4. Check the service offering of the network
  5. Create a new router service offering
  6. Set the network.router.service.offering to the UUID of the service offering for the network using the cmk
  7. Restart the network with clean up
  8. Check the service offering of the network

Useful cmk commands:

(localcloud) 🐱 > list networks filter=id,name
{
  "count": 2,
  "network": [
    {
      "id": "c9d70872-b877-4f02-92b5-b4b08e1095d7",
      "name": "isolated-network"
    },
    {
      "id": "1ebf1ca9-7930-4f2f-8263-8da1840f02fc",
      "name": "shared"
    }
  ]
}
(localcloud) 🐱 > list configurations networkid=c9d70872-b877-4f02-92b5-b4b08e1095d7
{
  "configuration": [
    {
      "category": "Advanced",
      "description": "Uuid of the service offering used by virtual routers of this network; if NULL - account/system offering will be used",
      "isdynamic": true,
      "name": "network.router.service.offering",
      "scope": "network",
      "value": ""
    }
  ],
  "count": 1
}
(localcloud) 🐱 > list routers filter=serviceofferingid,serviceofferingname
{
  "count": 1,
  "router": [
    {
      "serviceofferingid": "f37ed5fd-6f26-4316-8b27-dbebb0b56a5a"
      "serviceofferingname": "System Offering For Software Router"
    }
  ]
}
(localcloud) 🐱 > update configuration networkid=c9d70872-b877-4f02-92b5-b4b08e1095d7 name="network.router.service.offering" value="5ad7f2c4-29e0-460b-901b-05ee8de8a0df"
{
  "configuration": {
    "category": "Advanced",
    "description": "Uuid of the service offering used by virtual routers of this network; if NULL - account/system offering will be used",
    "isdynamic": true,
    "name": "network.router.service.offering",
    "scope": "network",
    "value": "5ad7f2c4-29e0-460b-901b-05ee8de8a0df"
  }
}
(localcloud) 🐱 > restart network id=c9d70872-b877-4f02-92b5-b4b08e1095d7 cleanup=true
{
  "success": true
}
(localcloud) 🐱 > list routers filter=serviceofferingid,serviceofferingname
{
  "count": 1,
  "router": [
    {
      "serviceofferingid": "5ad7f2c4-29e0-460b-901b-05ee8de8a0df"
      "serviceofferingname": "Medium Instance"
    }
  ]
}

@soreana

soreana commented Nov 23, 2022

Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@soreana 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.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✖️ el7 ✖️ el8 ✖️ debian ✖️ suse15. SL-JID 4629

@yadvr

yadvr commented Nov 23, 2022

Copy link
Copy Markdown
Member

@soreana can you check build failures? I also see failing coverage and quality checks

Comment thread api/src/main/java/org/apache/cloudstack/api/command/admin/config/ResetCfgCmd.java Outdated

@JoaoJandre JoaoJandre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@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.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✖️ el7 ✖️ el8 ✖️ debian ✖️ suse15. SL-JID 5042

Comment thread server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java Outdated
Comment thread server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java Outdated
@soreana

soreana commented Dec 30, 2022

Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@soreana 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.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✖️ el7 ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 5145

@soreana

soreana commented Dec 31, 2022

Copy link
Copy Markdown
Member Author

@DaanHoogland Happy new year. :)
I tried to fix the test failure, but I couldn't. Can you have a look when you have time please?

[ERROR] org.apache.cloudstack.networkoffering.CreateNetworkOfferingTest1
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:669)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:282)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1183)

@DaanHoogland

Copy link
Copy Markdown
Contributor

@soreana I haven't had a chance to investigate very deeply yet, but at my laptop it also crashes with

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project cloud-server: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/dahn/apache/cloudstack/server/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/dahn/apache/cloudstack/server && /home/dahn/.jdks/azul-11.0.15/bin/java -Djava.security.egd=file:/dev/./urandom -noverify -Xmx2048m -XX:MaxPermSize=512m -Djava.security.egd=file:/dev/./urandom org.apache.maven.surefire.booter.ForkedBooter /home/dahn/apache/cloudstack/server/target/surefire 2022-12-31T15-16-34_362-jvmRun1 surefire6779432936451500986tmp surefire_139610296058936276723tmp
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] Crashed tests:
[ERROR] org.apache.cloudstack.networkoffering.CreateNetworkOfferingTest
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/dahn/apache/cloudstack/server && /home/dahn/.jdks/azul-11.0.15/bin/java -Djava.security.egd=file:/dev/./urandom -noverify -Xmx2048m -XX:MaxPermSize=512m -Djava.security.egd=file:/dev/./urandom org.apache.maven.surefire.booter.ForkedBooter /home/dahn/apache/cloudstack/server/target/surefire 2022-12-31T15-16-34_362-jvmRun1 surefire6779432936451500986tmp surefire_139610296058936276723tmp
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] Crashed tests:
[ERROR] org.apache.cloudstack.networkoffering.CreateNetworkOfferingTest
[ERROR] 	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:669)
[ERROR] 	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:282)
[ERROR] 	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
[ERROR] 	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1183)
[ERROR] 	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1011)
[ERROR] 	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:857)
[ERROR] 	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR] 	at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:301)
[ERROR] 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:211)
[ERROR] 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:165)
[ERROR] 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:157)
[ERROR] 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:121)
[ERROR] 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR] 	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
[ERROR] 	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:127)
[ERROR] 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:294)
[ERROR] 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
[ERROR] 	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
[ERROR] 	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:960)
[ERROR] 	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
[ERROR] 	at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
[ERROR] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR] 	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
[ERROR] 	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
[ERROR] 	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
[ERROR] 	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
[ERROR] 
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :cloud-server

@soreana

soreana commented Jan 2, 2023

Copy link
Copy Markdown
Member Author

@DaanHoogland The CreateNetworkOfferingTest fails and I don't know why :(
Build packages with -DskipTests, they were working. I'm trouble shooting to see what went wrong, let me know if you found anything.

@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@DaanHoogland

Copy link
Copy Markdown
Contributor

@soreana i ran this in a debugger and for some reason your PR tries to load ~/.m2/repository/com/sun/xml/bind/jaxb-core/2.3.0/jaxb-api.jar during testing, which doesn´t exist.

@soreana

soreana commented Apr 4, 2023

Copy link
Copy Markdown
Member Author

@DaanHoogland I removed these lines and the build error gone. I don't know what was wrong. 🤷‍♂️

diff --git a/server/src/test/java/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java b/server/src/test/java/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
index 33747b0342..6beba0b212 100644
--- a/server/src/test/java/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
+++ b/server/src/test/java/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
@@ -56,7 +56,6 @@ import com.cloud.network.dao.FirewallRulesDcidrsDaoImpl;
 import com.cloud.network.dao.IPAddressDaoImpl;
 import com.cloud.network.dao.LoadBalancerDao;
 import com.cloud.network.dao.NetworkDao;
-import com.cloud.network.dao.NetworkDetailsDao;
 import com.cloud.network.dao.NetworkDomainDaoImpl;
 import com.cloud.network.dao.NetworkServiceMapDaoImpl;
 import com.cloud.network.dao.PhysicalNetworkDaoImpl;
@@ -325,11 +324,6 @@ public class
         return Mockito.mock(DomainDetailsDao.class);
     }
 
-    @Bean
-    public NetworkDetailsDao networkDetailsDao() {
-        return Mockito.mock(NetworkDetailsDao.class);
-    }
-
     @Bean
     public DataStoreManager dataStoreManager() {
         return Mockito.mock(DataStoreManager.class);

@soreana

soreana commented Apr 4, 2023

Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@soreana 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.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 5855

@codecov-commenter

codecov-commenter commented May 7, 2024 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 22.04724% with 99 lines in your changes missing coverage. Please review.
✅ Project coverage is 15.28%. Comparing base (e9ff270) to head (8d98604).
⚠️ Report is 1275 commits behind head on main.

Files with missing lines Patch % Lines
...a/com/cloud/network/dao/NetworkDetailsDaoImpl.java 10.20% 44 Missing ⚠️
.../cloud/configuration/ConfigurationManagerImpl.java 0.00% 29 Missing ⚠️
.../router/deployment/RouterDeploymentDefinition.java 50.00% 4 Missing and 2 partials ⚠️
...oudstack/api/command/admin/config/ResetCfgCmd.java 0.00% 5 Missing ⚠️
server/src/main/java/com/cloud/api/ApiDBUtils.java 0.00% 5 Missing ⚠️
...in/java/com/cloud/server/ManagementServerImpl.java 0.00% 5 Missing ⚠️
...dstack/api/command/admin/config/ListCfgsByCmd.java 60.00% 1 Missing and 1 partial ⚠️
...udstack/api/command/admin/config/UpdateCfgCmd.java 60.00% 1 Missing and 1 partial ⚠️
...src/main/java/com/cloud/api/ApiResponseHelper.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##               main    #6918     +/-   ##
===========================================
  Coverage     15.28%   15.28%             
- Complexity    11528    11540     +12     
===========================================
  Files          5425     5425             
  Lines        474072   474259    +187     
  Branches      57689    61821   +4132     
===========================================
+ Hits          72466    72511     +45     
- Misses       393554   393675    +121     
- Partials       8052     8073     +21     
Flag Coverage Δ
uitests 4.26% <ø> (-0.01%) ⬇️
unittests 16.02% <22.04%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@benj-n

benj-n commented May 7, 2024

Copy link
Copy Markdown
Contributor

Hi @soreana !
This PR has an extensive history. I fixed the conflicts with the main branch. Besides that, what's left to do here ?

@weizhouapache

Copy link
Copy Markdown
Member

Hi @soreana !
This PR has an extensive history. I fixed the conflicts with the main branch. Besides that, what's left to do here ?

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@weizhouapache 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.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✖️ el7 ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 9568

@weizhouapache

Copy link
Copy Markdown
Member

Hi @soreana !
This PR has an extensive history. I fixed the conflicts with the main branch. Besides that, what's left to do here ?

@benj-n
Can you please have a look at the build failures?

@benj-n

benj-n commented May 8, 2024

Copy link
Copy Markdown
Contributor

Hi @soreana !
This PR has an extensive history. I fixed the conflicts with the main branch. Besides that, what's left to do here ?

@benj-n Can you please have a look at the build failures?

@weizhouapache It should be better now.

@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@sureshanaparti

Copy link
Copy Markdown
Contributor

hi @soreana please check / fix the conflicts in the branch.

@soreana

soreana commented Jun 5, 2025

Copy link
Copy Markdown
Member Author

hi @soreana please check / fix the conflicts in the branch.

Hey @sureshanaparti, I don't have access to this repo any more. Please ask @benj-n to have a look.

@soreana

soreana commented Sep 9, 2025

Copy link
Copy Markdown
Member Author

I am no longer have access to the LeaseWeb fork, I can't work continue this PR. I have tried to contact them, but I have not received a response. @phsm Feel free to reopen it or create another PR with these changes.

@soreana soreana closed this Sep 9, 2025
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Apache CloudStack 4.22.0 Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.