Commit Graph

57660 Commits

Author SHA1 Message Date
Zuul d09fade87e Merge "libvirt: Add libvirt version mocks in test_private_destroy_* tests" 2020-08-24 11:39:39 +00:00
Zuul a27e0004d6 Merge "libvirt: Fix indentation in test__video_model_supported" 2020-08-24 11:36:51 +00:00
Zuul 0d062ac7b6 Merge "Pass the actual target in FIP policy" 2020-08-23 20:47:16 +00:00
Zuul 3dcdcc8e5f Merge "Add new default roles in FIP policies" 2020-08-21 21:46:05 +00:00
Zuul 835440e3f9 Merge "functional: Drop '_api' suffix from placement fixture" 2020-08-21 10:06:42 +00:00
Zuul 3d43c542a6 Merge "functional: Move single-use function to its caller" 2020-08-21 10:06:36 +00:00
Zuul d793835601 Merge "libvirt: Do not reference VIR_ERR_DEVICE_MISSING when libvirt is < v4.1.0" 2020-08-21 02:45:37 +00:00
Zuul c4881247eb Merge "Pass the actual target in networks policy" 2020-08-21 02:45:30 +00:00
Zuul 3db73e5d0e Merge "Add new default roles in networks policies" 2020-08-21 02:45:22 +00:00
Zuul b7ba169a3b Merge "Add scope and new default roles in extensions policies" 2020-08-21 02:45:11 +00:00
Zuul 36280e723d Merge "Pass the actual target in baremetal nodes policy" 2020-08-21 02:45:01 +00:00
Zuul b8ca3ce31c Merge "zuul: use the new barbican simple-crypto job" 2020-08-20 12:48:46 +00:00
Zuul 2aa0924230 Merge "tests: Add reproducer for bug #1879878" 2020-08-20 09:38:38 +00:00
Zuul 02ecdfeaa9 Merge "Add new default roles in baremetal nodes policies" 2020-08-20 09:38:31 +00:00
Zuul a503e42a17 Merge "Add checks for volume status when rebuilding" 2020-08-20 08:21:16 +00:00
Zuul 965df3e2c9 Merge "libvirt: Remove MIN_LIBVIRT_ETHERNET_SCRIPT_PATH_NONE" 2020-08-20 04:59:08 +00:00
Zuul 4f6f4d95e2 Merge "Remove warning filters for legacy Python version" 2020-08-20 04:58:59 +00:00
Zuul 31c96a539b Merge "trivial: Remove unused attributes" 2020-08-20 04:58:48 +00:00
Zuul 435c92a082 Merge "libvirt: Mock LoopingCallBase._sleep in rbd tests" 2020-08-19 20:16:57 +00:00
Stephen Finucane 10f0a42de1 tests: Add reproducer for bug #1879878
When one resizes a pinned instance, the instance claims host CPUs for
pinning purposes on the destination. However, the host CPUs on the
source are not immediately relinquished. Rather, they are held by the
migration record, to handle the event that the resize is reverted. It is
only when one confirms this resize that the old cores are finally
relinquished.

It appears there is a potential race between the resource tracker's
periodic task and the freeing of these resources, resulting in attempts
to unpin host cores that have already been unpinned. This test
highlights that bug pending a fix.

Change-Id: Ie092628ac71eb87c9dfa7220255a2953ada9e04d
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Related-Bug: #1879878
2020-08-19 20:26:42 +01:00
Stephen Finucane 5018d5d517 functional: Drop '_api' suffix from placement fixture
It's unnecessary, particularly when nothing of the other service
fixtures use it.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>

Change-Id: If849f80c0372872b2de57b20e8b63c069a54ccff
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-08-19 18:07:25 +01:00
Stephen Finucane 1cb9a3a0b8 functional: Move single-use function to its caller
The '_check_api_endpoint' function only had a single caller and was far
more complicated that necessary. Move it to that caller and simplify.

Change-Id: I535886dbac4e41677285a14c010ec45a54e77c79
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-08-19 18:07:25 +01:00
Lee Yarwood f0b76cc0f1 libvirt: Add libvirt version mocks in test_private_destroy_* tests
These tests would would rely on the version of libvirt reported by
FakeLibvirt being older than MIN_LIBVIRT_BETTER_SIGKILL_HANDLING instead
of ensuring that was the case to exercise certain destroy behaviours.

