An implementation to trigger crash dump depends on hypervisors. Inject_nmi is
just a libvirt implementation. The driver API name should be
"trigger_crash_dump" for the abstraction.
This patch only changes names of the driver API and an Exception. It has no
functional changes.
Change-Id: Icef57d346fac7f92132bc14e22d5b2652397a64a
Closes-Bug: 1547362
Nova API checks that the value of the group scheduler hint
shall be a valid server-group uuid, however it was done by custom
code not jsonschema. Moreover the exception was not handled by the API
so both v2.0 and v.2.1 returned HTTP 500 if the group hint wasn't a valid
uuid of an existing server group.
The custom code to check for the validity of the group uuid is kept in
nova.compute.api as it is still needed in v2.0.
In v2.0 InstanceGroupNotFound exception are now translated to HTTPBadRequest.
In v2.1 the scheduler_hint jsonschema is now extended to check the format
of the group hint and the api is now translates the InstanceGroupNotFound
to HTTPBadRequest.
Closes-bug: #1535759
Change-Id: I38d98c74f6cceed5b4becf9ed67f7189cba479fa
Paths like server delete pass the instance down to the compute node,
which expects numa_topology to be joined. This currently causes a
lazy-load on every such operation. In a recent tempest run, numa_topology
was lazy-loaded 134 times (not all of which are in server delete,
necessarily).
This patch adds it to the list of attributes we pre-query when
starting an operation like delete, update, etc.
Change-Id: Ia4317fb1690535f467e1b295fbab64c9ec2f6f76
Partial-Bug: #1540526
Nova API properly checks that in case of booting from a image to
volume bdm the client shall specify the size of the created volume.
However the API does not handle the exception properly and returns
HTTP 500. This patch handles the InvalidBDM exception and returns
HTTP 400.
Change-Id: I80d0aa64885f25081dad91b1f45da5b318d8ae25
Closes-bug: #1538197
This patch aimed to fix AutoDiskConfigDisabledByImage exception is
excpeced for 2 times, besides, rearrange HTTPBadRequest to group them
around each other for easy reading.
P.S. Don't touch any logic so no UT need to be added/changed.
Closes-Bug: #1538411
Change-Id: I2088322681edd4a3190047560ea99d31c5f3a551
This patches adds changes to the Nova REST API to allow
users to create a server with a description, rebuild
a server with a description, update the description,
and get the description in the server details.
Note: Future commits will be done to support the server
description in python-novaclient and openstack-client.
APIImpact
Implements blueprint: user-settable-server-description
Change-Id: I74b1a340c5ab98fdea2186e87dd13f42ce7c7661
Change I9b649aafba011d537e3fe4eebef7a678ff6733e4 has added a
compute API to trigger crash dump in instance. This patch adds
the REST API to nova. It enables users to trigger crash dump in
an instance through REST API.
Change-Id: I6ed777ff637254b4b79417008f9055dd19fc7405
Implements: blueprint instance-crash-dump
Co-Authored-By: Hironori Shiina <shiina.hironori@jp.fujitsu.com>
Co-Authored-By: Tang Chen <tangchen@cn.fujitsu.com>
This moves the parsing of availability_zone, and as a consequence
force_host/force_node, into the API to prepare for building filter_properties
earlier. This will be necessary in order to build and persist the request_spec
object before the instance has been saved to the db.
Change-Id: I55399a77fc8d474380f7c422dcef1e6d145a48c8
These are vestigial remnants of the XML api controllers which no
longer exist. They are unused anywhere in the code. We should remove
them to avoid confusion.
Change-Id: Ib095558dfd6a63beb442efbb8f00a87d8f446e02
see log "Removing options '' from query" in the log
which is useless ,only log the options we filtered
when it's not empty.
Change-Id: I21a2e5eaf3532ecdb029fdb21b05879fd8f64b82
The API v2.1 extension loader was issuing a WARN for every single
extension that was listed in a white or blacklist. This is not a
warning for the administrator, this is a thing they chose to do. We
already have an INFO message that says all the extensions that got loaded.
The only WARN we should consider is when they put items in both the
white and black lists, and we decided to ignore the whitelist. That
warning message is added, as that's one of those things that could
drive people nuts trying to figure out why something didn't load when
added to the whitelist.
The function is denormalized and renamed to be more explicit about
what's going on.
Change-Id: I3ee8f04867509072c7cd6c0f1c1a87f893706595
Python 2.7 filter method result was a list, while for
Python 3.4 the result is a "filter object". Trying to
use it as a list will result in a TypeError.
Enables some unit tests for gate-nova-python34.
Partially implements blueprint: nova-python3-mitaka
Change-Id: I681b084bc96fc293488ddbc03218b9c449555578
FixedIpNotFoundForAddress is not catched during server creation,
so 500 error is reported to client side.
Change-Id: I3cd45cd63c962225d6a893ad0fdeb01ecb94e784
Closes-Bug: 1522349
Right now to check if some part of code supports
requested microversion developer usually:
1. get a microversion from request.
2. create instance of class APIVersionRequest
with requested microversion.
3. compare these two objects.
This check takes at least 2 lines and looks ugly.
Sometimes developers create unnecessary class fields
to store object APIVersionRequest with requested microversion.
To make nova code more readable and simple method
'is_supported' was created.
Microversion check with this method takes only one line
and code looks more beautiful.
Change-Id: I9078cfa1afad8b6b09583dac87fa757a0cc32daa
InvalidBDMEphemeralSize ,InvalidBDMFormat and
InvalidBDMSwapSize exception might be raised during
boot process while we didn't catch this exception at API
layer so 500 will be returned. This patch makes it return
HTTPBadRequest.
Note this didn't require microversion bump per microversion
dev mentioned and legacy v2 code already have Invalid exception
catched and handled.
Change-Id: I98bd8edab3a2801c876d53c0336ea2f8da5396aa
Related-Bug: 1483645
Closes-Bug: 1504264
On v2.1 API, the input validation is implemented with json-schema
and _check_string_length() becomes unused now.
This patch removes the method for cleanup.
Change-Id: I89d5e2ac7f4cd6e79dba13803ca796d9b8bc7165
In the V2 API, there are three cases for the name field:
1. disallow any space in the name: server_groups.
2. allow leading/trailing whitespaces, strip spaces and disallow
all characters are spaces: flavor_manage, servers.
3. allow leading/trailing whitespacess, no strip spaces and allow
all characters are spaces: aggregates, cells, create_backup,
security_groups, create_image, rebuild
But currently in the V2.1 API and V2.1 API compat mode disallows
leading/trailing in the name field.
For the V2.1 compat mode, we should relax the validation to avoid
breaking the user, although leading/trailing is unclear usecase. This
patch allows leading/trailing spaces but will strip them, and still
disallows that all characters are spaces in the name fields for
flavor_mange, servers, aggregates(and availability_zones),
create_backup, create_image, rebuild.
Due to the server_groups and security_groups(no jsons-schema in v2.1)
have consistent behavior between v2 and v2.1. So this patch won't
change server_groups.
But when creating servers, the name of security_groups, availability_zone
and keyapir isn't stripped the leading/trailing spaces. This is for
backward compatible with users who already use legacy V2 API created
security_group, availabilit_zone and keypair with leading/trailing
in the name, otherwise the users can't use those resource anymore.
For supporting servers schema extension point returns legacy v2 schema,
this patch adds version parameter to the schema extension point. Then
extension point can return different schema based on the version
parameter.
Change-Id: I9442891272284d395ea0dd8cfa302d3f74bf13ec
Partial-Bug: #1498075
To get rid of v3, this patch rename all the ViewBuilderV3 to
ViewBuilderV21.
Change-Id: I84a5cb303b4da4ede6d792f80acd9313756b9f9b
Partial-Bug: #1462901
There are some methods in Nova compute api and cell api would call the
decorator `check_instance_cell`, and that decorator may raise
InstanceUnknownCell, there isn't any exception handler in REST api layer.
This patch adds handlers for those methods.
Closes-bug: #1484776
Change-Id: I753a81f093ec5fdf000841949e52fca6f2662aa8
This is part of the V3 cleanup effort. The 'ApiSampleTestBaseV3' class
has been renamed to 'ApiSampleTestBaseV21', and all references to it
updated. Also, all references to the 'nova.api.v3' extension namespace
have been renamed to 'nova.api.v21'. Finally, some code that used short
variable names like 'v1', 'v2', etc., has been updated to rename these
'vers1', 'vers2', to avoid confusion with the v3 issue.
Change-Id: I23eab21c7158ba319e060bd075ef25afc5365381
While retrieving servers, the sort and pagination query string
parameters are treated as search options.
These parameters are passed down to the DB layer and eventually
filtered out when an AttributeError is caught because they do not
exist on the Instance model.
This change set removes these parameters at the API layer.
Closes-Bug: #1446638
Change-Id: I32c92649a2d0346e13c2013bfaa423aaec3b1b67
We want to remove the extension infrastructure in the v2.1 API during
the next release. To make that possible, we must deprecate the
configuration now.
Also deprecating the osapi_v3 group, and moving to osapi_v21.
UpgradeImpact
DocImpact
Part of blueprint nova-api-deprecate-extensions
Change-Id: I084444b11dceda7cf8f88c157aa67d36490fce49
There is a race between getting the instances from the database and
when the view builder shows the details. If an instance is deleted
before lazy-loading some info, like the flavor, then the view
builder fails with an InstanceNotFound and the request returns a 500
in the v2.1 case and a 404 in the v2 case.
We can have the view builder tell the API code what attributes it
expects when it gets the instance from the database so that we don't
have to do any lazy loading in the view builder.
Change-Id: Ie03ab415baaa9e88c423a1c60a40d53b4cc464c4
Closes-Bug: #1487570
I've always hated the logic involved in the servers extension to check
the all_tenants flag in search_opts and how it doesn't just store a
local boolean variable and re-use it.
This pulls that code out into a common utility method so both the v2 and
v2.1 extensions can use it (rather than duplicate the same mess), and it
cleans up the logic for setting the flag so it makes a bit more sense.
It also decouples the logic that figures out if we're getting all
tenants from the code that removes the entry from the search_opts dict,
so that's left up to the caller.
Change-Id: If5a570223267bf8a737a33398ddbf12d712a7b96
If someone tries to execute a command on a locked instance, we want them to
get the more explicit "Instance <uuid> is locked" message instead of the
more generic "Instance <uuid> is in an invalid state for <action>" message.
exception.InstanceIsLocked is a subclass of exception.InstanceInvalidState,
so we need to check for the more specific case first.
Change-Id: I33553e1a534a9aa1394a3927d745196476067c9d
Initialize new image metadata inside the creation method instead of
outside it. This reduce code duplication.
Also this fixes snapshot creation in EC2, since it had bugs in image
metadata initialization.
Closes-Bug: #1439820
Change-Id: If3efa2a274517a9ad51d5dfff0134ae9e8e702a4
This is step 4 of the remove v3 process. It moves the v2.1
json-schemas out of v3 directory, and also corrects all the
references.
Change-Id: Ibf88c38df951ed755b7431846cca7496f861c1dd
Partial-Bug: #1462901
The first step in the code cleanup for removing the API V3 references
is to move the existing default V2 code into a directory named
'legacy_v2'. This moves the files, and updates all references to
them. This is the first in a patch series of discreet changes to the
codebase structure.
Partial-Bug: #1462901
Change-Id: Ic19f2d019c2c78f1de14a0eced85e84f2d2cec28
Currently, running 'nova list --all-tenants' with a policy change:
"compute:get_all_tenants": "role:special_role or is_admin:True"
will not work as expected, The returned list of servers will not
contain all instances of all tenants. We should support administrators
who wish to enable this functionality in their policy.json.
We need to fix this problem both in the v2 API and in the v2.1 as well.
Deep in instance_get_all_by_filters_sort, there is a check which adds
a filter of project_id or user_id if the context is NOT an admin context.
So, the returned list will be a subset of all the instances in the
database. To fix this scenario, the easy way is to call get_all with
an elevated context to pass this check in instance_get_all_by_filters_sort.
So in fixing the bug above, we need to fix the default policy so that
all-tenants is available by default only to administrators.
UpgradeImpact
SecurityImpact
DocImpact: --all-tenants will list all servers for non-admin
APIImpact: --all-tenants will list all servers for non-admin
Closes-Bug: #1464381
Change-Id: I6fe512ff00a0fde1c75d49efe8bfa5f3d2d34df6
When the fixed_ip is invalid, the message reference uninitialized
object which is None. Use the raw value from network object instead.
Closes-Bug: #1466387
Change-Id: I9da1e10ccde90a64e4671965d79ba611584f1e88