Commit Graph

7245 Commits

Author SHA1 Message Date
Jenkins d8891f8d45 Merge "remove os-disk-config part 4" 2016-06-23 15:31:55 +00:00
Jenkins 08780af9ea Merge "update servers policy in code to use formats" 2016-06-23 13:56:51 +00:00
Jenkins 1c1e4df9ff Merge "remove os-disk-config part 3" 2016-06-23 13:41:33 +00:00
Jenkins fe11ed9afa Merge "remove support for legacy v2 generator extensions" 2016-06-22 14:44:27 +00:00
Sean Dague 525285eb1c remove os-disk-config part 4
There are no test changes as all new code is tested by the
extension_info functional tests, and should we want to eliminate the
extension_info portion of our API later, new tests would just make
this much harder to tear down.

This modifies default policy to drop os-disk-config as well as
modifying extension tests to pass even though we're injecting
additional hardcoded items into the list for compatibility.

Part of bp:api-no-more-extensions

Change-Id: I0192ccef7e858fd0ff15c339f683abaabbdc09b7
2016-06-22 07:36:33 -04:00
Sean Dague fbc3c5ab3c remove os-disk-config part 3
This removes the modification of the images resource. There are no
additional tests or test changes, as existing functional tests cover
these cases and guaruntee correct output.

Part of bp:api-no-more-extensions

Change-Id: I1d5bee3152a3725c5c7303462c5c383900a1e3c7
2016-06-22 07:13:59 -04:00
Sean Dague 4acfd825f5 remove load_standard_extensions method
The last caller of this was removed in
Ieb8374bff81b26c680cae6e6ca92ab736209570d but this was left behind.

Partially implements blueprint remove-legacy-v2-api-code

Change-Id: Ibcf826e081d061cc6a9b963981edd16d31e0cc37
2016-06-22 07:13:59 -04:00
Sean Dague f50d48a2f6 remove support for legacy v2 generator extensions
This removes the support for legacy v2 extensions which were allowed
to be generators to have a pre / post processing phase. The modern
compute api stack never supported this construct.

Because of the remove of the 'pre' phase, the 'post_process' phase is
just renamed to 'process'.

All pre_process and generator tests are removed.

Change-Id: Ia34c1f814fb938915d74c6845dfa5135cba29d0a
2016-06-21 14:55:57 -04:00
Matt Riedemann 6e8c84d0cd objects: you want'em
You wanted the best, you got it! The hottest thing in the
land: objects!

Change-Id: I951611f1f40bec45fb9ab71a4c0158b8a52562ea
2016-06-20 21:36:05 -04:00
Jenkins ecd3a8b8ce Merge "Remove extra expected error code (413) from image metadata" 2016-06-20 18:18:54 +00:00
Jenkins d498645806 Merge "Trivial-Fix: Fix typos" 2016-06-20 18:18:05 +00:00
Jenkins 5b92ae8d92 Merge "Policy-in-code servers rules" 2016-06-20 16:15:23 +00:00
Jenkins f16bdde619 Merge "Use is_valid_ipv4 from oslo.utils" 2016-06-20 15:35:01 +00:00
Jenkins 974b158f4f Merge "Tear down of os-disk-config part 2" 2016-06-20 13:33:14 +00:00
ChangBo Guo(gcb) a83ab0a7bf Use is_valid_ipv4 from oslo.utils
In module netaddr valid_ipv4 raise exception AddrFormatError
if address is specified as empty string. Method is_valid_ipv4
catches the exception and returns boolean value. So we'd better
use it from oslo.utils.

Change-Id: I452d437692e44f4e20ff1b064032d247c0ab7530
2016-06-17 16:02:38 +08:00
Jenkins 0f4e2a3e43 Merge "neutron: validate auto-allocate is available" 2016-06-16 14:57:30 +00:00
Jenkins bd4813b8c2 Merge "Pre-load tags when showing server details" 2016-06-16 14:53:34 +00:00
Jenkins 997b469270 Merge "Remove 413 expect in servers.py" 2016-06-16 14:50:21 +00:00
Jenkins b9e2a4ec17 Merge "Remove core extension list" 2016-06-16 14:48:30 +00:00
Jenkins 0814461823 Merge "Tear down os-disk-config part 1" 2016-06-16 13:52:41 +00:00
Jenkins 93092c5a20 Merge "Correct some misspell words in nova" 2016-06-16 11:29:43 +00:00
Jenkins d80daa1d09 Merge "Handle SetAdminPasswdNotSupported raised by libvirt driver" 2016-06-16 10:14:14 +00:00
Matt Riedemann ffe2487cf6 Pre-load tags when showing server details
When microversion>=2.26 is requested to show server details
we should pre-load 'tags' when getting the instance from the
database. Listing server details already does this, but show
didn't.

Failing to do this can also result in a 500 response from the
server. The scenario is you delete a server and then poll for
it to be gone using 'nova show'. In between the time that the
server is retrieved from the database and the view builder
creates the response, the instance is deleted and since
instance.tags is not set it will attempt to lazy-load the tags
which will fail with an InstanceNotFound.

