functional: Enable real policy fixture by default

Enable the policy fixture by default, which should yield more realistic
functional tests. We need to update some tests to use admin APIs where
policy dictates they are necessary. Note that we're currently testing
the legacy policy - not the updated, scoped policy - since the legacy
policy is the default one currently.

Note that we also need to modify the 'SingleCellSimple' fixture in this
change to use the same project ID as the 'OSAPIFixture'.

Change-Id: Ia3dea78f16cb3c7081714c4db36e20d5ee76ed7d
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2020-08-11 10:40:01 +01:00
parent f72c9e59fb
commit 8750c4e173
114 changed files with 206 additions and 230 deletions

View File

@ -55,9 +55,6 @@
"config_drive": "",
"OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": "us-west",
"OS-EXT-SRV-ATTR:host": "b8b357f7100d4391828f2177c922ef93",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
"OS-EXT-STS:power_state": 4,
"OS-EXT-STS:task_state": null,
"OS-EXT-STS:vm_state": "rescued",

View File

@ -56,9 +56,6 @@
"config_drive": "",
"OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": "us-west",
"OS-EXT-SRV-ATTR:host": "b8b357f7100d4391828f2177c922ef93",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
"OS-EXT-STS:power_state": 1,
"OS-EXT-STS:task_state": null,
"OS-EXT-STS:vm_state": "active",

View File

@ -2,16 +2,6 @@
"server": {
"OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": "us-west",
"OS-EXT-SRV-ATTR:host": "compute",
"OS-EXT-SRV-ATTR:hostname": "new-server-test",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
"OS-EXT-SRV-ATTR:kernel_id": "",
"OS-EXT-SRV-ATTR:launch_index": 0,
"OS-EXT-SRV-ATTR:ramdisk_id": "",
"OS-EXT-SRV-ATTR:reservation_id": "r-d0bls59j",
"OS-EXT-SRV-ATTR:root_device_name": "/dev/sda",
"OS-EXT-SRV-ATTR:user_data": "IyEvYmluL2Jhc2gKL2Jpbi9zdQplY2hvICJJIGFtIGluIHlvdSEiCg==",
"OS-EXT-STS:power_state": 4,
"OS-EXT-STS:task_state": null,
"OS-EXT-STS:vm_state": "rescued",
@ -42,7 +32,6 @@
"vcpus": 1
},
"hostId": "2091634baaccdc4c5a1d57069c833e402921df696b7f970791b12ec6",
"host_status": "UP",
"id": "69bebe1c-3bdb-4feb-9b79-afa3d4782d95",
"image": {
"id": "70a599e0-31e7-49b7-b260-868f441e862b",

View File

@ -2,16 +2,6 @@
"server": {
"OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": "us-west",
"OS-EXT-SRV-ATTR:host": "compute",
"OS-EXT-SRV-ATTR:hostname": "new-server-test",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
"OS-EXT-SRV-ATTR:kernel_id": "",
"OS-EXT-SRV-ATTR:launch_index": 0,
"OS-EXT-SRV-ATTR:ramdisk_id": "",
"OS-EXT-SRV-ATTR:reservation_id": "r-g20x6pwt",
"OS-EXT-SRV-ATTR:root_device_name": "/dev/sda",
"OS-EXT-SRV-ATTR:user_data": "IyEvYmluL2Jhc2gKL2Jpbi9zdQplY2hvICJJIGFtIGluIHlvdSEiCg==",
"OS-EXT-STS:power_state": 1,
"OS-EXT-STS:task_state": null,
"OS-EXT-STS:vm_state": "active",
@ -42,7 +32,6 @@
"vcpus": 1
},
"hostId": "2091634baaccdc4c5a1d57069c833e402921df696b7f970791b12ec6",
"host_status": "UP",
"id": "5a0ffa96-ae59-4f82-b7a6-e0c9007cd576",
"image": {
"id": "70a599e0-31e7-49b7-b260-868f441e862b",

View File

@ -59,16 +59,6 @@
"config_drive": "",
"OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": "us-west",
"OS-EXT-SRV-ATTR:host": "b8b357f7100d4391828f2177c922ef93",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
"OS-EXT-SRV-ATTR:reservation_id": "r-00000001",
"OS-EXT-SRV-ATTR:launch_index": 0,
"OS-EXT-SRV-ATTR:kernel_id": "",
"OS-EXT-SRV-ATTR:ramdisk_id": "",
"OS-EXT-SRV-ATTR:hostname": "fake-hostname",
"OS-EXT-SRV-ATTR:root_device_name": "/dev/sda",
"OS-EXT-SRV-ATTR:user_data": "IyEvYmluL2Jhc2gKL2Jpbi9zdQplY2hvICJJIGFtIGluIHlvdSEiCg==",
"OS-EXT-STS:power_state": 1,
"OS-EXT-STS:task_state": null,
"OS-EXT-STS:vm_state": "active",
@ -79,7 +69,6 @@
{
"name": "default"
}
],
"host_status": "UP"
]
}
}

View File

@ -60,16 +60,6 @@
"config_drive": "",
"OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": "us-west",
"OS-EXT-SRV-ATTR:host": "c3f14e9812ad496baf92ccfb3c61e15f",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
"OS-EXT-SRV-ATTR:reservation_id": "r-00000001",
"OS-EXT-SRV-ATTR:launch_index": 0,
"OS-EXT-SRV-ATTR:kernel_id": "",
"OS-EXT-SRV-ATTR:ramdisk_id": "",
"OS-EXT-SRV-ATTR:hostname": "fake-hostname",
"OS-EXT-SRV-ATTR:root_device_name": "/dev/sda",
"OS-EXT-SRV-ATTR:user_data": "IyEvYmluL2Jhc2gKL2Jpbi9zdQplY2hvICJJIGFtIGluIHlvdSEiCg==",
"OS-EXT-STS:power_state": 1,
"OS-EXT-STS:task_state": null,
"OS-EXT-STS:vm_state": "active",
@ -80,8 +70,7 @@
{
"name": "default"
}
],
"host_status": "UP"
]
}
]
}

View File

@ -51,6 +51,6 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2013-11-14T06:29:02Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -76,6 +76,6 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2013-09-03T04:01:33Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -50,6 +50,6 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2012-12-02T02:11:58Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -77,7 +77,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2013-09-03T04:01:32Z",
"user_id": "fake"
"user_id": "admin"
}
],
"servers_links": [

View File

@ -87,6 +87,6 @@
"host_status": "UP",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2013-09-16T02:55:08Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -88,7 +88,7 @@
"host_status": "UP",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2013-09-16T02:55:05Z",
"user_id": "fake"
"user_id": "admin"
}
],
"servers_links": [

View File

@ -53,6 +53,6 @@
"OS-DCF:diskConfig": "AUTO",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2013-11-14T06:29:02Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -88,6 +88,6 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2015-12-07T17:24:15Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -52,6 +52,6 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2015-12-07T19:19:36Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -89,7 +89,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2015-12-07T19:54:49Z",
"user_id": "fake"
"user_id": "admin"
}
],
"servers_links": [

View File

@ -51,7 +51,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2013-11-14T06:29:02Z",
"user_id": "fake",
"user_id": "admin",
"locked": false,
"description" : "description of foobar",
"tags": ["tag1", "tag2"]

View File

@ -85,6 +85,6 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2013-09-03T04:01:33Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -86,7 +86,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2013-09-03T04:01:32Z",
"user_id": "fake"
"user_id": "admin"
}
],
"servers_links": [

View File

@ -54,6 +54,6 @@
"tags": [],
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2013-11-14T06:29:02Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -91,6 +91,6 @@
"tags": [],
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2017-02-14T19:24:00Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -53,6 +53,6 @@
"tags": [],
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2012-12-02T02:11:58Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -92,7 +92,7 @@
"tags": [],
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2017-02-14T19:24:43Z",
"user_id": "fake"
"user_id": "admin"
}
],
"servers_links": [

View File

@ -89,6 +89,6 @@
"tags": ["tag1", "tag2"],
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2017-02-14T19:24:00Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -90,7 +90,7 @@
"tags": ["tag1", "tag2"],
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2017-02-14T19:24:43Z",
"user_id": "fake"
"user_id": "admin"
}
],
"servers_links": [

View File

@ -54,7 +54,7 @@
"OS-DCF:diskConfig": "AUTO",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2013-11-14T06:29:02Z",
"user_id": "fake",
"user_id": "admin",
"tags": []
}
}

View File

@ -54,7 +54,7 @@
"OS-DCF:diskConfig": "AUTO",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2013-11-14T06:29:02Z",
"user_id": "fake",
"user_id": "admin",
"tags": [],
"user_data": "ZWNobyAiaGVsbG8gd29ybGQi"
}

View File

@ -62,7 +62,7 @@
"674736e3-f25c-405c-8362-bbf991e0ce0a"
],
"updated": "2017-10-10T16:06:03Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -86,6 +86,6 @@
"674736e3-f25c-405c-8362-bbf991e0ce0a"
],
"updated": "2017-02-14T19:24:00Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -59,6 +59,6 @@
"674736e3-f25c-405c-8362-bbf991e0ce0a"
],
"updated": "2012-12-02T02:11:58Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -87,7 +87,7 @@
"674736e3-f25c-405c-8362-bbf991e0ce0a"
],
"updated": "2017-10-10T15:49:09Z",
"user_id": "fake"
"user_id": "admin"
}
],
"servers_links": [

View File

@ -87,7 +87,7 @@
"674736e3-f25c-405c-8362-bbf991e0ce0a"
],
"updated": "2018-10-10T15:49:09Z",
"user_id": "fake"
"user_id": "admin"
}
]
}

View File

@ -23,8 +23,8 @@
]
},
"status": "UNKNOWN",
"tenant_id": "project",
"user_id": "fake",
"tenant_id": "6f70656e737461636b20342065766572",
"user_id": "admin",
"links": [
{
"href": "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/servers/33748c23-38dd-4f70-b774-522fc69e7b67",

View File

@ -60,6 +60,6 @@
"trusted_image_certificates": null,
"updated": "2019-02-28T03:16:20Z",
"user_data": "ZWNobyAiaGVsbG8gd29ybGQi",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -26,8 +26,8 @@
"f3d86fe6-4246-4be8-b87c-eb894626c741"
],
"status": "UNKNOWN",
"tenant_id": "project",
"user_id": "fake",
"tenant_id": "6f70656e737461636b20342065766572",
"user_id": "admin",
"links": [
{
"href": "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/servers/2669556b-b4a3-41f1-a0c1-f9c7ff75e53c",

View File

@ -84,6 +84,6 @@
"tenant_id": "6f70656e737461636b20342065766572",
"trusted_image_certificates": null,
"updated": "2019-02-28T03:16:19Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -6,6 +6,6 @@
"policy": "affinity",
"project_id": "6f70656e737461636b20342065766572",
"rules": {},
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -57,6 +57,6 @@
"tenant_id": "6f70656e737461636b20342065766572",
"trusted_image_certificates": null,
"updated": "2019-02-28T03:16:19Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -59,6 +59,6 @@
"trusted_image_certificates": null,
"updated": "2019-04-23T17:10:24Z",
"user_data": "ZWNobyAiaGVsbG8gd29ybGQi",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -83,6 +83,6 @@
"tenant_id": "6f70656e737461636b20342065766572",
"trusted_image_certificates": null,
"updated": "2019-04-23T15:19:11Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -56,6 +56,6 @@
"tenant_id": "6f70656e737461636b20342065766572",
"trusted_image_certificates": null,
"updated": "2019-04-23T17:37:48Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -83,7 +83,7 @@
"tenant_id": "6f70656e737461636b20342065766572",
"trusted_image_certificates": null,
"updated": "2019-04-23T15:19:15Z",
"user_id": "fake"
"user_id": "admin"
}
]
}

View File

@ -84,6 +84,6 @@
"trusted_image_certificates": null,
"updated": "2019-04-23T17:10:24Z",
"user_data": "ZWNobyAiaGVsbG8gd29ybGQi",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -83,6 +83,6 @@
"tenant_id": "6f70656e737461636b20342065766572",
"trusted_image_certificates": null,
"updated": "2012-12-02T02:11:58Z",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -85,7 +85,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2013-09-03T04:01:33Z",
"user_id": "fake",
"user_id": "admin",
"locked": false
}
}

View File

@ -86,7 +86,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "2013-09-03T04:01:32Z",
"user_id": "fake",
"user_id": "admin",
"locked": false
}
],

View File