Change-Id: I3571efde0061d9337d6c544d093976ccdd2762e8
2020-08-19 17:24:19 +01:00
Lee Yarwood 30c30f5a59 libvirt: Fix indentation in test__video_model_supported
This would previously result in
nova.virt.libvirt.host.Host.has_min_version not being correctly mocked
and would instead rely on the versions of libvirt and QEMU being
reported by FakeLibvirt being lower than
MIN_LIBVIRT_VIDEO_MODEL_VERSIONS['none'] aka libvirt v4.6.0.

Change-Id: I4624ff7dd1e71c8a9656e4ce2118fd04941a4086
2020-08-19 17:24:19 +01:00
sunhao 10e9a9b9fc Add checks for volume status when rebuilding
When rebuilding, we should only allow detaching
the volume with 'in-use' status, volume in status
such as 'retyping' should not allowed.

Change-Id: I7f93cfd18f948134c9cb429dea55740d2cf97994
Closes-Bug: #1489304
2020-08-19 21:20:13 +08:00
Lee Yarwood bc96af5659 libvirt: Do not reference VIR_ERR_DEVICE_MISSING when libvirt is < v4.1.0
I7eb86edc130d186a66c04b229d46347ec5c0b625 introduced
VIR_ERR_DEVICE_MISSING into the hot unplug libvirt error code list
within detach_device_with_retry. While the change correctly referenced
that the error code was introduced in v4.1.0 it made no attempt to
handle versions prior to this. With MIN_LIBVIRT_VERSION currently pinned
to v4.0.0 we need to handle libvirt < v4.1.0 to avoid referencing the
non-existent error code within the libvirt module.

Closes-Bug: #1891547
Change-Id: I32908b77c18f8ec08211dd67be49bbf903611c34
2020-08-18 20:10:38 +01:00
Zuul cff7382fb3 Merge "Remove six.reraise" 2020-08-18 17:58:22 +00:00
Zuul d140d80def Merge "Remove six.add_metaclass" 2020-08-18 17:58:12 +00:00
Zuul cb509daae1 Merge "Remove six.PY2 and six.PY3" 2020-08-18 17:58:04 +00:00
Zuul 87269dcaee Merge "Removes the delta file once image is extracted" 2020-08-18 01:01:50 +00:00
Luigi Toscano f881854ea6 zuul: use the new barbican simple-crypto job
The old job name is still available as an alias for a while,
but it is time to switch away from it.

Change-Id: I93c35b386e1b1cbcff74fe0a2388f0eda5dea3b9
2020-08-17 20:09:47 +02:00
Zuul 2cc0511376 Merge "Rebase qcow2 images when unshelving an instance" 2020-08-17 15:29:53 +00:00
Zuul f269bb98d8 Merge "Remove monotonic usage" 2020-08-17 15:29:46 +00:00
Ghanshyam Mann 583672c03c Pass the actual target in FIP policy
Currently if target is not passed in context.can(),
it use defauls target which is context.user_id, context.project_id.
These defaults target are not useful as it pass the
context's user_id and project_id only which means we tell
oslo policy to verify the context data with context data.

This commit pass the actual target for networks policies
which is context.project_id itself as nova cannot verify the owner of
FIP. Neutron will return the authorise error is requester is not
owner of FIP.

Partial implement blueprint policy-defaults-refresh-deprecated-apis

Change-Id: I13d37d36bdc294960306271204c83bbdebaeb7b7
2020-08-17 14:58:03 +00:00
Ghanshyam Mann 08f58909bd Add new default roles in FIP policies
This adds new defaults roles in FIP API policies.
These policies are made granular and default to
PROJECT_READER_OR_SYSTEM_READER and PROJECT_MEMBER_OR_SYSTEM_ADMIN.

Partial implement blueprint policy-defaults-refresh-deprecated-apis

Change-Id: I6dcc8db9178aef59017968a3172ab463cd74754d
2020-08-17 09:56:55 -05:00
Ghanshyam Mann fb3bf32fa2 Pass the actual target in networks policy
Currently if target is not passed in context.can(),
it use defauls target which is context.user_id, context.project_id.
These defaults target are not useful as it pass the
context's user_id and project_id only which means we tell
oslo policy to verify the context data with context data.

This commit pass the actual target for networks policies
which is context.project_id itself as nova cannot verify the owner of
network. Neutron will return the authorise error is requester is not
owner of network.

Partial implement blueprint policy-defaults-refresh-deprecated-apis

Change-Id: I76bbb570996612c1366b6b6c52772f04a9953080
2020-08-17 14:52:21 +00:00
Ghanshyam Mann 558c6e752a Add new default roles in networks policies
This adds new defaults roles in networks API policies.
These policies are made granular and default to
PROJECT_READER_OR_SYSTEM_READER.

