Skip to content

server: fix domain shared public template check#6916

Merged
yadvr merged 1 commit into
apache:4.17from
shapeblue:fix-domain-shared-public-templates
Nov 25, 2022
Merged

server: fix domain shared public template check#6916
yadvr merged 1 commit into
apache:4.17from
shapeblue:fix-domain-shared-public-templates

Conversation

@shwstppr

Copy link
Copy Markdown
Contributor

Description

Fixes #6885

Fixes the incorrect inverted check.

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Using API with two accounts in two different domains,

(local) 🕷 > list domains filter=id,name,path,
{
  "count": 3,
  "domain": [
    {
      "id": "02c03550-6a40-11ed-adb6-645d8651f45a",
      "name": "ROOT",
      "path": "ROOT"
    },
    {
      "id": "a6df78e8-d16f-4b75-b2a9-e7e21bf1458b",
      "name": "d1",
      "path": "ROOT/d1"
    },
    {
      "id": "9d7e43a1-4055-4de7-886f-bcf7b75a6509",
      "name": "d2",
      "path": "ROOT/d2"
    }
  ]
}
(local) 🐕 > list accounts id=c39c1bed-77a2-40e2-9574-3cc0099152d4 filter=id,name,roletype,domainid,domainpath,
{
  "account": [
    {
      "domainid": "a6df78e8-d16f-4b75-b2a9-e7e21bf1458b",
      "domainpath": "ROOT/d1",
      "id": "c39c1bed-77a2-40e2-9574-3cc0099152d4",
      "name": "d1user",
      "roletype": "User"
    }
  ],
  "count": 1
}
(local) 🍀 > list accounts id=515fb210-1cdd-4545-afec-326c98d0a37e  filter=id,name,roletype,domainid,domainpath,
{
  "account": [
    {
      "domainid": "9d7e43a1-4055-4de7-886f-bcf7b75a6509",
      "domainpath": "ROOT/d2",
      "id": "515fb210-1cdd-4545-afec-326c98d0a37e",
      "name": "d2user",
      "roletype": "User"
    }
  ],
  "count": 1
}
(local) 🦁 > list templates id=db68e383-c25d-4fe7-bbf6-aa5a03566e80 filter=id,name,accountid,account,domain,domainid templatefilter=all
{
  "count": 1,
  "template": [
    {
      "account": "d1user",
      "domain": "d1",
      "domainid": "a6df78e8-d16f-4b75-b2a9-e7e21bf1458b",
      "id": "db68e383-c25d-4fe7-bbf6-aa5a03566e80",
      "name": "publicma"
    }
  ]
}
(local) 🐜 > list configurations domainid=a6df78e8-d16f-4b75-b2a9-e7e21bf1458b name=share.public.templates.with.other.domains
{
  "configuration": [
    {
      "category": "Advanced",
      "description": "If false, templates of this domain will not show up in the list templates of other domains.",
      "isdynamic": true,
      "name": "share.public.templates.with.other.domains",
      "scope": "domain",
      "value": "true"
    }
  ],
  "count": 1
}
(local) 🐜 > set username d2user
(local) 🐌 > set domain d2
(local) 🐣 > sync
Discovered 294 APIs
(local) 🐌 > list templates id=db68e383-c25d-4fe7-bbf6-aa5a03566e80 templatefilter=community
{
  "count": 1,
  "template": [
    {
      "account": "d1user",
      "bits": 0,
      "created": "2022-11-22T18:34:04+0530",
      "crossZones": false,
      "deployasis": false,
      "details": {},
      "directdownload": false,
      "displaytext": "publicma",
      "domain": "d1",
      "domainid": "a6df78e8-d16f-4b75-b2a9-e7e21bf1458b",
      "downloaddetails": [
        {
          "datastore": "nfs://10.147.28.6:/export/home/sandbox/secondary",
          "downloadPercent": "100",
          "downloadState": "DOWNLOADED"
        }
      ],
      "format": "VHD",
      "hasannotations": false,
      "hypervisor": "Simulator",
      "id": "db68e383-c25d-4fe7-bbf6-aa5a03566e80",
      "isdynamicallyscalable": false,
      "isextractable": false,
      "isfeatured": false,
      "ispublic": true,
      "isready": true,
      "name": "publicma",
      "ostypeid": "02af909e-6a40-11ed-adb6-645d8651f45a",
      "ostypename": "Other Linux (64-bit)",
      "passwordenabled": false,
      "physicalsize": 5242880,
      "requireshvm": true,
      "size": 5242880,
      "sshkeyenabled": false,
      "tags": [],
      "templatetype": "USER",
      "zoneid": "7044a830-22e1-4671-8c61-0389b5e036ea",
      "zonename": "Sandbox-simulator"
    }
  ]
}

Fixes apache#6885

Fixes the incorrect inverted check.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@shwstppr

Copy link
Copy Markdown
Contributor Author

@soreana can you please review

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@codecov

codecov Bot commented Nov 22, 2022

Copy link
Copy Markdown

Codecov Report

Merging #6916 (02bba6a) into 4.17 (296035d) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

@@             Coverage Diff              @@
##               4.17    #6916      +/-   ##
============================================
- Coverage     10.34%   10.34%   -0.01%     
- Complexity     6610     6611       +1     
============================================
  Files          2451     2451              
  Lines        242340   242340              
  Branches      37924    37924              
============================================
- Hits          25070    25065       -5     
- Misses       214182   214187       +5     
  Partials       3088     3088              
Impacted Files Coverage Δ
...ver/src/main/java/com/cloud/acl/DomainChecker.java 0.42% <0.00%> (ø)
...rg/apache/cloudstack/quota/QuotaStatementImpl.java 36.28% <0.00%> (-3.99%) ⬇️
...dstack/network/contrail/model/ModelObjectBase.java 28.84% <0.00%> (+7.69%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@weizhouapache weizhouapache left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

code lgtm

@yadvr yadvr added this to the 4.18.0.0 milestone Nov 23, 2022
@yadvr

yadvr commented Nov 23, 2022

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@rohityadavcloud 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 4631

@shwstppr

Copy link
Copy Markdown
Contributor Author

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@shwstppr a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@yadvr yadvr modified the milestones: 4.18.0.0, 4.17.2.0 Nov 24, 2022
@shwstppr

Copy link
Copy Markdown
Contributor Author

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@shwstppr a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-5258)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 42174 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr6916-t5258-kvm-centos7.zip
Smoke tests completed. 99 look OK, 2 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_08_upgrade_kubernetes_ha_cluster Failure 642.60 test_kubernetes_clusters.py
test_03_create_redundant_VPC_1tier_2VMs_2IPs_2PF_ACL_reboot_routers Failure 456.11 test_vpc_redundant.py

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants