Sangeetha Hariharan created CLOUDSTACK-2365: -----------------------------------------------
Summary: Anti-Affinity - As admin , we are allowed to deploy a Vm in an affinity group that belongs to different user. Key: CLOUDSTACK-2365 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-2365 Project: CloudStack Issue Type: Bug Security Level: Public (Anyone can view this level - this is the default.) Components: Management Server Affects Versions: 4.2.0 Environment: Build from master Reporter: Sangeetha Hariharan Assignee: Sangeetha Hariharan Fix For: 4.2.0 As admin , we are allowed to deploy a Vm in an affinity group that belongs to different user. Steps: As regular user , create affinity group ag1. As admin user , deploy a Vm using this affinity group ag1. Vm deployment succeeds. Expected Behavior: Vm deployment should fail. 013-05-07 11:44:26,304 INFO [cloud.api.ApiServer] (catalina-exec-12:null) (userId=2 accountId=2 sessionId=6F3F48589105D3E1EA2548B29C0CFC04) 10.217.252.128 -- GET command=deployVirtualMachine&zoneId=2b7cb385-5828-4945-a22b-6f0765620d05&templateId=360f4dbf-a4be-4879-8d58-ec123627dca9&hypervisor=KVM&serviceOfferingId=ad7d3b7c-0867-4987-a8e4-f3b6b3fa9a16&affinitygroupids=7376097f-1e14-4053-b448-5948b3bd47e3&networkIds=b38b80c4-76eb-4f92-8083-dc8b54913117&displayname=san-from-adm&name=san-from-adm&response=json&sessionkey=jSnZwpkO1OSiOiXsMXLMg43%2BFqg%3D 200 { "deployvirtualmachineresponse" : {"id":"97217fe1-a235-4130-87b4-a33f0141fce6","jobid":"ba337b91-0ed6-4780-a5ba-44310a6cd220"} } mysql> select name,id,uuid,account_id,domain_id,state from vm_instance where state !="Expunging" and type="User"; +--------------+----+--------------------------------------+------------+-----------+---------+ | name | id | uuid | account_id | domain_id | state | +--------------+----+--------------------------------------+------------+-----------+---------+ | sangee-af-1 | 48 | f694eeaf-d333-4799-b4d1-768fc3cd0541 | 2 | 1 | Running | | san-123 | 54 | 9dd4c65e-86d7-4afb-9260-110bd9d0901d | 4 | 1 | Running | | san-from-adm | 55 | 97217fe1-a235-4130-87b4-a33f0141fce6 | 2 | 1 | Running | +--------------+----+--------------------------------------+------------+-----------+---------+ mysql> select * from affinity_group; +----+-------------+--------------------+--------------------------------------+-------------+-----------+------------+ | id | name | type | uuid | description | domain_id | account_id | +----+-------------+--------------------+--------------------------------------+-------------+-----------+------------+ | 2 | webvms | host anti-affinity | e167a488-693a-41a4-be30-d24545416e95 | NULL | 1 | 196 | | 3 | test | host anti-affinity | d7412237-300c-4d07-99f4-ed3b97909e86 | test | 1 | 2 | | 5 | test3 | host anti-affinity | e88a5039-91f2-4539-a180-df9b8ba880e9 | test3 | 1 | 2 | | 9 | test-test1 | host anti-affinity | b91b96c4-545a-4c01-aa08-f1721f2b45cc | test-test1 | 1 | 91 | | 10 | test4 | host anti-affinity | 4b61e827-8901-42c1-8048-276fc3dbca35 | test4 | 1 | 2 | | 12 | testsangee | host anti-affinity | 8ba39582-5004-4e77-a872-a5a4788c1371 | testsangee | 1 | 4 | | 13 | testsangee1 | host anti-affinity | 6e1d3815-2783-4ae0-b567-50185cff2dac | testsangee1 | 1 | 4 | | 14 | testsan3 | host anti-affinity | 7376097f-1e14-4053-b448-5948b3bd47e3 | testsan3 | 1 | 4 | +----+-------------+--------------------+--------------------------------------+-------------+-----------+------------+ 8 rows in set (0.00 sec) mysql> select * from affinity_group_vm_map; +----+-------------------+-------------+ | id | affinity_group_id | instance_id | +----+-------------------+-------------+ | 4 | 5 | 48 | | 5 | 3 | 48 | | 33 | 13 | 54 | | 34 | 12 | 54 | | 35 | 14 | 55 | +----+-------------------+-------------+ 5 rows in set (0.00 sec) -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira