Commit Graph

51054 Commits

Author SHA1 Message Date
Zuul 5bf9aa7fd4 Merge "Change exception type while deattaching root device" 2018-05-26 17:09:23 +00:00
Zuul e59fe30bdb Merge "libvirt: get_inventory => update_provider_tree" 2018-05-25 15:47:33 +00:00
Maciej Jozefczyk d2e40a3e49 Change exception type while deattaching root device
By default it is not possible to deattach volume that is configured
as root device for an instance.
Previous HTTP 403 reponse pointed that caller don't have permission
to deattach the volume instead he's not able to do it. Response 400
suits more for that case.

Change-Id: Ife59900448719f78c0505f1b681cb26674fa0306
2018-05-25 13:10:01 +02:00
Zuul e4a2ebafe1 Merge "libvirt: Deprecate support for monitoring Intel CMT perf events" 2018-05-25 03:00:33 +00:00
Zuul b5e267cb2b Merge "Normalize inventory from update_provider_tree" 2018-05-25 00:56:48 +00:00
Kashyap Chamarthy fc4794acc6 libvirt: Deprecate support for monitoring Intel CMT perf events
Upstream Linux kernel has deleted[*] the `perf` framework integration
with Intel CMT (Cache Monitoring Technology; or "CQM" in Linux kernel
parlance), because the feature was broken by design -- an
incompatibility between Linux's `perf` infrastructure and Intel CMT
hardware support.  It was removed in upstream kernel version v4.14; but
bear in mind that downstream Linux distributions with lower kernel
versions than 4.14 have backported the said change.

Nova supports monitoring of the above mentioned Intel CMT events
(namely: 'cmt', 'mbm_local', and 'mbm_total') via the configuration
attribute `[libvirt]/enabled_perf_events`. Given that the underlying
Linux kernel infrastructure for Intel CMT is removed, we should remove
support for it in Nova too.  Otherwise enabling them in Nova, and
updating to a Linux kernel 4.14 (or above) will result in instances
failing to boot.

To that end, deprecate support for the three Intel CMT events in "Rocky"
release, with the intention to remove support for it in the upcoming
"Stein" release.  Note that we cannot deprecate / remove
`enabled_perf_events` config attribute altogether -- since there are
other[+] `perf` events besides Intel CMT.  Whether anyone is using those
other events with Nova is a good question to which we don't have an
equally good answer for, if at all.

[*] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c39a0e2
[+] https://libvirt.org/formatdomain.html#elementsPerf

Closes-Bug: #1751073
Change-Id: I7e77f87650d966d605807c7be184e670259a81c1
Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
2018-05-24 23:20:06 +00:00
Zuul e2b0b469be Merge "Honor availability_zone hint via placement" 2018-05-24 06:54:56 +00:00
Zuul 154bbf659b Merge "Remove mox in libvirt/test_driver.py (2)" 2018-05-24 01:13:24 +00:00
Zuul 37c69dfcbb Merge "Convert libvirt's RBD storage to using processutils.execute()" 2018-05-23 23:40:53 +00:00
Zuul 8ede37e8b1 Merge "Remove the remaining of the removed option" 2018-05-22 20:03:06 +00:00
Dan Smith 96f1071166 Honor availability_zone hint via placement
This adds a request filter that, if enabled, allows us to use placement
to select hosts in the desired availability zone by looking up the uuid
of the associated host aggregate and using that in our query for
allocation candidates. The deployer needs the same sort of mirrored
aggregate setup as the tenant filter, and documentation is added here to
make that clear.

Related to blueprint placement-req-filter

Change-Id: I7eb6de435e10793f5445724d847a8f1bf25ec6e3
2018-05-22 08:56:50 -07:00
Ken'ichi Ohmichi 89b3286ebc Remove the remaining of the removed option
Since I8ae8507a089df4d0a32be5fbc615e2166f44516e the config option
multi_instance_display_name_template has been removed.
So this patch removes the remaining of the option.

Change-Id: I81fa2588d85c803415aadf6150ed6cdd7a0fe6d1
2018-05-22 15:56:44 +00:00
Michael Still 517cbd0815 Convert libvirt's RBD storage to using processutils.execute()
Nova's utils.execute() is just a redirector now and should go
away, so I am progressively moving things over to calling
processutils directly.

Change-Id: I745b3433a447aeec819781e0ee26df6e6c70530a
blueprint: execs-ive-had-a-few
2018-05-22 07:00:56 +10:00
Zuul d78055df0e Merge "api-ref: Fix parameters for os-volume-attachments.inc" 2018-05-21 13:41:07 +00:00
Zuul 17976b4aed Merge "Fix interpretation of max_attempts for scheduling alternates" 2018-05-20 19:34:05 +00:00
Zuul 20b99f6998 Merge "Granular requests to get_allocation_candidates" 2018-05-19 05:22:25 +00:00
Zuul b979bcd7e4 Merge "Placement: allow to set reserved value equal to total for inventory" 2018-05-19 02:53:33 +00:00
Zuul c8130ee6fd Merge "Add tests for _get_trees_matching_all() function" 2018-05-19 02:34:15 +00:00
Zuul 92f7071897 Merge "Avoid unnecessary joins in HostManager._get_instances_by_host" 2018-05-19 02:34:09 +00:00
Zuul 6bc136efcc Merge "Update placement upgrade docs for nova-api dependency on placement" 2018-05-19 01:55:38 +00:00
Zuul 777182c742 Merge "Update nova-status and docs for required placement 1.24" 2018-05-19 01:55:33 +00:00
Zuul 3e143edf27 Merge "Update PowerVM hypervisor docs" 2018-05-19 01:38:43 +00:00
Zuul 9fa6f105e5 Merge "PowerVM Driver: Localdisk" 2018-05-19 01:38:36 +00:00
Zuul f594003ddd Merge "ProviderTree.has_inventory_changed for new fields" 2018-05-19 01:38:30 +00:00
Matt Riedemann 3abd5f5797 Update placement upgrade docs for nova-api dependency on placement
Change If507e23f0b7e5fa417041c3870d77786498f741d makes nova-api
dependent on placement for deleting an instance when the nova-compute
service on which that instance is running is down, also known as
"local delete".

Change I7b8622b178d5043ed1556d7bdceaf60f47e5ac80 makes nova-api
dependent on placement for deleting a nova-compute service record.

Both changes are idempotent if nova-api isn't configured to use
placement, but warnings will show up in the logs.

This change updates the upgrade docs to mention the new dependency.

Change-Id: I941a8f4b321e4c90a45f7d9fccb74489fae0d62d
Related-Bug: #1679750
Related-Bug: #1756179
2018-05-18 23:06:43 +00:00
Matt Riedemann a1a335f19a Avoid unnecessary joins in HostManager._get_instances_by_host
While getting a HostState object for a given compute node during
scheduling, if the HostState does not have its instance info
set, either because it's out of date or because config option
"track_instance_changes" is False, the HostManager still pulls
the list of instances for that host from the database and stores
it in HostState.instances.

This is *only* used (in-tree) by the affinity filters and even
then the only thing those filters use from HostState.instances
is the set of keys from the dict, which is the list of instance
UUIDs on a given host. The actual Instance objects aren't used
at all. See blueprint put-host-manager-instance-info-on-a-diet
for more details on that.

The point of this change, is that when we go to pull the set
of instances from the database for a given host, we don't need
to join on the default columns (info_cache and security_groups)
defined in the _instance_get_all_query() method in the DB API.

This should be at least some minor optimization in scheduling
for hosts that have several instances on them in a large cloud.
As noted in the comment in the code, any out of tree filters
that rely on using the info_cache or security_groups from the
instance are now going to be hit with a lazy-load penalty
per instance, but we have no contract on out of tree filters
so if this happens, the people maintaining said filters can
(1) live with it (2) fork the HostManager code or (3) upstream
their filter so it's in-tree.

A more impactful change would be to refactor
HostManager._get_host_states to bulk query the instances on
the given set of compute nodes in a single query per cell. But
that is left for a later change.

Change-Id: Iccefbfdfa578515a004ef6ac718bac1a49d5c5fd
Partial-Bug: #1737465
2018-05-18 23:05:47 +00:00
Vladyslav Drok 7f79758dd9 Placement: allow to set reserved value equal to total for inventory
This is needed for ironic use case, when during cleaning, resources
are reserved by ironic itself. Cyborg will also benefit from this
during FPGA programming.

blueprint: allow-reserved-equal-total-inventory
Change-Id: I037d9b8c1bb554c3437434cc9a57ddb630dd62f0
2018-05-18 23:04:27 +00:00
Matthew Edmonds 30c87c5a9d Update PowerVM hypervisor docs
This refreshes the PowerVM hypervisor docs with a clearer flow and
additional information.

Change-Id: I0b33200b710960e4e8df7333d06c98456c4b0c00
2018-05-18 22:00:22 +00:00
Matt Riedemann 216e232def Update nova-status and docs for required placement 1.24
Change Id7eecbfe53f3a973d828122cf0149b2e10b8833f made
nova-scheduler require placement >= 1.24 so this change
updates the minimum required version checked in the
nova-status upgrade check command along with the upgrade
docs.

Change-Id: I4369f7fb1453e896864222fa407437982be8f6b5
2018-05-18 21:46:25 +00:00
Eric Fried 9ef4d7662e Granular requests to get_allocation_candidates
nova.scheduler.utils.ResourceRequest now has a to_querystring method
that produces a querystring in the format expected by the GET
/allocation_candidates API.  The report client now uses this method to
invoke said API.

Change-Id: I496e8d64907fdcb0e2da255725aed1fc529725f2
blueprint: granular-resource-requests
2018-05-18 21:43:02 +00:00
Eric Fried 493fbf719c libvirt: get_inventory => update_provider_tree
Port the libvirt compute driver's get_inventory method to
update_provider_tree.

Change-Id: I60810aeebc07bae7195ea9433d923c479505f6ed
2018-05-18 16:41:15 -05:00
Eric Fried 8ab386ed9b Normalize inventory from update_provider_tree
We thought we didn't have to normalize inventory (set allocation ratios
and reserved amounts from the compute node record) when taking the
update_provider_tree path in the resource tracker [1] because we wanted
the virt driver to be the source of truth for those values.

We still do want that, and that's still the case (because we only set
them if unset). But since the virt driver doesn't have access to the
compute_node object itself, until and unless we stop setting those
values on the compute_node, we still have to do that normalization even
for the update_provider_tree path. This patch makes it so.

[1] https://github.com/openstack/nova/blob/4b4e005c639204f2c680eda61131a6930379d70e/nova/compute/resource_tracker.py#L884-L886

Change-Id: I6a706ec5966cdc85f97223617662fe15d3e6dc08
2018-05-18 16:41:14 -05:00
Eric Fried b864d08eaf ProviderTree.has_inventory_changed for new fields
The has_inventory_changed method of ProviderTree is deliberately not
automatically reporting True if the incoming record is "sparse" - that
is, for a given resource class, it only contains a subset of the keys in
the existing record.  For example, the caller may want to know if the
total has changed, but doesn't care about the other fields, so may ask:

ptree.has_inventory_changed(uuid, {'VCPU': {'total': 3}, ...})

...and has_inventory_changed will only compare the 'total' field.

However, we were doing the same if the incoming record contained fields
that were *not* in the existing record.  For example, if the current
inventory was:

{ 'VCPU': {
      'total': 8,
      'min_unit': 1,
      'max_unit': 8,
      'step_size': 1,
  }
}

