9738 Commits

Author SHA1 Message Date
Surya Seetharaman
d448d2e7d3 archive_deleted_instances is not atomic for insert/delete
Archive deleted instances first moves deleted rows to the shadow
tables and then deletes the rows from the original tables.
However, because it does 2 different selects (to get the rows to
insert and to delete) we can have the case that a row is not inserted
in the shadow table but removed from the original. This can happen
when there are new deleted rows between the insert and delete.

This patch fixes this by explicitly deleting only those IDs that were
inserted.

Change-Id: I4f2e1632aac96afa7ce06908dc30c0716bcb87b2
Closes-Bug: #1727266
2017-12-06 15:31:41 +01:00
Zuul
6c043b7ea6 Merge "Updated from global requirements" 2017-12-06 10:49:23 +00:00
Zuul
7730395cdf Merge "[placement]Enhance doc for placement allocation list" 2017-12-05 13:32:38 +00:00
Zuul
f79aa34529 Merge "Add description for resource class creation" 2017-12-05 13:16:59 +00:00
Zuul
0b0dd6d1a1 Merge "Deprecate the IronicHostManager" 2017-12-05 13:16:45 +00:00
Zuul
a7e4c51faf Merge "Fix wrong argument order in functional test" 2017-12-05 13:01:10 +00:00
Zuul
2166231ce1 Merge "[placement] Add aggregate link note in API ref" 2017-12-05 11:31:03 +00:00
Zuul
fa17a2d949 Merge "Use ksa adapter for keystone conf & requests" 2017-12-05 10:29:18 +00:00
Zuul
51b88af252 Merge "Add regression test for rebuilding a volume-backed server" 2017-12-05 05:28:12 +00:00
OpenStack Proposal Bot
62ede10c78 Updated from global requirements
Change-Id: Ie061672ccc10a03040b12d9723704b9f93c095af
2017-12-05 03:19:38 +00:00
Zuul
dc0706dfb7 Merge "Updated from global requirements" 2017-12-05 02:52:42 +00:00
Takashi NATSUME
ad9933957f Fix wrong argument order in functional test
Fix the wrong order of mock arguments.
The mocks are not used in the test,
but fix it to privent mistakes in the future.

TrivialFix
Change-Id: Iad694b900180a310589483aeda46244a7fc5b408
2017-12-05 11:22:36 +09:00
Takashi NATSUME
050c59036f [placement] Fix an error message in API validation
Fix the error message in validation of the following API
when the name exceeds max character length(255).

* PUT /traits/{name}

Change-Id: I2bbbadd7842bf4652d3c32ae3e5c74e2e159990b
Closes-Bug: #1735343
2017-12-05 11:08:48 +09:00
Takashi NATSUME
af7149f926 [placement] Add aggregate link note in API ref
The aggregate link has been added in resource provider APIs
since microversion 1.1.
But the note is missing in Placement API reference.
Add the note.

The allocations link is missing in the response example
of "Update resource provider" API.
Add it as well.

Change-Id: I325ff34c8b436429c2a2623cf1fb16b368807d29
Closes-Bug: #1733317
2017-12-04 22:07:33 +00:00
Matt Riedemann
22cf178fd7 Add regression test for rebuilding a volume-backed server
Commit 984dd8ad6add4523d93c7ce5a666a32233e02e34 makes rebuild
check to see if the user is rebuilding an instance with a new
image and if so, to run the scheduler filters again since the
new image might not work with the current host for the instance,
and we rebuild to the same host that the instance is already
running on.

The problem is the instance.image_ref attribute is not set for
a volume-backed (boot-from-volume) instance, so the conditional
in the rebuild() method is always True, which means we always run
through the scheduler for volume-backed instances during rebuild,
even if the image in the root disk isn't changing.

This adds a functional regression test to recreate the bug.

Change-Id: If79c554b46c44a7f70f8367426e7da362d7234c8
Related-Bug: #1732947
2017-12-04 15:58:36 -05:00
OpenStack Proposal Bot
47b62fd423 Updated from global requirements
Change-Id: I8f3eb4fbd2df8f73385869057415cc7094bc489e
2017-12-03 21:25:02 +00:00
Zuul
78d87f0ddc Merge "[placement] set accept to application/json if accept not set" 2017-12-02 03:15:45 +00:00
jichenjc
39e8926484 Add description for resource class creation
POST /placement/resource_classes with incorrect format body
of the resource class name lead to something like:

JSON does not validate: u'_FPGA' does not match '^CUSTOM\\_[A-Z0-9_]+$'
with return code 400

we should add this into doc

Change-Id: Iab264f6d731a5f757a992d9bd148e7eb30922b9d
2017-12-02 01:24:37 +00:00
Chris Dent
a4822f486c [placement] re-use existing conf with auth token middleware
If 'oslo_config_project' is passed to the auth_token filter
factory, the mechanism in nova.api.openstack.placement.wsgi for
overriding the location of the configuration file is ignored
meaning that expected custom configuration is also ignored.

Instead pass the already existing conf with 'olso_config_config'
parameter.

The unit test in test_deploy.py shows that the configuration
settings get passed to the middleware and used by testing the
value of the 'WWW-Authenticate' header (which comes from a few
different configuration settings, of which is 'auth_uri') in
a response generated by the placement WSGI application.
The same test against the previous deploy.py code fails.

Change-Id: I61d20c5d19797f7e66648c7864a632f3328be8ce
Closes-Bug: #1734491
2017-12-01 19:27:03 +00:00
Zuul
863c13ef5c Merge "Remove old-style quotas code" 2017-12-01 02:53:17 +00:00
Zuul
2ebc3f79e3 Merge "[placement] Add 'CUSTOM_' prefix description in API ref" 2017-12-01 01:44:01 +00:00
Zuul
58d1dc0c9d Merge "[placement] Fix parameter order in placement API ref" 2017-12-01 01:42:27 +00:00
Zuul
610e7bf6cf Merge "[placement] Fix format in placement API ref" 2017-12-01 01:42:01 +00:00
Eric Fried
f40d35889c Use ksa adapter for keystone conf & requests
nova.api.openstack.identity.verify_project_id now uses the common
get_ksa_adapter utility to create an Adapter from common keystoneauth1
configuration options.  This is effectively identical to the prior
functionality, with the addition of support for Adapter conf options
such as `region_name` and `valid_interfaces` which should almost never
need to be overridden.

As part of blueprint use-ksa-adapter-for-endpoints, this provides a
consistent mechanism for endpoint communication from Nova.

Change-Id: I2204c8bed8936d5bed0f410284d2a563f84e7100
Partial-Implements: bp use-ksa-adapter-for-endpoints
2017-11-30 22:33:01 +00:00
jichenjc
0900f86b6d [placement]Enhance doc for placement allocation list
add a note about when the non-existing consumer id input result

Change-Id: I2a19d8fe8dda5754112361be5ceac8a0dc747ae9
2017-11-30 20:41:08 +00:00
jichenjc
51fdd649b7 Refactor placement version check
raise_http_status_code_if_not_version are duplicate
we don't need keep this function, instead, use
the decorater to check version.

Also, fixed a typo in comment as well.

Change-Id: Ie7200dbfb863d27115e12347e0e8b4ad444489e1
2017-12-01 01:22:00 +08:00
melanie witt
d165ce00b1 Remove old-style quotas code
In Pike, we re-architected quotas to count resources for quota usage
instead of tracking it separately and stopped using reservations.
During an upgrade to Queens, old computes (Pike) will be using
new-style quotas and so the old-style quotas code is no longer needed.

Change-Id: Ie01ab1c3a1219f1d123f0ecedc66a00dfb2eb2c1
2017-11-30 16:13:20 +00:00
Takashi NATSUME
13c1a39567 [placement] Fix format in placement API ref
In "Delete traits" API of Placement API reference,
the format of response codes description is wrong.
"409 Conflict if the name to delete has associations with any"
is bold, but "ResourceProvider." is not.
So fix it.

TrivialFix
Change-Id: I963c350bfc339d4db769b0bfd6bba1087fa065e0
2017-11-30 08:36:40 +00:00
Thomas Goirand
12f353adb4 qemu-img do not use cache=none if no O_DIRECT support
If /var/lib/nova/instances is mounted on a filesystem like tmpfs that
doesn't have support for O_DIRECT, "qemu-img convert" currently crashes
because it's unconditionally using the "-t none" flag.

This patch therefore:
- moves the _supports_direct_io() function out of the libvirt driver,
from nova/virt/libvirt/driver.py to nova/utils.py and makes it public.
- uses that function to decide to use -t none or -t writethrough when
converting images with qemu-img.

Closes-Bug: #1734784

Co-Authored-By: melanie witt <melwittt@gmail.com>

Change-Id: Ifb47de00abf3f83442ca5264fbc24885df924a19
2017-11-29 22:33:39 +00:00
Zuul
0946a084e9 Merge "Remove deprecated TrustedFilter" 2017-11-29 20:05:26 +00:00
Zuul
d90cb2f333 Merge "placement: add nested resource providers" 2017-11-29 19:55:39 +00:00
OpenStack Proposal Bot
705729f3c7 Updated from global requirements
Change-Id: I3129f3c1b41a68d6c03d43f7bc1dba4a1d2b882d
2017-11-29 09:08:01 +00:00
Zuul
f847822354 Merge "Updated from global requirements" 2017-11-29 02:22:37 +00:00
OpenStack Proposal Bot
a1861e9e99 Updated from global requirements
Change-Id: Ie857878bbf063fa687cba2e745329c3fc9ae1f92
2017-11-28 23:07:37 +00:00
Jay Pipes
77ef172f65 placement: add nested resource providers
Adds initial support for storing the relationship between parent and
child resource providers. Nested resource providers are essential for
expressing certain types of resources -- in particular SR-IOV physical
functions and certain SR-IOV fully-programmable gate arrays. The
resources that these providers expose are of resource class
SRIOV_NET_VF and we will need a way of indicating that the physical
function providing these virtual function resources is tagged with
certain traits (representing vendor_id, product_id or the physical
network the PF is attached to).

The compute host is a resource provider which has an SR-IOV-enabled
physical function (NIC) as a child resource provider. The physical
function has an inventory containing some total amount of SRIOV_NET_VF
resources. These SRIOV_NET_VF resources are allocated to zero or more
consumers (instances) on the compute host.

                    compute host (parent resource provider)
                         |
                         |
                      SR-IOV PF  (child resource provider)
                         :
                        / \
                       /   \
                    VF1    VF2   (inventory of child provider)

The resource provider model gets two new fields:

 - root_provider_uuid: The "top" or "root" of the tree of nested
   providers
 - parent_provider_uuid: The immediate parent of the provider, or None
   if the provider is a root provider.

The database schema adds two new columns to the resource_providers
table that contain the internal integer IDs that correspond to the
user-facing UUID values:

 - root_provider_id
 - parent_provider_id

The root_provider_uuid field is non-nullable in the ResourceProvider
object definition, and this code includes an online data migration to
automatically populate the root_provider_id field with the value of the
resource_providers.id field for any resource providers already in the
DB.

The root_provider_id field value is populated automatically when a
provider is created. If the parent provider UUID is set, then the
root_provider_id is set to the root_provider_id value of the parent. If
parent is unset, root_provider_id is set to the value of the id
attribute of the provider being created. The corresponding UUID values
for root and parent provider are fetched in the queries that retrieves
resource provider data using two self-referential joins.

The root_provider_id column allows us to do extremely quick lookups of
an entire tree of providers without needing to perform any recursive
database queries.

Logic in this patch ensures that no resource provider can be deleted if
any of its children have any allocations active on them. We also check
to ensure that when created or updated, a resource provider's parent
provider UUID actually points to an existing provider.

It's important to point out that qualitative trait information is only
associated with a resource provider entity, not the resources that
resource provider has in its inventory. This is the reason why nested
resource providers are necessary. In the case of things like NUMA nodes
or SRIOV physical functions, if a compute host had multiple SRIOV
physical functions, each associated with a different network trait,
there would be no way to differentiate between the SRIOV_NET_VF
resources that those multiple SRIOV physical functions provided if the
containing compute host had a single inventory item containing the
total number of VFs exposed by both PFs.

Change-Id: I2d8df57f77a03cde898d9ec792c5d59b75f61204
blueprint: nested-resource-providers
Co-Authored-By: Moshe Levi <moshele@mellanox.com>
2017-11-28 15:29:28 -05:00
Matt Riedemann
aa19ae204c Deprecate the IronicHostManager
The use_baremetal_filters and baremetal_enabled_filters options
along with the ExactRamFilter, ExactCoreFilter and ExactDiskFilter
filters were all deprecated in Pike:

  I843353427c90142a366ae9ca63ee4298b4f3ecd4

The IronicHostManager is configurable and relies on those options,
so if those options are deprecated then the IronicHostManager should
also be deprecated.

The sticky part with this is going to be filters that don't work with
ironic nodes today, like the NUMATopologyFilter, so a note is left
in the use_baremetal_filters option code to remind us that we can't
likely remove any of this until all filters work with ironic nodes.

Change-Id: Iebc74a09990dcda8cf0ee2a41f9ae1058d2a182a
2017-11-28 15:23:48 -05:00
zhangyangyang
f01cd1c1e0 Remove deprecated TrustedFilter
The TrustedFilter and the related trusted_computing config options
were deprecated in Pike:

  If6e53feeb97e6050c1eb7962110ed89504c952fc

Co-Authored-By: Matt Riedemann <mriedem.os@gmail.com>

Change-Id: I0a7ab3a4fb2cfad567a8644bed4de574393ee11a
2017-11-28 14:54:31 -05:00
Zuul
beb17c6b5c Merge "[placement] Clean up TODOs in allocations.yaml gabbit" 2017-11-28 19:09:07 +00:00
Zuul
fcd71f6798 Merge "[placement] Fix GET PUT /allocations nits" 2017-11-28 19:01:43 +00:00
Zuul
19ae741b0e Merge "[placement] POST /allocations to set allocations for >1 consumers" 2017-11-28 19:01:37 +00:00
Zuul
8eed30f01d Merge "Don't overwrite binding-profile" 2017-11-28 15:45:49 +00:00
Zuul
58df9def2e Merge "Update document related to host aggregate" 2017-11-28 15:26:28 +00:00
Chris Dent
18e6a44f9d [placement] Fix GET PUT /allocations nits
In the review of I49f5680c15413bce27f2abba68b699f3ea95dcdc, a few
non-blocking nits were identified. This change addresses some of
those nits, fixing some typos, clarifying method names and what
microversion is in use at particular times.

Change-Id: Iff15340502ce43eba3b98db26aa0652b1da24504
2017-11-28 12:25:13 +00:00
Chris Dent
a51f5b0d4d [placement] POST /allocations to set allocations for >1 consumers
This provides microversion 1.13 of the placement API, giving the
ability to POST to /allocations to set (or clear) allocations for
more than one consumer uuid.

It builds on the recent work to support a dict-based JSON format
when doing a PUT to /allocations/{consumer_uuid}.

Being able to set allocations for multiple consumers in one request
helps to address race conditions when cleaning up allocations during
move operations in nova.

Clearing allocations is done by setting the 'allocations' key for a
specific consumer to an empty dict.

Updates to placement-api-ref, rest version history and a reno are
included.

Change-Id: I239f33841bb9fcd92b406f979674ae8c5f8d57e3
Implements: bp post-allocations
2017-11-28 12:15:53 +00:00
Zuul
07389edc7e Merge "[placement] Symmetric GET and PUT /allocations/{consumer_uuid}" 2017-11-28 11:09:03 +00:00
Zuul
60bc74dbe6 Merge "Refined fix for validating image on rebuild" 2017-11-28 03:48:43 +00:00
Zuul
d743253bd6 Merge "Updated from global requirements" 2017-11-27 20:57:50 +00:00
Dan Smith
c93f0bba6b Refined fix for validating image on rebuild
This aims to fix the issue described in bug 1664931 where a rebuild
fails to validate the existing host with the scheduler when a new
image is provided. The previous attempt to do this could cause rebuilds
to fail unnecessarily because we ran _all_ of the filters during a
rebuild, which could cause usage/resource filters to prevent an otherwise
valid rebuild from succeeding.

This aims to classify filters as useful for rebuild or not, and only apply
the former during a rebuild scheduler check. We do this by using an internal
scheduler hint, indicating our intent. This should (a) filter out
all hosts other than the one we're running on and (b) be detectable by
the filtering infrastructure as an internally-generated scheduling request
in order to trigger the correct filtering behavior.

Closes-Bug: #1664931
Change-Id: I1a46ef1503be2febcd20f4594f44344d05525446
2017-11-27 15:52:45 -05:00
OpenStack Proposal Bot
a6172036a5 Updated from global requirements
Change-Id: I8c54e6fa64d89f99ff19e1cfc3530e9c3ec25d0f
2017-11-25 18:22:04 +00:00
Matthew Treinish
bc3d836f30 Finish stestr migration
Nova switched to using stestr for all it's in tree testing except for
the coverage job. This commit updates that job so it also uses stestr
and cleans up the last bits of testr setup left in tree. As part of
this change this moves all the one off per job configuration into the
tox job definitions instead of hiding it in either the .stestr.conf or
in a wrapper script.

Change-Id: I36e0e791d485b44641a1ed8770eca8e95aca19be
2017-11-24 16:51:12 -05:00