Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 41 commits into
base: main
Choose a base branch
from

Conversation

soreana
Copy link
Member

@soreana soreana commented Nov 23, 2022

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
Copy link
Member Author

soreana commented Nov 23, 2022

@blueorangutan package

@blueorangutan
Copy link

@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

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

@rohityadavcloud
Copy link
Member

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

Copy link
Contributor

@JoaoJandre JoaoJandre left a comment

Choose a reason for hiding this comment

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

LGTM :)

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@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

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

@soreana
Copy link
Member Author

soreana commented Dec 30, 2022

@blueorangutan package

@blueorangutan
Copy link

@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

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

@soreana
Copy link
Member Author

soreana commented Dec 31, 2022

@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
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
Copy link
Member Author

soreana commented Jan 2, 2023

@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

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

@DaanHoogland
Copy link
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
Copy link
Member Author

soreana commented Apr 4, 2023

@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
Copy link
Member Author

soreana commented Apr 4, 2023

@blueorangutan package

@blueorangutan
Copy link

@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

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

@codecov-commenter
Copy link

codecov-commenter commented May 7, 2024

Codecov Report

Attention: 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 715 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.

@benj-n
Copy link
Contributor

benj-n commented May 7, 2024

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

@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

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

@weizhouapache
Copy link
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
Copy link
Contributor

benj-n commented May 8, 2024

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.

Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.