Skip to content

CLOUDSTACK-9432: cluster/host dedicated to a domain is owned by the root domain#2124

Merged
GabrielBrascher merged 1 commit into
apache:masterfrom
GabrielBrascher:CLOUDSTACK-9432
Nov 28, 2017
Merged

CLOUDSTACK-9432: cluster/host dedicated to a domain is owned by the root domain#2124
GabrielBrascher merged 1 commit into
apache:masterfrom
GabrielBrascher:CLOUDSTACK-9432

Conversation

@GabrielBrascher
Copy link
Copy Markdown
Member

@GabrielBrascher GabrielBrascher commented May 21, 2017

Issue: when dedicating a resource (cluster or host) to a domain, the affinity group which is created is visible to everyone rather than only to the domain that the cluster is dedicated to.

Cause: if a resource is not dedicated to an account but a domain, the account parameter is null. The code then uses the domain id from the system account, making the affinity group visible by all accounts.

Proposal: if the account is null, then it should use the domain id passed as a parameter, instead of the domain id from the system account.

Test scenario: a cluster is dedicated to a domain with id '3'. The affinity group domain map should have '3' as its domain id.

Before: id '8' links affinity group '11' to domain '1' (ROOT).

select * from affinity_group_domain_map;
+----+-----------+-------------------+------------------+
| id | domain_id | affinity_group_id | subdomain_access |
+----+-----------+-------------------+------------------+
|  8 |         1 |                11 |                1 |
+----+-----------+-------------------+------------------+

After: id '9' links affinity group '12' to domain '3'.

select * from affinity_group_domain_map;
+----+-----------+-------------------+------------------+
| id | domain_id | affinity_group_id | subdomain_access |
+----+-----------+-------------------+------------------+
|  9 |         3 |                12 |                1 |
+----+-----------+-------------------+------------------+

@GabrielBrascher GabrielBrascher changed the title CLOUDSTACK-9432: cluster/host dedicated to domain is owned by the root domain CLOUDSTACK-9432: cluster/host dedicated to a domain is owned by the root domain May 21, 2017
Copy link
Copy Markdown
Member

@rafaelweingartner rafaelweingartner left a comment

Choose a reason for hiding this comment

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

@GabrielBrascher thanks for the PR.
Could you take a look at some issues that I pointed out?

private AffinityGroupVO createAffinityGroup(final AffinityGroupProcessor processor, final Account owner, final ACLType aclType, final String affinityGroupName, final String affinityGroupType, final String description) {
private AffinityGroupVO createAffinityGroup(final AffinityGroupProcessor processor, final Account owner, final ACLType aclType, final String affinityGroupName, final String affinityGroupType, final String description, boolean domainLevel, Long domainId) {

Long domainIdBasedOnDomainLevel = owner.getDomainId();
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.

@GabrielBrascher what about extracting lines 181-184 to a method and then create a test case for it?
Also a documentation describing the method seems a good idea.

// created only as an admin/system operation.
}
types.add(processor.getType());
if (processor.isAdminControlledGroup()) {
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.

Are these formatting changes needed?
Are you using the CloudStack code formatter style? Or was the code not formatted properly?

Copy link
Copy Markdown
Member Author

@GabrielBrascher GabrielBrascher May 26, 2017

Choose a reason for hiding this comment

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

At first I tried to submit without those changes in lines which I did not touch; however, it failed to pass in check style validation. When my environment formatted the code (with the CloudStack style), all checks have passed. I can review those changes and see if I can minimize them. But some will be necessary.

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.

Ah, ok.
So, let the changes there

@remibergsma
Copy link
Copy Markdown
Contributor

Hi @GabrielBrascher thanks for the fix! Works better for me, although I think the affinity_group table still has IDs 1 for domain and account. Do you see that too?

}
return domainIdBasedOnDomainLevel;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@rafaelweingartner thanks for the review. The code now is in a method with tests and documentation.

When dedicating a resource (cluster or host) to a domain, the affinity
group which is created is visible to everyone rather than only to domain
that the cluster is dedicated to.
@GabrielBrascher
Copy link
Copy Markdown
Member Author

Hi @remibergsma . Thanks for the feedback!

(i) the account ID in the affinity_group table: I kept the account ID as the owner account id (in this case 1 because of the system account id) because I don't know the effect of letting it null; thus, the account ID stayed as it was being managed before this fix. Please feel free to provide any different approach if you have something in mind.

(i) the domain ID in affinity_group table: if I didn't miss anything, the domain ID should be from the dedicated domain ID (instead of 1). Line 186 AffinityGroupVO group = new AffinityGroupVO(affinityGroupName, affinityGroupType, description, affinityGroupDomainId, owner.getId(), aclType); creates an AffinityGroupVO with the domain id affinityGroupDomainId. I will test this again to be sure.

@yadvr
Copy link
Copy Markdown
Member

yadvr commented Jul 27, 2017

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-870

@yadvr
Copy link
Copy Markdown
Member

yadvr commented Jul 27, 2017

@blueorangutan test

@blueorangutan
Copy link
Copy Markdown

@rhtyd 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-1265)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 42728 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2124-t1265-kvm-centos7.zip
Intermitten failure detected: /marvin/tests/smoke/test_deploy_virtio_scsi_vm.py
Intermitten failure detected: /marvin/tests/smoke/test_internal_lb.py
Intermitten failure detected: /marvin/tests/smoke/test_iso.py
Intermitten failure detected: /marvin/tests/smoke/test_privategw_acl.py
Test completed. 48 look ok, 5 have error(s)

Test Result Time (s) Test File
test_04_rvpc_privategw_static_routes Failure 515.76 test_privategw_acl.py
test_03_vpc_privategw_restart_vpc_cleanup Failure 962.64 test_privategw_acl.py
ContextSuite context=TestInternalLb>:setup Error 0.00 test_internal_lb.py
ContextSuite context=TestDeployVirtioSCSIVM>:setup Error 0.00 test_deploy_virtio_scsi_vm.py
test_change_service_offering_for_vm_with_snapshots Skipped 0.00 test_vm_snapshots.py
test_09_copy_delete_template Skipped 0.01 test_templates.py
test_06_copy_template Skipped 0.00 test_templates.py
test_static_role_account_acls Skipped 0.02 test_staticroles.py
test_11_ss_nfs_version_on_ssvm Skipped 0.02 test_ssvm.py
test_01_scale_vm Skipped 0.00 test_scale_vm.py
test_01_primary_storage_iscsi Skipped 0.03 test_primary_storage.py
test_nested_virtualization_vmware Skipped 0.00 test_nested_virtualization.py
test_06_copy_iso Skipped 0.00 test_iso.py
test_deploy_vgpu_enabled_vm Skipped 0.02 test_deploy_vgpu_enabled_vm.py
test_3d_gpu_support Skipped 0.03 test_deploy_vgpu_enabled_vm.py

@rafaelweingartner
Copy link
Copy Markdown
Member

From me you have an LGTM.
@remibergsma what do you think here?

@yadvr
Copy link
Copy Markdown
Member

yadvr commented Sep 16, 2017

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1088

Copy link
Copy Markdown
Contributor

@houthuis houthuis left a comment

Choose a reason for hiding this comment

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

tested locally, it works as described

@GabrielBrascher
Copy link
Copy Markdown
Member Author

Thanks for the review @rafaelweingartner @houthuis @remibergsma @rhtyd. I think this PR is ready for merge.

@GabrielBrascher GabrielBrascher merged commit bd56044 into apache:master Nov 28, 2017
@yadvr
Copy link
Copy Markdown
Member

yadvr commented Nov 28, 2017

@GabrielBrascher okay, I'll run regression tests on master later. Kindly use 'squash merge' in future and commits should include the JIRA id in their commit summary such as CLOUDSTACK-xxxx: short summary...

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants