This patch is preparation step to move the instance creation to
the conductor. The goal is to move out the instance.create call from
the _provision_instances method.
The _provision_instances method return value is changed
from list of instances to the tuple containing a list of build_requests
and RequestSpec object. We also return the instance_mapping list so
that we can properly clean up residue if we fail to create in the caller.
Co-Authored-By: Dan Smith <dansmith@redhat.com>
Implements: bp cells-scheduling-interaction
Change-Id: I60abcd4f27dc877c4e420071be77c9fdb697ad99
Matt Riedemann [Wed, 23 Nov 2016 01:44:53 +0000 (20:44 -0500)]
Add TODO for returning a 202 from the volume attach API
Attaching a volume is an RPC cast from the API node to the
compute node, so we should return a 202 instead of a 200
in the response. Making that change would break Tempest though
which expects a 200 response code, and we have several other
APIs with similar response code issues:
http://paste.openstack.org/show/590154/
So this just adds a TODO for the same bucket of issues which
we'll probably need to handle in a single microversion.
Dan Smith [Thu, 3 Nov 2016 17:50:26 +0000 (10:50 -0700)]
Refactor two nearly useless secgroup tests
There are two tests that masquerade as "compute api tests" to
validate some instance security group associations. However, those
are just there because it's a convenient place to create instances
with a full complement of things. They depend on behaviors we're
about to move, and are also slated to be irrelevant when we remove
nova-network. In the meantime, move them closer to the other tests
for the bits they are exercising to get them out of the way of
the following patch.
Gábor Antal [Tue, 15 Nov 2016 12:22:31 +0000 (13:22 +0100)]
Transform instance.create.error notification
Along with the transformation changes, I modified notify_about_instance_action
method so it can handle errors now. (It wraps the exception object into an
ExceptionPayload.)
Implements: bp versioned-notification-transformation-ocata
Gábor Antal [Mon, 10 Oct 2016 16:14:52 +0000 (18:14 +0200)]
Transform instance.create notification
We don't need image_name as an extra usage information, because
in the versioned notification, we have image_uuid which can be used
to get the name of the image from glance, if needed.
Change-Id: I1f3ea8d74a2e59049447c3045a293ce0babfb427
Implements: bp versioned-notification-transformation-ocata
Chris Dent [Thu, 10 Nov 2016 18:00:35 +0000 (18:00 +0000)]
[placement] increase gabbi coverage of handlers.allocation
A case where a non-existent resource provider in an allocation PUT
request could raise a 400 was not covered. Now it is.
This still leave a ConcurrentUpdateDetected exception (which can
lead to 409) not covered. There's no simple way to cause such a
thing from a gabbi test.
libvirt: do not return serial address if disabled on destination
During live migration, the check on the destination host is returning
the address of serial proxy even if disabled. However, the absence of
this serial address is the signal the source node needs to know to
determine if the target node supports the serial console feature.
The absence of the serial_listen_addr is specified by the value None.
This makes it also necessary to *not* do a string conversion of None,
as this (maybe surprisingly) results in the string 'None'. The string
'None' however is *not* a valid serial_listen_addr value, as this
must be a valid IP address. The reason for this is, that this value
is used to update the domain XML of the libvirt guest.
This change is also a preparation for the fix of bug 1455252.
int32bit [Fri, 18 Nov 2016 16:08:12 +0000 (00:08 +0800)]
Add index on instances table across project_id and updated_at
We should have an index on the instances.updated_at table because
that's what's used to filter instances when using the --changes-since
filter parameter with nova list.
Jay Pipes [Mon, 31 Oct 2016 12:58:38 +0000 (08:58 -0400)]
placement: adds ResourceClass.get_by_name()
The next patch in this series adds the ability to delete a custom
resource class. In order to implement that, we need a method to return a
single objects.ResourceClass object by string name. This patch adds that
method, implemented by using the resource class cache in a transparent
manner.
Jay Pipes [Fri, 14 Oct 2016 22:21:17 +0000 (18:21 -0400)]
placement: adds ResourceClass.create()
Adds in the implementation of objects.ResourceClass.create() with checks
that the custom resource class being added doesn't overlap with any
standard (or previously-added custom) resource classes. The
implementation uses a hard-coded number 10000 to mark the start of
custom resource class integer identifiers to make it easy to
differentiate custom resource classes. Note that we do NOT increment the
object version here because nothing as-yet calls the ResourceClass
object.
Also note that this patch adds a required "CUSTOM_" namespace prefix to
all custom resource classes. Followup patches will also place this
constraint into the JSONSchema for POST /resource_classes. The CUSTOM_
namespace is required in order to ensure that custom resource class
names never conflict with future standard resource class additions.
Use byte string or utf8 depending on python version for wsgi
A recent change to the wsgi code broke deployments running over
httpd/mod_wsgi. This is because for py2.X mod_wsgi accepts byte
strings and breaks with utf8. However, for py3.X, utf8 is
accepted. So this acts accordingly.
melanie witt [Fri, 18 Nov 2016 17:08:00 +0000 (17:08 +0000)]
Use pick_context_manager throughout DB APIs
The pick_context_manager method will use a connection to a cell
database if one is present in the RequestContext, else it falls
back on the global main_context_manager in the DB API.
Currently, there are several places in our DB API code where
pick_context_manager isn't used because in a real scenario, each
cell is in a separate process where main_context_manager points
to its local database. This causes problems for testing though,
because we are unable to patch the DB API to simulate switching
between multiple 'main' databases in our functional tests because
of the global nature of main_context_manager.
This replaces all uses of main_context_manager with
pick_context_manager to:
1. Make switching between multiple databases able to work in
functional tests
2. Fix any possible cases where pick_context_manager is not
used for a DB API method that could be called from the
API using target_cell
Dan Smith [Thu, 17 Nov 2016 17:59:32 +0000 (09:59 -0800)]
Fix detach_interface() call from external event handler
The signature for VirtDriver.detach_interface() changed recently in 41591c9456fd4eb91407551b9b9898e8f4974050, but the call from the
external event handler was not updated. This does that.
Chris Dent [Fri, 19 Aug 2016 16:14:14 +0000 (16:14 +0000)]
Implement get and set aggregates in the placement API
/resource_providers/{uuid}/aggregates
GET for a list of aggregate uuids associated with this resource
provider
PUT to set the list of aggregate uuids associated with this this
provider
The API requests map directly to set_ and get_ aggregates on the
ResourceProvider object.
This is implemented as placement API microversion 1.1. To make that
easier a raise_404_if_not_version helper method is added to the
microversion module.
The new rest_api_version_history doc is updated to reflect this
new version.
Chris Dent [Sun, 14 Aug 2016 18:30:01 +0000 (18:30 +0000)]
Add {get_,set_}aggregates to objects.ResourceProvider
The Placement API will provide support for associating a list of
aggregate uuids with a resource provider. This is a way of stating
that, for example, a shared storage provider can be used by
compute hosts in aggregates A, B and C.
This change implements the basic get and set functionality required
on the ResourceProvider object as callable methods. Using fields was
also considered but given the precedent with set_inventory and
friends, methods were chosen. Because methods were chosen, explict
get and set-based names were used to avoid confusion with fields or
properties. Since the methods will only be called from the placement
API service, they are not remotable.
The aggregates are stored in the PlacementAggregates model, which is
a recently introduced new table (in Change
Id0355cb022f68e962af306ff04cf724d22b68d19).
As the guts of the complexity are in the database handling, tests
are on the functional side.
Matt Riedemann [Thu, 17 Nov 2016 16:51:00 +0000 (11:51 -0500)]
Log a warning when starting nova-net in non-cellsv1 deployments
We're going to make nova-network fail to start except in cellsv1
deployments before we release Ocata, so log a warning when starting
the service outside of cellsv1. The current plan is to make this
fatal after the o-2 milestone, essentially redoing commit c07046edeee562142c90aa3cadd4bdc47b0a15da.
Trove's CI jobs don't currently work with Neutron due to
bug 1629133 so this is a temporary revert until the Trove CI/infra
networking situation gets sorted out. We have agreement from
the Trove PTL to revert this revert after the o-2 milestone on
2016/12/15.
Bob Ball [Thu, 17 Nov 2016 15:09:05 +0000 (15:09 +0000)]
INFO level logging should be useful in resource tracker
Rather than log messages such as "Starting to do work" at INFO level,
these should be logged at DEBUG level. Useful information, such as the
final resource view, should continue to be logged at INFO.
Claudiu Belu [Thu, 17 Nov 2016 11:10:06 +0000 (13:10 +0200)]
hyper-v: wait for neutron vif plug events
During spawn, the Hyper-V driver should wait for the Neutron
VIF plug events before starting the instance, in order to ensure
that the VIFs are already bound and the guest will be able to
send DHCP requests.
The configuration option "vif_plugging_timeout" will determine
the maximum amount of time to wait for the Neutron events.
Setting the configuration option "vif_plugging_is_fatal" to True
will cause an exception to be raised during spawn, if the Hyper-V
driver did not receive needed Neutron port bound events.
dineshbhor [Tue, 21 Jun 2016 14:41:13 +0000 (20:11 +0530)]
[PY3] byte/string conversions and enable PY3 test
* The dict.items()[0] will raise a TypeError in PY3,
as dict.items() doesn't return a list any more in PY3
but a view of list.
* Webob response body should be bytes not strings so used
oslo_utils.encodeutils.safe_decode to decode it.
int32bit [Sun, 13 Nov 2016 09:37:14 +0000 (17:37 +0800)]
Fix mock arg list order in test_driver.py
When we use nest patch decorators the mocks, they are passed in to the
decorated function in the same order they applied, this means should be
from the bottom up. Though We have never use these arguments in this
function and the order may not very important, it's a little misleading.
So I think we should fix it.
Dan Smith [Tue, 1 Nov 2016 17:00:07 +0000 (10:00 -0700)]
Make n-net refuse to start unless using CellsV1
At the Barcenlona summit, we discussed disabling n-net everywhere as a
precursor to removal. The only exception for using n-net is as required
for CellsV1 users, which require it as the only out-of-the-box supported
networking option.
We will remove this check and n-net entirely when those users have a
migration path to neutron and cellsv2.
Dan Smith [Mon, 7 Nov 2016 18:39:16 +0000 (10:39 -0800)]
Store security groups in RequestSpec
This adds a security_groups field to the RequestSpec object so
that we can communicate those as part of the request to other
services. Historically this has been a formal RPC parameter to
compute (and later conductor), which was a list of string names.
Putting it here in the request spec means that we can easily
pass a list of real objects, and that we can persist them with
the request spec for later reconstruction of the original request
when appropriate, such as for a rebuild operation.