...and the new inventory was:

{ 'VCPU': {
      'total': 8,
      'min_unit': 1,
      'max_unit': 8,
      'step_size': 1,
      'allocation_ratio': 16.0,  # <== new
      'reserved': 1,             # <== new
  }
}

...the presence of the new fields was *not* enough to trigger a True
response.

This is problematic because we currently expect to be able to add
specifically these fields - allocation_ratio and reserved - to an
inventory record if they are not present (see [1]).

With this change set, we add a condition to automatically return True
(inventory *has* changed) whenever the incoming (new) record contains
fields absent from the existing record.

[1] https://github.com/openstack/nova/blob/050e9202f69b6eeb23026b7350eeb8821ca9f1cc/nova/compute/resource_tracker.py#L83-L125

Partial-Bug: #1771728
Change-Id: I80dd6d08322bcedc8535f04baf2e96473f5e3aeb
2018-05-18 16:41:14 -05:00
esberglu 026c2a61d0 PowerVM Driver: Localdisk
Add PowerVM Driver support for local ephemeral disk.

Change-Id: I9251287451bc2f800ef4a230c3c01598f37b5ad3
Blueprint: powervm-localdisk
2018-05-18 21:38:09 +00:00
Dan Smith 6cfcce0559 Expose instance_get_all_uuids_by_host() from DB API and use it
We've had a long-standing optimization point in the
InstanceList.get_uuids_by_host() method, where we pull the entire
list of instance objects only to strip and return the uuids. We
already had a query method for generating just the uuids in the
DB API, but it was not exposed as it was just a helper for another
method. This exposes it publicly and uses it in that InstanceList
method.

Change-Id: I35c05e78d59ec9b95c2a443979b8d66cd42ea043
2018-05-18 14:36:12 -07:00
Dan Smith 549e5a2226 Make instance.refresh() avoid recursion better
The instance.refresh() method is careful to prevent recursion, to avoid
lazy-loads on the object we just pulled from the database. However, it
was allowing those to raise OrphanedObjectError to the caller to make
them visible. The caller is not really at fault in that case, and can not
avoid it.

The only time this has ever come up is in the context of cellsv1 and the
keypairs field that it doesn't have set on instances in the child cells.
Thus, this changes refresh() to just skip fields that are set on the
current object and unset on the one we pull from the database, as we
would not be able to refresh those anyway. This logs the situation so that
it is visible (at DEBUG) if it becomes relevant.

Change-Id: Ibfca4ae922766b5b977e217594d12e1169ddeee8
2018-05-18 14:36:12 -07:00
Dan Smith 7dc4286b12 Make instance able to lazy-load almost everything
Previously we had a trivial block on the lazy-load handler for instance
that prevented loading mundane things that couldn't be opted-out during
a query. There's no real reason for that and we already had the generic
loader mechanism.

This removes that limit, and adjusts some of the logic in obj_load_attr()
to continue providing the same behavior for things like id and uuid being
missing (which we have lots of existing coverage for). The new behavior
of being able to load something like vm_state gets a new test, which also
validates that _load_generic() loads anything else it can from the instance
it fetches from the database, if not already set on the object initiating
the load.

Change-Id: Id0f4027f1fffefdb90240fc484cf3c0554e576d9
2018-05-18 14:36:12 -07:00
Zuul 0f70337718 Merge "Fix typo in NUMATopologyFilter docs" 2018-05-18 18:18:18 +00:00
Zuul c8fd5ce108 Merge "Fix inconsistency in docs" 2018-05-18 16:30:51 +00:00
Dan Smith 5d86aa7edb Fix interpretation of max_attempts for scheduling alternates
Since max_attempts is not max_retries, we should look for max_attempts-1
alternate hosts. This change makes the num_alts variable actually reflect
the number of alternates we are looking for, and doesn't actually change
the logic at all. This also adds functional tests to verify max_attempts
behavior with 1 (no retries) and 2 (one retry), just to make sure it is
doing what we expect.

