Commit Graph

60866 Commits

Author SHA1 Message Date
Ghanshyam Mann c79a73bd42 Remove default override for RBAC config options
RBAC config options enforce_scope and enforce_new_defaults
were disabled by default in oslo.policy and Nova had to override
the default value to enable those by default. Now oslo.policy
(4.4.0 onwards[1]) changed the default values[2] and enabled
by default for all the services. OpenStack service does not need
to override the default anymore.

NOTE: There is no change in behaviour here, oslo.policy provides the
same configuration that Nova has overridden till now.

[1] https://review.opendev.org/c/openstack/releases/+/925032
[2] https://review.opendev.org/c/openstack/oslo.policy/+/924283

Depends-On: https://review.opendev.org/c/openstack/requirements/+/925464

Change-Id: Ic0b5a75f01024e322ecbcd49f8caae0a6ab5c048
2024-08-02 18:36:00 +00:00
Zuul bb2d7f9cad Merge "[tools] Backport validator: handle unmaintained" 2024-07-30 18:15:40 +00:00
Zuul 75e2175254 Merge "[tools] Ignore bot generated patches" 2024-07-30 18:15:34 +00:00
Zuul 7a7427691e Merge "Fix test_vmdk_bad_descriptor_mem_limit and test_vmdk_bad_descriptor_mem_limit_stream_optimized" 2024-07-26 12:06:25 +00:00
Zuul eb5e3374bc Merge "Remove AMI snapshot format special case" 2024-07-25 17:29:30 +00:00
Zuul 73012258e7 Merge "[CI] Replace deprecated regex" 2024-07-24 23:38:49 +00:00
Dan Smith d5a631ba77 Remove AMI snapshot format special case
Note that this includes seemingly-unrelated test changes because we
were actually skipping the snapshot_running test for libvirt, which
has been a bug for years. In that test case, when we went to look
for image_meta.disk_format, that attribute was not set on the o.vo
object, which raised a NotImplementedError. That error is also checked
by the test to skip the test for drivers that do not support snapshot,
which meant that for libvirt, we haven't been running that case
beyond the point at which we create snapshot metadata and trip that
exception. Thus, once removing that, there are other mocks not in
place that are required for the test to actually run. So, this adds
mocks for qemu_img_info() calls that actually try to read the file on
disk, as well as the privsep chown() that attempts to run after.

Change-Id: Ie731045629f0899840a4680d21793a16ade9b98e
2024-07-24 11:04:55 -07:00
Zuul df39222b10 Merge "Change force_format strategy to catch mismatches" 2024-07-23 23:39:57 +00:00
Zuul 1191a49a65 Merge "conf: Clarify '[api] response_validation help' text" 2024-07-23 21:23:10 +00:00
Dan Smith 8b4c522f66 Change force_format strategy to catch mismatches
When we moved the qemu-img command in fetch_to_raw() to force the
format to what we expect, we lost the ability to identify and react
to situations where qemu-img detected a file as a format that is not
supported by us (i.e. identfied and safety-checked by
format_inspector). In the case of some of the other VMDK variants
that we don't support, we need to be sure to catch any case where
qemu-img thinks it's something other than raw when we think it is,
which will be the case for those formats we don't support.

Note this also moves us from explicitly using the format_inspector
that we're told by glance is appropriate, to using our own detection.
We assert that we agree with glance and as above, qemu agrees with
us. This helps us avoid cases where the uploader lies about the
image format, causing us to not run the appropriate safety check.
AMI formats are a liability here since we have a very hard time
asserting what they are and what they will be detected as later in
the pipeline, so there is still special-casing for those.

Closes-Bug: #2071734
Change-Id: I4b792c5bc959a904854c21565682ed3a687baa1a
2024-07-23 20:37:42 +01:00
Zuul c1046979af Merge "conf: Add '[api] response_validation' option" 2024-07-23 15:16:27 +00:00
Julien Le Jeune a3202f7bf9 Fix test_vmdk_bad_descriptor_mem_limit and test_vmdk_bad_descriptor_mem_limit_stream_optimized
These tests depend on qemu-img being installed and in the path, if it is not installed, skip them.