Partial implement blueprint policy-defaults-refresh-deprecated-apis

Change-Id: Idcccdf6b3a1638cf140b5c4f887abbed85c5d7dc
2020-08-17 09:51:16 -05:00
Ghanshyam Mann 284ac43f7a Add scope and new default roles in extensions policies
This adds scope_type and new defaults roles in extensions
API policies. These policies are for extensions API which are
kept only for backward compatibility of v2.0 but nova does not
have extensions concept now and return only hard-coded info. So
these policies are not made granular.

Partial implement blueprint policy-defaults-refresh-deprecated-apis

Change-Id: I062e556feb5cc85d179fed9b675e4ab33ca3365a
2020-08-17 09:40:02 -05:00
Ghanshyam Mann fcc451cd4c Pass the actual target in baremetal nodes policy
Currently if target is not passed in context.can(),
it use defauls target which is context.user_id, context.project_id.
These defaults target are not useful as it pass the
context's user_id and project_id only which means we tell
oslo policy to verify the context data with context data.

This commit pass the actual target for baremetal nodes policies
which is empty dict because policy rule is system scoped rather
than project, so the token scope check deals with the required
target checking.

Partial implement blueprint policy-defaults-refresh-deprecated-apis

Change-Id: I176b273d66c870303a86f4df11cc5fc37c36d943
2020-08-17 14:36:51 +00:00
Ghanshyam Mann de2226b4b3 Add new default roles in baremetal nodes policies
This adds new defaults roles in baremetal nodes API policies.
These policies are default to SYSTEM_READER and made more
granular to adopt the new defaults.

Partial implement blueprint policy-defaults-refresh-deprecated-apis

Change-Id: Ieaad388d31fdabf0854bf7e2ed9fddf11f86bf8c
2020-08-17 14:36:38 +00:00
Lee Yarwood 4ba23996d0 libvirt: Mock LoopingCallBase._sleep in rbd tests
The tests previously mocked eventlet.greenthread.sleep directly but
I62e9f1a7cde8846be368fbec58b8e0825ce02079 removed this call from
LoopingCallBase._sleep in oslo.service 1.32.1. Just mock the _sleep
method directly to avoid us ever spinning in tests on this again.

Closes-Bug: #1891898
Change-Id: I0872ee16e9fc49c988fe588f029ab71f429790f5
2020-08-17 15:20:11 +01:00
Zuul 4963069220 Merge "Remove dead volume driver code" 2020-08-17 12:07:07 +00:00
Takashi Natsume 2c074b9486 Remove six.reraise
Replace six.reraise with Python 3 style code.
Subsequent patches will replace other six usages.

Change-Id: Ib129cb399d1521ad6d18fcf0b8ac9fd793888c81
Implements: blueprint six-removal
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2020-08-15 07:45:49 +00:00
Takashi Natsume 5191b4f2f0 Remove six.add_metaclass
Replace six.add_metaclass with Python 3 style code.

Change-Id: Ifc3f2bcb8fcdd2b555864bd4e22a973a7858c272
Implements: blueprint six-removal
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2020-08-15 07:45:39 +00:00
Takashi Natsume 28ed0c5c9a Remove six.PY2 and six.PY3
Remove six.PY2 and six.PY3.
Subsequent patches will replace other six usages.

Change-Id: Iccce0ab50eee515e533ab36c8e7adc10cb3f7019
Implements: blueprint six-removal
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2020-08-15 07:45:23 +00:00
Zuul 1c2cccab71 Merge "Add lsscsi to bindep" 2020-08-14 08:23:55 +00:00
Ghanshyam Mann 09b2dce4c3 Introduce scope_types in FIP policy
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 FIP policies
as 'system' and 'project'

Partial implement blueprint policy-defaults-refresh-deprecated-apis

Change-Id: I1dc11c4857466a6edb7baa9ccee3dde97a54afa0
2020-08-14 02:22:08 +00:00
Ghanshyam Mann 8d7b7f55d8 Add test coverage of FIP 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.

To adopt the keystone's scope_type and new defaults in deprecated
API policies, we need to first write test coverage for the same to
know the complete effect of policies changes.

Partial implement blueprint policy-defaults-refresh-deprecated-apis

Change-Id: Ib89d65f93363f36de15a5a722fe8991c16ad6235
2020-08-14 02:21:53 +00:00
Zuul e077c6d8f7 Merge "Handle Neutron errors in _post_live_migration()" 2020-08-13 22:22:04 +00:00
Zuul 2e2e8a0420 Merge "Correct the check_str and pass actual target in FIP pools policy" 2020-08-13 22:21:56 +00:00