Further, we optimize _get_alternate_hosts() to only re-filter/weigh the
host list if we're looking for alternates for multiple instances. Now
that it's clear that num_alts is only nonzero if we are going to look
at the host list again to find those alternates, it can be more clearly
(and accurately) used to optimize out that extra step if we are not
getting alternates.

Change-Id: I16ba29385dd2db5467829e6c17fc395096b5cfd3
2018-05-18 09:06:07 -07:00
chenxing d163fb6d69 Update the deprecate os_region_name option
Option "os_region_name" from group "placement" is deprecated. Use
option "region_name" from group "placement".

Change-Id: Id44d456bb1bdb0c5564ad4f5d9cdee2f41226052
Related-Bug: #1762106
2018-05-18 15:35:31 +00:00
Robin Naundorf dd1dea22f2 Fix inconsistency in docs
* Make the `True` lowercase to reflect examples in config and
    other parameters in docs

TrivialFix

Change-Id: I259d36bc15e034c248ec39b2c5c97ff95986b31b
2018-05-18 09:37:02 +02:00
Takashi NATSUME dd5e9e316d Remove mox in libvirt/test_driver.py (2)
Replace mox with mock in the following methods
of the LibvirtConnTestCase
in nova/tests/unit/virt/libvirt/test_driver.py.

* _mock_can_live_migrate_source
* test_check_can_live_migrate_source_block_migration
* test_check_can_live_migrate_source_shared_block_storage
* test_check_can_live_migrate_source_shared_instance_path
* test_check_can_live_migrate_source_non_shared_fails
* test_check_can_live_migrate_source_shared_block_migration_fails
* test_check_can_live_migrate_shared_path_block_migration_fails
* test_check_can_live_migrate_non_shared_non_block_migration_fails
* test_check_can_live_migrate_source_with_dest_not_enough_disk
* _do_test_create_images_and_backing

Subsequent patches will replace mox in other test cases.

Change-Id: Ia9167f7843bec2210176c472e4946e8ba3a1c72a
Implements: blueprint mox-removal
2018-05-18 03:29:32 +00:00
Zuul 04469a5181 Merge "Fakelibvirt migrateToURI3 should provide args according to libvirt doc" 2018-05-17 21:21:51 +00:00
Zuul c2180ff3e2 Merge "Remove unnecessary 'to_primitive' call" 2018-05-17 21:21:27 +00:00
Zuul 0b419d59bd Merge "Remove mox in test_xenapi.py (3)" 2018-05-17 20:56:25 +00:00
Zuul c1806cace0 Merge "Cleanup ugly stub in TestLocalDeleteAllocations" 2018-05-17 20:37:32 +00:00
Zuul de52fefa1f Merge "Deduplicate config/policy reference docs from main index" 2018-05-17 20:07:09 +00:00
jiajunsu b6b46fb4bc Fakelibvirt migrateToURI3 should provide args according to libvirt doc
According to libvirt doc[1], migrateToURI3 supports
args(dconnuri, params, flags) but not logical_sum.
We call migrateToURI3 with arg flags in guest.py [2].

The wrong fake func may cause error in functional tests of nova.
With logs below:
  "/home/zuul/src/git.openstack.org/openstack/nova/nova/virt/libvirt/guest.py",
  line 669, in migrate'
  '    destination, params=params, flags=flags)'
  "TypeError: migrateToURI3() got an unexpected keyword argument 'flags'"

[1] https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateToURI3
[2] https://github.com/openstack/nova/blob/050e92/nova/virt/libvirt/guest.py#L668

Change-Id: I88d71bac7ddb69b9b63fb58dd8eaf6c048017933
2018-05-17 18:07:59 +00:00
Zuul 050e9202f6 Merge "PowerVM Driver: DiskAdapter parent class" 2018-05-17 16:24:10 +00:00