Commit Graph

56884 Commits

Author SHA1 Message Date
Stephen Finucane 58784943f7 api: Add framework for extra spec validation
Add the validation framework necessary to verify extra specs along with
the definitions for every extra spec we currently recognize in-tree.
None of this is currently used since we don't have the API microversions
wired up, but that will come in a future patch.

Note that we must add the H238 hacking check to the ignore list here,
since this includes our first use of Python 3-type classes without the
explicit 'object' subclass. This can be removed when that check is
removed from hacking.

Part of blueprint flavor-extra-spec-validators

Change-Id: Ib64a1348cce1dca995746214616c4f33d9d664bd
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-04-08 12:47:01 +00:00
Zuul e487b05f7e Merge "Allow PUT volume attachments API to modify delete_on_termination" 2020-04-03 05:21:35 +00:00
Zuul 39340b4122 Merge "Pass the actual target in migrations policy" 2020-04-03 03:52:49 +00:00
Zuul c9e9b4311b Merge "Ensure we pass a target in admin actions" 2020-04-03 02:14:35 +00:00
Zuul 184fcdaaa4 Merge "Fix assertEqual param order in Accelerator tests" 2020-04-02 23:08:37 +00:00
Zuul 6691517703 Merge "Add new default roles in migrations policies" 2020-04-02 23:08:29 +00:00
Zuul 394ef32790 Merge "Introduce scope_types in list migrations" 2020-04-02 23:08:18 +00:00
Zuul bf242d1f16 Merge "FUP for Add a placement audit command" 2020-04-02 23:08:07 +00:00
Zuul 7520676b28 Merge "tests: work around malformed serial XML" 2020-04-02 18:39:25 +00:00
Zuul ccd9cb4e6c Merge "func tests: move _run_periodics() into base class" 2020-04-02 18:39:18 +00:00
Zuul 57f4f9b960 Merge "Add new default roles in server diagnostics policies" 2020-04-02 18:39:11 +00:00
Zuul 4961ceec74 Merge "Introduce scope_types in server diagnostics" 2020-04-02 18:30:26 +00:00
Zuul a16a194526 Merge "Add test coverage of existing server diagnostics policies" 2020-04-02 17:39:34 +00:00
zhangbailin 733d4133df Allow PUT volume attachments API to modify delete_on_termination
Allow PUT /servers/{server_id}/os-volume_attachments/{volume_id}``
to support specifying ``delete_on_termination`` field in the request
body. This allows updating the attached volume's flag that controls
whether or not it is automatically deleted when the instance is deleted.

When we request 'volumeId' and 'delete_on_termination' in the requst
body to swap volume, since the new microversion it will be support
updating the swapping volume's delete flag.

Co-Authored-By: Dan Smith <dansmith@redhat.com>

Blueprint: destroy-instance-with-datavolume
Change-Id: I6ccac4e17f56b40e67c79d40f32558ef414685ea
2020-04-02 09:26:55 -07:00
Zuul acc0dc31c3 Merge "Combine the limits policies in single place" 2020-04-02 14:20:18 +00:00
Balazs Gibizer 0639f96cdb Fix assertEqual param order in Accelerator tests
To have a correct error message in case of failure the proper order
of parameters are:

    self.assertEqual(expected, actual)

Change-Id: Ia0e909c6ed19f0fd49aa3aa5f5f7a9ea987d9080
2020-04-02 14:20:53 +02:00
Zuul 43f30e876d Merge "Add new default roles in remote console policies" 2020-04-02 11:03:44 +00:00
Ghanshyam Mann f69951fd25 Add new default roles in server diagnostics policies
This adds new defaults roles in server diagnostics API policies.
This policy is default to SYSTEM_ADMIN role.

Also add tests to simulates the future where we drop the deprecation
fall back in the policy by overriding the rules with a version where
there are no deprecated rule options. Operators can do the same by
adding overrides in their policy files that match the default but
stop the rule deprecation fallback from happening.

Partial implement blueprint policy-defaults-refresh

Change-Id: Ibecf2ea61d75ec574123094a1783f9d664000d98
2020-04-01 20:07:32 -05:00
Ghanshyam Mann c26fc5da04 Introduce scope_types in server diagnostics
oslo.policy introduced the scope_type feature which can
control the access level at system-level and project-level.
 - https://docs.openstack.org/oslo.policy/latest/user/usage.html#setting-scope
 - http://specs.openstack.org/openstack/keystone-specs/specs/keystone/queens/system-scope.html

Appropriate scope_type for nova case:
- https://specs.openstack.org/openstack/nova-specs/specs/ussuri/approved/policy-defaults-refresh.html#scope

This commit introduce scope_type for server diagnostics API policies
as 'system' and 'project' but we will keep default as SYSTEM_ADMIN only.

Also adds the test case with scope_type enabled and verify we
pass and fail the policy check with expected context.

Partial implement blueprint policy-defaults-refresh

Change-Id: Ie1749d4f85b8bdc4110f57c9a33e54e9551cb7e3
2020-04-01 19:55:43 -05:00
Ghanshyam Mann 12b0284b6c Add test coverage of existing server diagnostics policies
Current tests do not have good test coverage of existing policies.
Either tests for policies do not exist or if they exist then they
do not cover the actual negative and positive testing.

For Example, if any policy with default rule as admin only then
test should verify:
- policy check pass with context having admin or server owner
- policy check fail with context having non-admin and not server owner

As discussed in policy-defaults-refresh, to change the policies
with new default roles and scope_type, we need to have the enough
testing coverage of existing policy behavior.

When we will add the scope_type in policies or new default roles,
then these test coverage will be extended to adopt the new changes
and also make sure we do not break the existing behavior.

This commit covers the testing coverage of existing server
diagnostics policies.

Partial implement blueprint policy-defaults-refresh

Change-Id: I98faf703fea615d553700dd3c151c044fbc46821
2020-04-01 19:36:33 -05:00
Zuul 241cffbeba Merge "Add new default roles in rescue server policies" 2020-04-01 23:29:59 +00:00
Ghanshyam Mann 1c45a2f435 Add new default roles in remote console policies
This adds new defaults roles in remote console  API policies.
- lock/unlock policies are default to system admin or project member.
- unlock server locked by other is system admin.

Also add tests to simulates the future where we drop the deprecation
fall back in the policy by overriding the rules with a version where
there are no deprecated rule options. Operators can do the same by
adding overrides in their policy files that match the default but
stop the rule deprecation fallback from happening.

Partial implement blueprint policy-defaults-refresh

Change-Id: Ic81da0ebc23d6526c5ca2d9d98159e07f3e53822
2020-04-01 20:02:17 +00:00
Ghanshyam Mann c15ffc2ee2 Combine the limits policies in single place
limits and used_limits extensions were megred in
- I76e02214e958a55b6de8033243b46b259949e5ac

But policy were left in separate file. limits policy
is in policies/limits which is general policy to get the
limit of project. used_limit is in polocies/used_limit
which is enforced in view builder for gettting the limit
of other project.

This commit:
- move used_limit in policies/limit file
- move the used_limit policy enforcement from view buidler to limit API controller.
- adjust the tests due to above changes.

Partial implement blueprint policy-defaults-refresh