We need to also fix the lazy-load issue in the instance object
but that will come in a follow-on change.

Change-Id: Iae6551028179e31699c06d06284ca4c1660be240
Closes-Bug: #1592963
2016-06-15 17:26:31 -04:00
Andrew Laski 19f9a4bbd4 Policy-in-code servers rules
This adds the basic framework for registering and using default policy
rules. Rules should be defined and returned from a module in
nova/policies/, and then added to the list in nova/policies/__init__.py.

A new context.can() method has been added for policy enforcement of
registered rules. It has the same parameters as the enforce() method
currently being used.

To establish the full pattern for usage the policy checks in the servers
API module have been registered and converted to the new usage.

Now that some policy checks are registered they're being used properly
by tests. Some tests have been updated so that the instance project_id
matches the context project_id in order to pass the 'admin_or_owner'
check.

Change-Id: I71b3d1233255125cb280a000b990329f5b03fdfd
Partially-Implements: bp policy-in-code
2016-06-15 16:55:45 -04:00
Jenkins a7de498628 Merge "Disallow instance tag set for invalid instance states" 2016-06-15 08:50:24 +00:00
Matt Riedemann 4317166b72 Handle keypair not found from metadata server
With commit e83842b80b we
attempt to load keypairs for an instance from instance_extra,
but if that hasn't been migrated yet we fall back to loading
the keypair from the database by name.

If the keypair was deleted, the instance object will just set
an empty KeyPairList for instance.keypairs and we'll get an
IndexError when using self.instance.keypairs[0] in
_metadata_as_json.

This adds a check that instance.keypairs actually has
something in it. If not, we log a message and don't return
any key values in the metadata dict - same as if instance.key_name
wasn't set to begin with.

Change-Id: If823867d1df4bafa46978e62e05826d1f12c9269
Closes-Bug: #1592167
2016-06-14 16:05:35 -04:00
Matt Riedemann 9e176a6673 neutron: validate auto-allocate is available
This adds the auto-allocated-topology validation into
the neutron validate_networks path, which is called from
the compute API when creating instances.

If there are no available networks for the project and the
user specifically requested that a network be automatically
allocated for them (via the 'auto' network id on the request),
then we have to check that:

1. The auto-allocated-topology extension is available in neutron.
2. The dry-run validation for auto-allocated-topology passes.

Otherwise we fail the request with a 409 error. Since the
network API is raising a new type of exception, we have to handle
it in the REST API.

Part of blueprint get-me-a-network

Change-Id: Id174ddc6cd61b55f80ff2d55d5fc7b462ae144fd
2016-06-14 13:59:59 -04:00
Sean Dague 56dce766d8 Tear down of os-disk-config part 2
This removes the portions of the os-disk-config extension that handles
additional attributes being passed in during
create/update/resize/rebuild. These are folded directly into
servers.py with a new module wide function for translating REST in =>
attr dict data structures.

Tests which use disk_config as the example for loading and using these
extensions are removed.

As this is the only in tree extension that hooks the resize entry
point, that is fully removed from setup.cfg and well as any extension
manager processing.

Part of bp:api-no-more-extensions

Change-Id: I691a3a917a3dbaa86072d689e9ebf42ba356ca60
2016-06-14 12:07:59 -04:00
Sean Dague 2c437c0889 Tear down os-disk-config part 1
This removes the portions of the os-disk-config extension which extend
the returned responses by adding attributes to the servers object.

Tests are updated / removed where appropriate.

Follow ups will be done to remove the request handling, as well as the
image response handling.

Part of bp:api-no-more-extensions

Change-Id: I795365ed9d0a786b56fcb18400ceee26ca8f1c96
2016-06-14 12:05:35 -04:00
melanie witt 4cb366f831 Disallow instance tag set for invalid instance states
Currently, instance tags can be set at any time during the instance
lifecycle, possibly because it does not go through the compute API.

This makes the valid instance states for the instance tag update API
consistent with the instance metadata update API. If instance tag
update is requested outside of the valid states, a 409 conflict error
will be returned.

Closes-Bug: #1591381

Change-Id: Id53a31654e105854f4942e6d47a1bea90a3e9c3b
2016-06-14 16:02:51 +00:00
ghanshyam f5b8319bee Remove extra expected error code (413) from image metadata
Out of quota error has been changed from 413 to 403 in
I7c179748769b8a0e2cc2e476ebefe33449f6f304, but those
remained in expected error code in image metadata APIs.

Trivial-Fix

Change-Id: Id49c34750931508fb96251a4e1b3d1d8612f7f0d
2016-06-14 18:19:47 +09:00
Rajesh Tailor 9ebf9a5aa5 Trivial-Fix: Fix typos
Change-Id: I09a87b7a13cf551f18ef1fb27aa9f5406baebab4
2016-06-13 06:41:08 +00:00
Jenkins 90981f63eb Merge "Catch PciRequestAliasNotDefined exception" 2016-06-10 19:36:18 +00:00
Sean Dague d8673cb256 remove processing of blacklist/whitelist/corelist extensions
This removes the facility in the API router to have limited lists of
extensions. From this point forward, what is in Nova is loaded, no
exceptions.

A number of unit tests and fakes have to be updated to pass after
this, as many unit tests were sending small lists of extensions to the
API router to simplify the responses they were getting back. This also
required stubbing out the request db cache in some cases, because
extensions later get content from there to avoid additional db
hits. As well as adjusting a few samples tests which now return more
data because all the extensions are always loaded.

There is much cleanup to happen after this, but this is the smallest
unit to get us over this boundary which will start letting us to
refold extensions back into the base views (and massively simplify the
API code).

This does not yet remove the config options because there is another
place those get used in servers.py and the testing fallout of that is
much bigger.

The reno will come with that patch.

Change-Id: I3e72f5e23ce39148f31dfdb76d18f403c6d04842
2016-06-10 11:37:09 -04:00
Jenkins 18e7581d5e Merge "Trival: version history 2.30 is not indented as others" 2016-06-10 10:14:23 +00:00
Jenkins 1ea6757b8c Merge "Remove unused authorizer methods" 2016-06-09 12:55:00 +00:00
Jenkins e3bdce2ddb Merge "Remove the skip_policy_check flags" 2016-06-09 10:30:57 +00:00
Matt Riedemann c5b8b3b46a Remove unused authorizer methods
With the legacy v2 policy checking removed these authorizer
methods are no longer used and can be removed.

Related to blueprint remove-legacy-v2-api-code

Change-Id: I767f4b77388e487cf77bbf8f421ef703a0cc0e80
2016-06-08 17:57:40 -04:00
He Jie Xu 6d2470ade2 Remove the skip_policy_check flags
The skip_policy_check flag is used to skip the legacy v2 API
policy check points in the v2.1 API. The legacy v2 API is removed
and all the old policy check points removed also. This flag is
useless anymore, this patch cleanup them.

Partially implements blueprint remove-legacy-v2-api-code

Change-Id: Ia4a8d9954bf456253101b936f8b4ff513aaa73b2
2016-06-08 22:27:41 +08:00
Kevin_Zheng fa5f6ee0dd Trival: version history 2.30 is not indented as others
The discription of version 2.30 is not indented as others,
trival fix it to be the same with others.

Trival-fix

Change-Id: I8f955d8cfee70dad17b5ea3d7f48e54e67895a8b
2016-06-08 09:47:37 +00:00
ghanshyam 00b29d86e2 Remove v2 extension setting from functional tests
Now v2 API legacy code has been removed, functional
tests do not need to set the v2 extensions.

This patch removes the extension setting on osapi_compute_extension
flag.

Partially implements blueprint remove-legacy-v2-api-code

Change-Id: If5db4b141702fa94777fc5706dec6c3fb6c9c594
2016-06-08 12:46:15 +09:00
Kevin_Zheng a1821205dd Catch PciRequestAliasNotDefined exception
Catch exception.PciRequestAliasNotDefined when
build and resize instance.

Change-Id: I8e73d8c5c9de8a75b5de25c4ac43a6ce35698713
2016-06-07 13:58:55 +00:00
Jenkins 39d41dc304 Merge "Remove normal API operation logs from API layer" 2016-06-07 12:23:03 +00:00
Jenkins ed5fb026f7 Merge "Remove unused LOG from v2.1 API code" 2016-06-07 12:21:10 +00:00
Timofey Durakov c6ffec0003 Handle SetAdminPasswdNotSupported raised by libvirt driver
When admin-password operation is not supported by libvirt qemu/kvm
SetAdminPasswdNotSupported exception is raised, compute manager doesn't
handle it, which cause instance state to be set to error.

Closes-bug: #1522338

Change-Id: Ic63e8f723ff19dfa63199e77ea76680bff5a123b
2016-06-06 21:56:08 +03:00
Sylvain Bauza 7aa2285e72 API change for verifying the scheduler when live migrating
After modifying the evacuate action, we now add a new microversion
change for modifying the live-migrate call so that the scheduler is
called when the admin user provides an hostname unless the force
field is provided.

APIImpact

Implements: blueprint check-destination-on-migrations-newton

Change-Id: I212cbb44f46d7cb36b5d8c74a79065d38fc526d8
2016-06-06 11:44:06 +02:00
Jenkins 45ded00b7c Merge "API change for verifying the scheduler when evacuating" 2016-06-03 17:16:28 +00:00
Sylvain Bauza 86706785ff API change for verifying the scheduler when evacuating
Adding a new microversion for changing the evacuate action behaviour
to call the scheduler anyway unless the admin user provides a force
flag that then keeps the previous behaviour by forcing the conductor
to call the destination without verifying it.

Implements: blueprint check-destination-on-migrations

APIImpact

Change-Id: I9ecbe3d481bf17b12072511da4bb106ff1b6404e
2016-06-02 15:03:39 +02:00
Jenkins 0f8b89c6bf Merge "Remove legacy v2 API code completely" 2016-06-02 12:13:04 +00:00
Jenkins a7176605e2 Merge "Microversion 2.28 changes cpu_info string to JSON object" 2016-06-02 00:15:50 +00:00