Do not add current tenant to private flavor access
Avoid adding the current tenant to the flavor access list when
a private flavor is created. In ordeir to add tenants to the
flavor access list we should use the add_tenant api.
Tempest has to be updated accordingly:
https://review.openstack.org/81551
Documentation has to be updated as well:
https://review.openstack.org/82175
Partially (just for the V2 API rather than V2 and V3)
reverts commit 6ba248635b
Fixes unittest which was added in the original commit so it checks
for the behaviour we have now rather than the behaviour after the
backwards incompatible change which is being reverted.
Change-Id: I731081b6df0d96df1bc1763d214d28c62bbbb51c
Closes-Bug: #1286297
This commit is contained in:
parent
b548f31a12
commit
daedfffd95
@ -3,10 +3,6 @@
|
||||
{
|
||||
"flavor_id": "10",
|
||||
"tenant_id": "fake_tenant"
|
||||
},
|
||||
{
|
||||
"flavor_id": "10",
|
||||
"tenant_id": "openstack"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<flavor_access>
|
||||
<access tenant_id="fake_tenant" flavor_id="10"/>
|
||||
<access tenant_id="openstack" flavor_id="10"/>
|
||||
</flavor_access>
|
@ -3,10 +3,6 @@
|
||||
{
|
||||
"flavor_id": "10",
|
||||
"tenant_id": "fake_tenant"
|
||||
},
|
||||
{
|
||||
"flavor_id": "10",
|
||||
"tenant_id": "openstack"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<flavor_access>
|
||||
<access tenant_id="fake_tenant" flavor_id="10"/>
|
||||
<access tenant_id="openstack" flavor_id="10"/>
|
||||
</flavor_access>
|
@ -1,6 +1,3 @@
|
||||
{
|
||||
"flavor_access": [{
|
||||
"flavor_id": "10",
|
||||
"tenant_id": "openstack"
|
||||
}]
|
||||
"flavor_access": []
|
||||
}
|
@ -1,4 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<flavor_access>
|
||||
<access tenant_id="openstack" flavor_id="10"/>
|
||||
</flavor_access>
|
||||
<flavor_access/>
|
||||
|
@ -71,9 +71,6 @@ class FlavorManageController(wsgi.Controller):
|
||||
flavorid=flavorid, swap=swap,
|
||||
rxtx_factor=rxtx_factor,
|
||||
is_public=is_public)
|
||||
if not flavor['is_public']:
|
||||
flavors.add_flavor_access(flavor['flavorid'],
|
||||
context.project_id, context)
|
||||
req.cache_db_flavor(flavor)
|
||||
except (exception.FlavorExists,
|
||||
exception.FlavorIdExists) as err:
|
||||
|
@ -464,7 +464,7 @@ class PrivateFlavorManageTest(test.TestCase):
|
||||
self.flavor_access_controller = flavor_access.FlavorAccessController()
|
||||
self.app = fakes.wsgi_app(init_only=('flavors',))
|
||||
|
||||
def test_create_private_flavor_should_create_flavor_access(self):
|
||||
def test_create_private_flavor_should_not_grant_flavor_access(self):
|
||||
expected = {
|
||||
"flavor": {
|
||||
"name": "test",
|
||||
@ -497,8 +497,8 @@ class PrivateFlavorManageTest(test.TestCase):
|
||||
"tenant_id": "%s" % ctxt.project_id,
|
||||
"flavor_id": "%s" % body["flavor"]["id"]
|
||||
}
|
||||
self.assertTrue(expected_flavor_access_body in
|
||||
flavor_access_body["flavor_access"])
|
||||
self.assertNotIn(expected_flavor_access_body,
|
||||
flavor_access_body["flavor_access"])
|
||||
|
||||
def test_create_public_flavor_should_not_create_flavor_access(self):
|
||||
expected = {
|
||||
|
@ -1,9 +1,5 @@
|
||||
{
|
||||
"flavor_access": [
|
||||
{
|
||||
"flavor_id": "%(flavor_id)s",
|
||||
"tenant_id": "openstack"
|
||||
},
|
||||
{
|
||||
"flavor_id": "%(flavor_id)s",
|
||||
"tenant_id": "%(tenant_id)s"
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<flavor_access>
|
||||
<access tenant_id="%(tenant_id)s" flavor_id="%(flavor_id)s"/>
|
||||
<access tenant_id="openstack" flavor_id="%(flavor_id)s"/>
|
||||
</flavor_access>
|
||||
|
@ -3,10 +3,6 @@
|
||||
{
|
||||
"flavor_id": "%(flavor_id)s",
|
||||
"tenant_id": "fake_tenant"
|
||||
},
|
||||
{
|
||||
"flavor_id": "%(flavor_id)s",
|
||||
"tenant_id": "openstack"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<flavor_access>
|
||||
<access tenant_id="fake_tenant" flavor_id="10"/>
|
||||
<access tenant_id="openstack" flavor_id="10"/>
|
||||
</flavor_access>
|
@ -1,6 +1,3 @@
|
||||
{
|
||||
"flavor_access": [{
|
||||
"tenant_id": "openstack",
|
||||
"flavor_id": "%(flavor_id)s"
|
||||
}]
|
||||
"flavor_access": []
|
||||
}
|
@ -1,4 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<flavor_access>
|
||||
<access tenant_id="openstack" flavor_id="%(flavor_id)s"/>
|
||||
</flavor_access>
|
||||
<flavor_access/>
|
||||
|
Loading…
Reference in New Issue
Block a user