Change-Id: Iefe41cc95cd967b368588dea5ff195bb4af3eca7
2020-04-01 19:58:22 +00:00
Zuul 9c18a3b9dc Merge "Correct limits policy check_str" 2020-04-01 18:55:05 +00:00
Zuul 24b2464cf2 Merge "Pass the actual target in os-hypervisors policy" 2020-04-01 18:54:59 +00:00
Zuul 3de3ef0660 Merge "libvirt: Remove QEMU_VERSION_REQ_SHARED" 2020-04-01 18:54:53 +00:00
Zuul b9843e80da Merge "images: Remove Libvirt specific configurable use from qemu_img_info" 2020-04-01 18:53:43 +00:00
Zuul af9e4d7812 Merge "libvirt: Always provide the size in bytes when calling virDomainBlockResize" 2020-04-01 18:53:38 +00:00
Zuul 0af8ddd54d Merge "Introduce scope_types in remote consoles policy" 2020-04-01 17:12:15 +00:00
Zuul 67f278ab04 Merge "Add test coverage of existing remote console policies" 2020-04-01 17:12:07 +00:00
Zuul 493bf817dd Merge "Introduce scope_types in rescue server policy" 2020-04-01 17:11:58 +00:00
Zuul 047132976b Merge "Add test coverage of existing rescue policies" 2020-04-01 17:11:48 +00:00
Zuul 38ceecb9b3 Merge "Pass the actual target in unlock override policy" 2020-04-01 17:11:41 +00:00
Zuul 1f6719f5b4 Merge "Add new default roles in lock server policies" 2020-04-01 17:11:35 +00:00
Zuul 0fb9302428 Merge "Pass the actual target in migrate server policy" 2020-04-01 17:11:29 +00:00
Zuul b9ba20f9f6 Merge "Add new default roles in migrate server policies" 2020-04-01 17:10:21 +00:00
Zuul f399fd3c02 Merge "Introduce scope_types in migrate server" 2020-04-01 17:10:14 +00:00
Zuul a314504d9c Merge "Add new default roles in pause server policies" 2020-04-01 17:10:06 +00:00
Zuul 3683942da1 Merge "Introduce scope_types in pause server policy" 2020-04-01 17:09:58 +00:00
Zuul 5c24cdf9cb Merge "Add test coverage of existing lock server policies" 2020-04-01 17:09:50 +00:00
Zuul 69a232c099 Merge "Add test coverage of existing pause server policies" 2020-04-01 17:09:39 +00:00
Zuul 6e8af0a374 Merge "Fix unpause server policy to be admin_or_owner" 2020-04-01 17:09:32 +00:00
Zuul 32a857722f Merge "Fix unlock server policy to be admin_or_owner" 2020-04-01 16:54:54 +00:00
Zuul 5d00267d58 Merge "Add test coverage of existing migrations policies" 2020-04-01 16:28:11 +00:00
Zuul ab7fb8267c Merge "Add test coverage of existing migrate server policies" 2020-04-01 16:28:05 +00:00
Zuul 71ad055d1c Merge "Add new default roles in os-flavor-access policies" 2020-04-01 16:27:58 +00:00
Stephen Finucane bd9bea5690 libvirt: Remove QEMU_VERSION_REQ_SHARED
The updated minimum required libvirt (4.0.0) and QEMU (2.11)
for "Ussuri" satisfy the version requirements; this was done
in Change-Id: Ia18e9be4d (22c1916b49 — libvirt: Bump
MIN_{LIBVIRT,QEMU}_VERSION for "Ussuri", 2019-11-19).

Drop the version constant  QEMU_VERSION_REQ_SHARED and now-needless
compatibility code; adjust/remove tests.

Change-Id: If878a023c69f25a9ea45b7de2ff9eb1976aaeb8c
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-04-01 15:29:02 +01:00
Lee Yarwood dce9bc03c4 images: Remove Libvirt specific configurable use from qemu_img_info
This change addresses an old TODO in the images module by dropping the
use of a Libvirt specific configurable from the qemu_img_info function.
We can identify RBD based volumes by checking for 'rbd:' at the start of
the path provided to the function instead of using the configurable.

Change-Id: Ife9e67d5c71f4cca825dff713f54ec955508f6e6
2020-04-01 15:29:02 +01:00
Lee Yarwood b1b0f1be18 libvirt: Always provide the size in bytes when calling virDomainBlockResize
Since 0.9.11 virDomainBlockResize has accepted the size argument in
bytes when the VIR_DOMAIN_BLOCK_RESIZE_BYTES flag is provided.

This change switches all callers over to using bytes to simplify the
required call, avoiding the need to divide by units.Ki etc.

Change-Id: Ib8d9318596186acd86a738ceea187420698645e6
2020-04-01 15:28:32 +01:00
Zuul f8d11303bd Merge "Add cyborg tempest job." 2020-04-01 09:36:20 +00:00