@ -65,13 +65,13 @@ from nova import service
from nova.tests.functional.api import client
from nova.tests.unit import fake_requests
_TRUE_VALUES = ('True', 'true', '1', 'yes')
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
DB_SCHEMA = collections.defaultdict(str)
SESSION_CONFIGURED = False
LOG = logging.getLogger(__name__)
PROJECT_ID = '6f70656e737461636b20342065766572'
class ServiceFixture(fixtures.Fixture):
@ -153,7 +153,7 @@ class StandardLogging(fixtures.Fixture):
root.setLevel(std_logging.DEBUG)
# supports collecting debug level for local runs
if os.environ.get('OS_DEBUG') in _TRUE_VALUES:
if os.environ.get('OS_DEBUG') in ('True', 'true', '1', 'yes'):
level = std_logging.DEBUG
else:
level = std_logging.INFO
@ -247,8 +247,11 @@ class SingleCellSimple(fixtures.Fixture):
instances_created=False to init.
"""
def __init__(self, instances_created=True):
def __init__(
self, instances_created=True, project_id=PROJECT_ID,
):
self.instances_created = instances_created
self.project_id = project_id
def setUp(self):
super(SingleCellSimple, self).setUp()
@ -294,7 +297,7 @@ class SingleCellSimple(fixtures.Fixture):
'created_at': None,
'instance_uuid': instance_uuid,
'cell_id': (self.instances_created and 1 or None),
'project_id': 'project',
'project_id': self.project_id,
'cell_mapping': (
self.instances_created and self._fake_cell_get() or None),
}
@ -839,9 +842,10 @@ class OSAPIFixture(fixtures.Fixture):
"""
def __init__(self, api_version='v2',
project_id='6f70656e737461636b20342065766572',
use_project_id_in_urls=False, stub_keystone=True):
def __init__(
self, api_version='v2', project_id=PROJECT_ID,
use_project_id_in_urls=False, stub_keystone=True,
):
"""Constructor
:param api_version: the API version that we're interested in
@ -1162,7 +1166,7 @@ class NeutronFixture(fixtures.Fixture):
"""A fixture to boot instances with neutron ports"""
# the default project_id in OsaAPIFixtures
tenant_id = '6f70656e737461636b20342065766572'
tenant_id = PROJECT_ID
network_1 = {
'id': '3cb9bc59-5699-4588-a4b1-b87f96708bc6',
@ -2046,7 +2050,7 @@ class CinderFixture(fixtures.Fixture):
"""A fixture to volume operations with the new Cinder attach/detach API"""
# the default project_id in OSAPIFixtures
tenant_id = '6f70656e737461636b20342065766572'
tenant_id = PROJECT_ID
SWAP_OLD_VOL = 'a07f71dc-8151-4e7d-a0cc-cd24a3f11113'
SWAP_NEW_VOL = '227cc671-f30b-4488-96fd-7d0bf13648d8'

View File

@ -55,9 +55,6 @@
"config_drive": "%(cdrive)s",
"OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": "us-west",
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
"OS-EXT-STS:power_state": 4,
"OS-EXT-STS:task_state": null,
"OS-EXT-STS:vm_state": "rescued",

View File

@ -56,9 +56,6 @@
"config_drive": "%(cdrive)s",
"OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": "us-west",
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
"OS-EXT-STS:power_state": 1,
"OS-EXT-STS:task_state": null,
"OS-EXT-STS:vm_state": "active",

View File

@ -2,16 +2,6 @@
"server": {
"OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": "us-west",
"OS-EXT-SRV-ATTR:host": "compute",
"OS-EXT-SRV-ATTR:hostname": "new-server-test",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
"OS-EXT-SRV-ATTR:kernel_id": "",
"OS-EXT-SRV-ATTR:launch_index": 0,
"OS-EXT-SRV-ATTR:ramdisk_id": "",
"OS-EXT-SRV-ATTR:reservation_id": "%(reservation_id)s",
"OS-EXT-SRV-ATTR:root_device_name": "/dev/sda",
"OS-EXT-SRV-ATTR:user_data": "IyEvYmluL2Jhc2gKL2Jpbi9zdQplY2hvICJJIGFtIGluIHlvdSEiCg==",
"OS-EXT-STS:power_state": 4,
"OS-EXT-STS:task_state": null,
"OS-EXT-STS:vm_state": "rescued",
@ -42,7 +32,6 @@
"vcpus": 1
},
"hostId": "2091634baaccdc4c5a1d57069c833e402921df696b7f970791b12ec6",
"host_status": "UP",
"id": "%(id)s",
"image": {
"id": "%(uuid)s",

View File

@ -2,16 +2,6 @@
"server": {
"OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": "us-west",
"OS-EXT-SRV-ATTR:host": "compute",
"OS-EXT-SRV-ATTR:hostname": "new-server-test",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
"OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
"OS-EXT-SRV-ATTR:kernel_id": "",
"OS-EXT-SRV-ATTR:launch_index": 0,
"OS-EXT-SRV-ATTR:ramdisk_id": "",
"OS-EXT-SRV-ATTR:reservation_id": "%(reservation_id)s",
"OS-EXT-SRV-ATTR:root_device_name": "/dev/sda",
"OS-EXT-SRV-ATTR:user_data": "IyEvYmluL2Jhc2gKL2Jpbi9zdQplY2hvICJJIGFtIGluIHlvdSEiCg==",
"OS-EXT-STS:power_state": 1,
"OS-EXT-STS:task_state": null,
"OS-EXT-STS:vm_state": "active",
@ -42,7 +32,6 @@
"vcpus": 1
},
"hostId": "2091634baaccdc4c5a1d57069c833e402921df696b7f970791b12ec6",
"host_status": "UP",
"id": "%(id)s",
"image": {
"id": "%(uuid)s",

View File

@ -59,16 +59,6 @@
"config_drive": "",
"OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": "us-west",
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
"OS-EXT-SRV-ATTR:reservation_id": "%(reservation_id)s",
"OS-EXT-SRV-ATTR:launch_index": 0,
"OS-EXT-SRV-ATTR:kernel_id": "",
"OS-EXT-SRV-ATTR:ramdisk_id": "",
"OS-EXT-SRV-ATTR:hostname": "%(hostname)s",
"OS-EXT-SRV-ATTR:root_device_name": "/dev/sda",
"OS-EXT-SRV-ATTR:user_data": "%(user_data)s",
"OS-EXT-STS:power_state": 1,
"OS-EXT-STS:task_state": null,
"OS-EXT-STS:vm_state": "active",
@ -79,7 +69,6 @@
{
"name": "default"
}
],
"host_status": "UP"
]
}
}

View File

@ -60,16 +60,6 @@
"config_drive": "",
"OS-DCF:diskConfig": "AUTO",
"OS-EXT-AZ:availability_zone": "us-west",
"OS-EXT-SRV-ATTR:host": "%(compute_host)s",
"OS-EXT-SRV-ATTR:hypervisor_hostname": "%(hypervisor_hostname)s",
"OS-EXT-SRV-ATTR:instance_name": "%(instance_name)s",
"OS-EXT-SRV-ATTR:reservation_id": "%(reservation_id)s",
"OS-EXT-SRV-ATTR:launch_index": 0,
"OS-EXT-SRV-ATTR:kernel_id": "",
"OS-EXT-SRV-ATTR:ramdisk_id": "",
"OS-EXT-SRV-ATTR:hostname": "%(hostname)s",
"OS-EXT-SRV-ATTR:root_device_name": "/dev/sda",
"OS-EXT-SRV-ATTR:user_data": "%(user_data)s",
"OS-EXT-STS:power_state": 1,
"OS-EXT-STS:task_state": null,
"OS-EXT-STS:vm_state": "active",
@ -80,8 +70,7 @@
{
"name": "default"
}
],
"host_status": "UP"
]
}
]
}

View File

@ -51,6 +51,6 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -72,6 +72,6 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -50,6 +50,6 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -73,7 +73,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
],
"servers_links": [

View File

@ -80,7 +80,7 @@
"status": "ACTIVE",
"host_status": "UP",
"tenant_id": "6f70656e737461636b20342065766572",
"user_id": "fake",
"user_id": "admin",
"key_name": null
}
}

View File

@ -81,7 +81,7 @@
"host_status": "UP",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake",
"user_id": "admin",
"locked": false
}
],

View File

@ -53,6 +53,6 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -81,7 +81,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake",
"user_id": "admin",
"locked": false
}
}

View File

@ -51,7 +51,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake",
"user_id": "admin",
"locked": false
}
}

View File

@ -82,7 +82,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake",
"user_id": "admin",
"locked": false
}
],

View File

@ -51,7 +51,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake",
"user_id": "admin",
"locked": false,
"description": "%(description)s",
"tags": ["tag1", "tag2"]

View File

@ -79,6 +79,6 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -80,7 +80,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
],
"servers_links": [

View File

@ -54,6 +54,6 @@
"tags": [],
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -85,6 +85,6 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -53,6 +53,6 @@
"tags": [],
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -86,7 +86,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
],
"servers_links": [

View File

@ -83,6 +83,6 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -84,7 +84,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
],
"servers_links": [

View File

@ -54,7 +54,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake",
"user_id": "admin",
"tags": []
}
}

View File

@ -54,7 +54,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake",
"user_id": "admin",
"tags": [],
"user_data": "ZWNobyAiaGVsbG8gd29ybGQi"
}

View File

@ -62,6 +62,6 @@
"674736e3-f25c-405c-8362-bbf991e0ce0a"
],
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -82,7 +82,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake",
"user_id": "admin",
"trusted_image_certificates": [
"0b5d2c72-12cc-4ba6-a8d7-3ff5cc1d8cb8",
"674736e3-f25c-405c-8362-bbf991e0ce0a"

View File

@ -59,6 +59,6 @@
"674736e3-f25c-405c-8362-bbf991e0ce0a"
],
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -87,7 +87,7 @@
"674736e3-f25c-405c-8362-bbf991e0ce0a"
],
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
],
"servers_links": [

View File

@ -87,7 +87,7 @@
"674736e3-f25c-405c-8362-bbf991e0ce0a"
],
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
]
}

View File

@ -23,8 +23,8 @@
]
},
"status": "UNKNOWN",
"tenant_id": "project",
"user_id": "fake",
"tenant_id": "6f70656e737461636b20342065766572",
"user_id": "admin",
"links": [
{
"href": "%(versioned_compute_endpoint)s/servers/%(uuid)s",

View File

@ -57,7 +57,7 @@
"tags": [],
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake",
"user_id": "admin",
"user_data": "ZWNobyAiaGVsbG8gd29ybGQi"
}
}

View File

@ -24,8 +24,8 @@
},
"status": "UNKNOWN",
"server_groups": ["%(uuid)s"],
"tenant_id": "project",
"user_id": "fake",
"tenant_id": "6f70656e737461636b20342065766572",
"user_id": "admin",
"links": [
{
"href": "%(versioned_compute_endpoint)s/servers/%(uuid)s",

View File

@ -82,6 +82,6 @@
"tenant_id": "6f70656e737461636b20342065766572",
"trusted_image_certificates": null,
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -6,6 +6,6 @@
"policy": "affinity",
"project_id": "6f70656e737461636b20342065766572",
"rules": {},
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -56,6 +56,6 @@
"tenant_id": "6f70656e737461636b20342065766572",
"trusted_image_certificates": null,
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -59,6 +59,6 @@
"trusted_image_certificates": null,
"updated": "%(isotime)s",
"user_data": "ZWNobyAiaGVsbG8gd29ybGQi",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -83,6 +83,6 @@
"tenant_id": "6f70656e737461636b20342065766572",
"trusted_image_certificates": null,
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -56,6 +56,6 @@
"tenant_id": "6f70656e737461636b20342065766572",
"trusted_image_certificates": null,
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -83,7 +83,7 @@
"tenant_id": "6f70656e737461636b20342065766572",
"trusted_image_certificates": null,
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
]
}

View File

@ -84,6 +84,6 @@
"trusted_image_certificates": null,
"updated": "%(isotime)s",
"user_data": "ZWNobyAiaGVsbG8gd29ybGQi",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -83,6 +83,6 @@
"tenant_id": "6f70656e737461636b20342065766572",
"trusted_image_certificates": null,
"updated": "%(isotime)s",
"user_id": "fake"
"user_id": "admin"
}
}

View File

@ -79,7 +79,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake",
"user_id": "admin",
"locked": false
}
}

View File

@ -80,7 +80,7 @@
"status": "ACTIVE",
"tenant_id": "6f70656e737461636b20342065766572",
"updated": "%(isotime)s",
"user_id": "fake",
"user_id": "admin",
"locked": false
}
],

View File

@ -17,6 +17,8 @@ from nova.tests.functional.api_sample_tests import test_servers
class AdminActionsSamplesJsonTest(test_servers.ServersSampleBase):
# The various 'os_compute_api:os-admin-actions:*' policies are admin-only
ADMIN_API = True
sample_dir = "os-admin-actions"
def setUp(self):

View File

@ -17,6 +17,9 @@ from nova.tests.unit.api.openstack import fakes
class AssistedVolumeSnapshotsJsonTests(test_servers.ServersSampleBase):
# The various 'os_compute_api:os-assisted-volume-snapshots:*' policies are
# admin-only
ADMIN_API = True
sample_dir = "os-assisted-volume-snapshots"
def test_create(self):

View File

@ -15,7 +15,6 @@
from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.functional import api_samples_test_base
from nova.tests.unit import policy_fixture
class ServerActionsSampleJsonTest(test_servers.ServersSampleBase):
@ -35,7 +34,6 @@ class ServerActionsSampleJsonTest(test_servers.ServersSampleBase):
actions = api_samples_test_base.objectify(response_data)
self.action_stop = actions['instanceActions'][0]
self._wait_for_state_change({'id': self.uuid}, 'SHUTOFF')
self.policy = self.useFixture(policy_fixture.RealPolicyFixture())
def _get_subs(self):
return {

View File

@ -37,6 +37,8 @@ def fake_get_compute(context, host):
class MigrateServerSamplesJsonTest(test_servers.ServersSampleBase):
# The various 'os_compute_api:os-migrate-server:*' policies are admin-only
ADMIN_API = True
sample_dir = "os-migrate-server"
def setUp(self):
@ -149,6 +151,8 @@ class MigrateServerSamplesJsonTestV230(MigrateServerSamplesJsonTest):
class MigrateServerSamplesJsonTestV256(test_servers.ServersSampleBase):
# The various 'os_compute_api:os-migrate-server:*' policies are admin-only
ADMIN_API = True
sample_dir = "os-migrate-server"
microversion = '2.56'
scenarios = [('v2_56', {'api_major_version': 'v2.1'})]
@ -188,6 +192,8 @@ class MigrateServerSamplesJsonTestV256(test_servers.ServersSampleBase):
class MigrateServerSamplesJsonTestV268(test_servers.ServersSampleBase):
# The various 'os_compute_api:os-migrate-server:*' policies are admin-only
ADMIN_API = True
sample_dir = "os-migrate-server"
microversion = '2.68'
scenarios = [('v2_68', {'api_major_version': 'v2.1'})]

View File

@ -17,6 +17,8 @@ from nova.tests.functional.api_sample_tests import test_servers
class ServerDiagnosticsSamplesJsonTest(test_servers.ServersSampleBase):
# The 'os_compute_api:os-server-diagnostics' policy is admin-only
ADMIN_API = True
sample_dir = "os-server-diagnostics"
def test_server_diagnostics_get(self):

View File

@ -27,6 +27,9 @@ from nova.tests.unit import fake_instance
class ServerMigrationsSampleJsonTest(test_servers.ServersSampleBase):
# The 'os_compute_api:servers:migrations:*' and
# 'os_compute_api:os-migrations:*' policies are admin-only
ADMIN_API = True
sample_dir = 'server-migrations'
scenarios = [('v2_22', {'api_major_version': 'v2.1'})]
microversion = '2.22'
@ -66,6 +69,8 @@ class ServerMigrationsSampleJsonTest(test_servers.ServersSampleBase):
class ServerMigrationsSamplesJsonTestV2_23(test_servers.ServersSampleBase):
# The 'os_compute_api:servers:migrations:*' and
# 'os_compute_api:os-migrations:*' policies are admin-only
ADMIN_API = True
sample_dir = "server-migrations"
microversion = '2.23'
@ -163,6 +168,8 @@ class ServerMigrationsSamplesJsonTestV2_23(test_servers.ServersSampleBase):
class ServerMigrationsSampleJsonTestV2_24(test_servers.ServersSampleBase):
# The 'os_compute_api:servers:migrations:*' and
# 'os_compute_api:os-migrations:*' policies are admin-only
ADMIN_API = True
microversion = '2.24'
sample_dir = "server-migrations"
@ -216,7 +223,6 @@ class ServerMigrationsSampleJsonTestV2_24(test_servers.ServersSampleBase):
class ServerMigrationsSamplesJsonTestV2_59(
ServerMigrationsSamplesJsonTestV2_23
):
ADMIN_API = True
microversion = '2.59'
scenarios = [('v2_59', {'api_major_version': 'v2.1'})]
@ -230,7 +236,6 @@ class ServerMigrationsSamplesJsonTestV2_59(
class ServerMigrationsSampleJsonTestV2_65(ServerMigrationsSampleJsonTestV2_24):
ADMIN_API = True
microversion = '2.65'
scenarios = [('v2_65', {'api_major_version': 'v2.1'})]

View File

@ -104,6 +104,9 @@ class ServersSampleBase(api_sample_base.ApiSampleTestBaseV21):
class ServersSampleJsonTest(ServersSampleBase):
# Many of the 'os_compute_api:servers:*' policies are admin-only, and we
# want to get admin-style (complete) responses even for those aren't
ADMIN_API = True
# This controls whether or not we use the common server API sample
# for server post req/resp.
use_common_server_post = True
@ -256,6 +259,9 @@ class ServersSampleJson252Test(ServersSampleJsonTest):
class ServersSampleJson263Test(ServersSampleBase):
# Many of the 'os_compute_api:servers:*' policies are admin-only, and we
# want to get admin-style (complete) responses even for those aren't
ADMIN_API = True
microversion = '2.63'
scenarios = [('v2_63', {'api_major_version': 'v2.1'})]
@ -324,6 +330,9 @@ class ServersSampleJson263Test(ServersSampleBase):
class ServersSampleJson266Test(ServersSampleBase):
# Many of the 'os_compute_api:servers:*' policies are admin-only, and we
# want to get admin-style (complete) responses even for those aren't
ADMIN_API = True
microversion = '2.66'
scenarios = [('v2_66', {'api_major_version': 'v2.1'})]
@ -376,6 +385,9 @@ class ServersSampleJson267Test(ServersSampleBase):
class ServersSampleJson269Test(ServersSampleBase):
# Many of the 'os_compute_api:servers:*' policies are admin-only, and we
# want to get admin-style (complete) responses even for those aren't
ADMIN_API = True
microversion = '2.69'
scenarios = [('v2_69', {'api_major_version': 'v2.1'})]
@ -423,6 +435,9 @@ class ServersSampleJson269Test(ServersSampleBase):
class ServersSampleJson271Test(ServersSampleBase):
# Many of the 'os_compute_api:servers:*' policies are admin-only, and we
# want to get admin-style (complete) responses even for those aren't
ADMIN_API = True
microversion = '2.71'
scenarios = [('v2_71', {'api_major_version': 'v2.1'})]
@ -515,6 +530,9 @@ class ServersSampleJson271Test(ServersSampleBase):
class ServersSampleJson273Test(ServersSampleBase):
# Many of the 'os_compute_api:servers:*' policies are admin-only, and we
# want to get admin-style (complete) responses even for those aren't
ADMIN_API = True
microversion = '2.73'
scenarios = [('v2_73', {'api_major_version': 'v2.1'})]
@ -571,6 +589,8 @@ class ServersSampleJson274Test(ServersSampleBase):
"""Supporting host and/or hypervisor_hostname is an admin API
to create servers.
"""
# Many of the 'os_compute_api:servers:*' policies are admin-only, and we
# want to get admin-style (complete) responses even for those aren't
ADMIN_API = True
SUPPORTS_CELLS = True
microversion = '2.74'
@ -601,6 +621,10 @@ class ServersSampleJson274Test(ServersSampleBase):
class ServersUpdateSampleJsonTest(ServersSampleBase):
# Many of the 'os_compute_api:servers:*' policies are admin-only, and we
# want to get admin-style (complete) responses even for those aren't
ADMIN_API = True
def test_update_server(self):
uuid = self._post_server()
subs = {}
@ -668,6 +692,9 @@ class _ServersActionsJsonTestMixin(object):
class ServersActionsJsonTest(ServersSampleBase, _ServersActionsJsonTestMixin):
# Many of the 'os_compute_api:servers:*' policies are admin-only, and we
# want to get admin-style (complete) responses even for those aren't
ADMIN_API = True
SUPPORTS_CELLS = True
def test_server_reboot_hard(self):
@ -793,6 +820,9 @@ class ServersActionsJsonTest(ServersSampleBase, _ServersActionsJsonTestMixin):
class ServersActionsJson219Test(ServersSampleBase):
# Many of the 'os_compute_api:servers:*' policies are admin-only, and we
# want to get admin-style (complete) responses even for those aren't
ADMIN_API = True
microversion = '2.19'
scenarios = [('v2_19', {'api_major_version': 'v2.1'})]
@ -817,6 +847,9 @@ class ServersActionsJson219Test(ServersSampleBase):
class ServersActionsJson226Test(ServersSampleBase):
# Many of the 'os_compute_api:servers:*' policies are admin-only, and we
# want to get admin-style (complete) responses even for those aren't
ADMIN_API = True
microversion = '2.26'
scenarios = [('v2_26', {'api_major_version': 'v2.1'})]
@ -849,6 +882,9 @@ class ServersActionsJson226Test(ServersSampleBase):
class ServersActionsJson254Test(ServersSampleBase):
# Many of the 'os_compute_api:servers:*' policies are admin-only, and we
# want to get admin-style (complete) responses even for those aren't
ADMIN_API = True
microversion = '2.54'
sample_dir = 'servers'
scenarios = [('v2_54', {'api_major_version': 'v2.1'})]

Some files were not shown because too many files have changed in this diff Show More