Change-Id: I896f16c512f24bcdd898ab002af4e5e068f66b64
Closes-bug: #2073862
Signed-off-by: Julien Le Jeune <julien.le-jeune@ovhcloud.com>
2024-07-23 16:26:19 +02:00
Zuul 8c4a2e1b47 Merge "tests: Ensure all APIs have a request query schema" 2024-07-20 09:13:12 +00:00
Zuul 92442bfaf1 Merge "api: Add remaining missing query parameter schema" 2024-07-20 08:50:32 +00:00
Stephen Finucane 9a04ed79a3 conf: Clarify '[api] response_validation help' text
Make it extra clear this is only for API response bodies.

Change-Id: Id88c828aa7bcb1eff6dd149e8a92a19649ba4b0e
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-07-19 13:01:01 +01:00
Sylvain Bauza 757c333c0e cpu: Only check governor type on online cores
Kernels don't accept to access the governor strategy on an offline core, so
we need to only validate strategies for online cores.

Change-Id: I14c9b268d0b97221216bd1a9ab9e48b48d6dcc2c
Closes-Bug: #2073528
2024-07-19 12:22:55 +02:00
Zuul e82854dc8c Merge "hardware: Fix image_meta.id within get_mem_encryption_constraint" 2024-07-16 04:39:35 +00:00
Elod Illes e2697de8e4 [tools] Backport validator: handle unmaintained
When the script was created there were only stable/* branches, but now
there are unmaintained/* branches as well, where the validator fails
when looking for hashes only on stable/* branches even if the given
hash is already on unmtaintained/* branch. This patch matches now both
stable/* and unmaintained/* branches.

Change-Id: I08fcc63ab0fbe5af1be70d5fde5af98bf006101c
2024-07-12 23:10:26 +02:00
Elod Illes b8f3975d36 [tools] Ignore bot generated patches
This is a fix for the test whether a patch is bot generated or not, as
that did not worked as intended. The problem is that the script is
checking the email address of the parent patch (HEAD~), which probably
should be right in case the patch would be a MERGE patch. But this is
wrong in case the patch is not a MERGE patch. This fix uses the very
same pattern as it is using for the commit message parsing: the
$commit_hash variable, which is the parent's commit hash if the patch
is a MERGE patch, and an empty string in the other case (causing to
call 'git show' on HEAD).

Change-Id: I0abc72180edf34a6dd0624a40fb8682397805eca
2024-07-12 22:53:06 +02:00
Balazs Gibizer c6d8c6972d Stabilize iso format unit tests
Some version of mkisofs does not properly handle if both the input and
the output file of the command are the same. So this commit changes the
unit tests depending on that binary to use a different files.

Related-Bug: #2059809
Change-Id: I6924eb23ff5804c22a48ec6fabcec25f061906bb
2024-07-11 08:55:40 +02:00
Zuul a305571262 Merge "[ironic] Ensure we test iterators when needed" 2024-07-09 19:11:48 +00:00
Jay Faulkner ee3ec9b8f2 [ironic] Ensure we test iterators when needed
Bug #2071972 brought it to light that we may have had some unit tests
improperly operating against lists, when generators are used by the SDK.
As a result of auditing remaining unit tests, this one instance was
found of improper testing. Fixing this should avoid future bugs like
2071972.

Related-Bug: #2071972
Change-Id: Icf9882f5f8421b150c308eb2502623f2fcb6cff6
2024-07-09 10:48:28 -07:00
Sean Mooney cc2514d02e fix qemu-img version dependent tests
while backporting Ia34203f246f0bc574e11476287dfb33fda7954fe

We observed that several of the tests showed distro specific
behavior depending on if qemu was installed in the test env,
what version is installed and how it was compiled

This change ensures that if qemu is present that it
supprot the required formats otherwise it skips the test.

Change-Id: I131996cdd7aaf1f52d4caac33b153753ff6db869
2024-07-09 15:09:09 +01:00
Zuul 78ae23807c Merge "Fix port group network metadata generation" 2024-07-09 00:18:52 +00:00
Sean Mooney b1cc39848e Add iso file format inspector
This change includes unit tests for the ISO
format inspector using mkisofs to generate
the iso files.

A test for stashing qcow content in the system_area
of an iso file is also included.

This change modifies format_inspector.detect_file_format
to evaluate all inspectors until they are complete and
raise an InvalidDiskInfo exception if multiple formats
match.

Related-Bug: #2059809
Change-Id: I7e12718fb3e1f77eb8d1cfcb9fa64e8ddeb9e712
2024-07-08 13:03:27 +01:00
Sean Mooney b5a1d3b4b2 Reproduce iso regression with deep format inspection
This change adds a reproducer for the regression in iso
file support when
workarounds.disable_deep_image_inspection = False

Change-Id: I56d8b9980b4871941ba5de91e60a7df6a40106a8
2024-07-08 13:03:25 +01:00
Zuul e4fca6f517 Merge "Server Rescue leads to Server ERROR state if original image is deleted" 2024-07-08 01:07:18 +00:00
Zuul 240296298c Merge "scheduler: fix _get_sharing_providers to support unlimited aggr" 2024-07-07 00:02:39 +00:00
Zuul cff73f518b Merge "api: Don't do version check if nothing required" 2024-07-04 23:12:18 +00:00
Zuul e4aaddc607 Merge "api: Add 'removed' decorator" 2024-07-04 23:12:11 +00:00
Zuul 5fbe975f6c Merge "api: Correct bug in flavors schema" 2024-07-04 23:06:08 +00:00
Zuul 49c4638fd5 Merge "api: Migrate to JSON Schema Draft 2020-12" 2024-07-04 21:36:50 +00:00
Zuul 9b0d691f0d Merge "port format inspector tests from glance" 2024-07-04 20:51:49 +00:00
Mohammed Naser 8558f59630 Fix port group network metadata generation
When switching to using OpenStack SDK, there was a change missed
that didn't account for the SDK returning generators instead of
a list, so the loop on ports and port groups made it so that it
started returning an empty list afterwards.

Since there is no a masse of ports for a baremetal system usually,
we take the generator into a list right away to prevent this.

Closes-Bug: #2071972
Change-Id: I90766f8c225d834bb2eec606754107ea6a212f6d
2024-07-04 14:09:23 -04:00
Zuul c39a425ba7 Merge "Fix vmdk_allowed_types checking" 2024-07-04 15:32:22 +00:00
Sean Mooney 838daa3cad port format inspector tests from glance
This commit is a direct port of the format inspector
unit tests from glance as of commit
0d8e79b713bc31a78f0f4eac14ee594ca8520999

the only changes to the test are as follows

"from glance.common import format_inspector" was updated to
"from nova.image import format_inspector"

"from glance.tests import utils as test_utils"
was replaced with "from nova import test"

"test_utils.BaseTestCase" was replaced with "test.NoDBTestCase"

"glance-unittest-formatinspector-" was replaced with
"nova-unittest-formatinspector-"

This makes the test funtional in nova.

TestFormatInspectors requries qemu-img to be installed on the
host which would be a new depency for executing unit tests.
to avoid that we skip TestFormatInspectors if qemu-img
is not installed.
TestFormatInspectorInfra and TestFormatInspectorsTargeted
do not have a qemu-img dependency so
no changes to the test assertions were required.

Change-Id: Ia34203f246f0bc574e11476287dfb33fda7954fe
2024-07-04 12:51:59 +01:00
Zuul ad44cadfc2 Merge "Additional qemu safety checking on base images" 2024-07-04 03:06:22 +00:00
Zuul 6bf5f66833 Merge "Check images with format_inspector for safety" 2024-07-03 17:18:40 +00:00
Zuul 657e86585c Merge "Reject qcow files with data-file attributes" 2024-07-03 16:23:34 +00:00
Sahid Orentino Ferdjaoui f254729a56 scheduler: fix _get_sharing_providers to support unlimited aggr
A Request-Too-Long error can be raised in case of too many aggregates
are attached to a host. The fix is to split the requests.

The request is executed by host via a periodic task. Result is set in
cache so no performances impact is expected.

The change introduce a new compute configuration option
`compute.sharing_providers_max_uuids_per_request = 200`.

Closes-bug: #2068893

Change-Id: I1355c0813cb99067ead60f9835938566289beb20
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com>
2024-07-03 12:58:04 +00:00
Dan Smith 08be7b2a0d Fix vmdk_allowed_types checking
This restores the vmdk_allowed_types checking in create_image()
that was unintentionally lost by tightening the
qemu-type-matches-glance code in the fetch patch recently. Since we
are still detecting the format of base images without metadata, we
would have treated a vmdk file that claims to be raw as raw in fetch,
but then read it like a vmdk once it was used as a base image for
something else.

Change-Id: I07b332a7edb814f6a91661651d9d24bfd6651ae7
Related-Bug: #2059809
2024-07-02 13:08:40 -07:00
Dan Smith b1b88bf001 Additional qemu safety checking on base images
There is an additional way we can be fooled into using a qcow2 file
with a data-file, which is uploading it as raw to glance and then
booting an instance from it. Because when we go to create the
ephemeral disk from a cached base image, we've lost the information
about the original source's format, we probe the image's file type
without a strict format specified. If a qcow2 file is listed in
glance as a raw, we won't notice it until it is too late.

This brings over another piece of code (proposed against) glance's
format inspector which provides a safe format detection routine. This
patch uses that to detect the format of and run a safety check on the
base image each time we go to use it to create an ephemeral disk
image from it.

This also detects QED files and always marks them as unsafe as we do
not support that format at all. Since we could be fooled into
downloading one and passing it to qemu-img if we don't recognize it,
we need to detect and reject it as unsafe.

Change-Id: I4881c8cbceb30c1ff2d2b859c554e0d02043f1f5
2024-07-02 13:08:40 -07:00
Dan Smith 9cdce71594 Check images with format_inspector for safety
It has been asserted that we should not be calling qemu-img info
on untrusted files. That means we need to know if they have a
backing_file, data_file or other unsafe configuration *before* we use
qemu-img to probe or convert them.

This grafts glance's format_inspector module into nova/images so we
can use it to check the file early for safety. The expectation is that
this will be moved to oslo.utils (or something) later and thus we will
just delete the file from nova and change our import when that happens.

NOTE: This includes whitespace changes from the glance version of
format_inspector.py because of autopep8 demands.

Change-Id: Iaefbe41b4c4bf0cf95d8f621653fdf65062aaa59
Closes-Bug: #2059809
2024-07-02 13:08:08 -07:00
Dan Smith ec9c55cbbc Reject qcow files with data-file attributes
Change-Id: Ic3fa16f55acc38cf6c1a4ac1dce4487225e66d04
Closes-Bug: #2059809
2024-07-02 13:08:08 -07:00
Dan Smith c0ff2386ed Fix disk_formats in ceph job tempest config
Tempest currently defaults to disk_formats[0] for images it creates,
which is 'ami'. However, it's actually using a qcow2 disk image by
default, which means we're lying to glance when we create those.

Change-Id: I737e9aa51c268a387f1eed24cf717618d057d747
2024-07-02 12:52:36 -07:00
Zuul 04ddddf018 Merge "tests: Ensure API schemas are valid" 2024-07-02 13:44:05 +00:00
Zuul b84d939f59 Merge "api: Fix bugs in schemas" 2024-07-02 02:24:40 +00:00
Zuul bb15d7aab8 Merge "tests: Ensure all APIs have a request body schema" 2024-07-01 14:19:58 +00:00
Stephen Finucane 64ac67fd19 api: Correct bug in flavors schema
The 'rxtx_factor' is a float, not an integer, and should allow values <
1 so long as they are > 0. Correct this.

Change-Id: I3567f13d7a1bb6f42755e3f5739fa9ecd827aa49
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-07-01 11:18:06 +01:00
Zuul 4c50398f3a Merge "pre-commit: Bump autopep8 version and update repo" 2024-06-29 02:31:27 +00:00