Commit Graph

322 Commits

Author SHA1 Message Date
Stephen Finucane 817dcc89a9 Remove cells code
Thankfully the bulk of this is neatly organized in a single directory
and can be removed, now that the bulk of the references to it have been
removed. The only complicated area is the tests, though effort has been
taken to minimise the diff here wherever possible.

Part of blueprint remove-cells-v1

Change-Id: Ib0e0b708c46e4330e51f8f8fdfbb02d45aaf0f44
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-05-20 10:29:16 +01:00
Stephen Finucane 14cc25552a Stop handling 'update_cells' on 'BandwidthUsage.create'
Part of blueprint remove-cells-v1

Change-Id: I27719a2c44ebea90161c3032485581a6d8e4ba68
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-05-20 10:29:16 +01:00
Stephen Finucane 8dfc09d467 Remove 'instance_update_from_api'
This was being called within the 'Instance' object. Remove it in its
entirety, given that nothing should be calling it now.

This also allows us to remove some special handling of the
'Instance.cell_name' field, given that nothing should be setting this
anymore.

Part of blueprint remove-cells-v1

Change-Id: I4f2ddf523d9ebfbc6f21a64687b2edb33d0ed1df
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-05-20 10:29:16 +01:00
Stephen Finucane a627723c2a Remove 'instance_update_at_top', 'instance_destroy_at_top'
These were being called within the 'Instance' object. Remove them in their
entirety, given that nothing should be calling them now. They're pretty
closely coupled, hence removing the two of them at the same time. Note
that this removes a good chunk of functionality from cells v1 which turn
necessitates removing some more functional unit tests.

Part of blueprint remove-cells-v1

Change-Id: Ic89352a9900515484bffe961475feb1cefc6b2a9
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-05-02 08:32:05 -06:00
Stephen Finucane cace9b4713 Remove 'get_keypair_at_top'
This was being called within the 'InstanceMetadata' object. Remove it in
its entirety, given that nothing should be calling it now.

Part of blueprint remove-cells-v1

Change-Id: I92bd4c8f465b81a941885f9db4f708a34731de8b
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-04-29 17:55:43 +01:00
Stephen Finucane e3a8188e21 Remove 'instance_info_cache_update_at_top'
This was being called within the 'InstanceInfoCache' object. Remove it
in its entirety, given that nothing should be calling it now.

An 'update_cells' argument is removed from a number of functions as
these all resulted in a call to the cells v1 RPC API, a call that is now
removed.

Part of blueprint remove-cells-v1

Change-Id: Ia8da8cd040d104d745bd7adf20438b8eec558680
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-04-29 17:55:41 +01:00
Stephen Finucane 6584870607 Remove 'instance_fault_create_at_top'
This was being called within the 'InstanceFault' object. Remove it in
its entirety, given that nothing should be calling it now. As with the
removal of the 'bdm_(update_or_create|destroy)_at_top' APIs, this breaks
part of cells v1 but we don't really care.

Part of blueprint remove-cells-v1

Change-Id: Ia7b0166fce8c9ad5baa2a9ed6df8169f898522f2
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-04-29 17:54:17 +01:00
Stephen Finucane 25545d7f55 Remove 'bdm_(update_or_create|destroy)_at_top'
These were being called within the 'BlockDeviceMapping' object. Remove
them in their entirety, given that nothing should be calling them now.
Note that this effectively breaks cells v1 but that shouldn't matter,
given that it's no longer possible to use the thing.

Part of blueprint remove-cells-v1

Change-Id: I13fb0575317015128853ac093bccffe233f3c79f
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-04-16 18:26:17 +01:00
Yikun Jiang e66443770d Per aggregate scheduling weight
This spec proposes to add ability to allow users to use
``Aggregate``'s ``metadata`` to override the global config options
for weights to achieve more fine-grained control over resource
weights.

blueprint: per-aggregate-scheduling-weight

Change-Id: I6e15c6507d037ffe263a460441858ed454b02504
2019-01-21 11:48:44 +08:00
Kevin_Zheng d0336ee172 Add instance action record for snapshot instances
We currently don't record snapshot instance
actions. This is useful for auditing and debugging.

This patch adds instance snapshot actions.

partial-implements: blueprint fill-the-gap-for-instance-action-records

Change-Id: I9ce48e768cc67543f27a6c87c57b47501fff38c2
2017-12-11 17:46:38 +08:00
Kevin_Zheng 0aa7aafdd7 Add instance action record for backup instances
We currently don't record backup instance
actions. This is useful for auditing and debugging.

This patch adds instance backup actions.

Note that because of how backup works for cellsv1, the API
call from the top isn't replayed in the child cell, so we
have to create the instance action in nova/cells/messaging
so the action is in the child cell database when nova-compute
looks it up via wrap_instance_event.

Change-Id: I878015fa211a5f2b5062902b3bfbd571d56efb76
partial-implements: blueprint fill-the-gap-for-instance-action-records
2017-12-08 15:19:54 -05:00
Matt Riedemann 749b220ef6 Cleanup build_request_spec
The RequestContext parameter was unused so it's removed.

Change-Id: I2391aa8e61c5e450d123cf3df1294bc119d361dc
2017-11-10 12:03:39 +11:00
Jenkins 15cac9d7e5 Merge "Handle uuids in os-hypervisors API" 2017-07-20 01:03:27 +00:00
Jenkins d3e6b94eb9 Merge "Use uuid for id in os-services API" 2017-07-20 01:02:42 +00:00
Matt Riedemann 622bfb2e95 Handle uuids in os-hypervisors API
There are quite a few changes here as this is not only handling
uuids for the hypervisor id but it's also a refactor in several
APIs for consistency.

The main changes are detailed in the REST API Version History
doc in this change, but to summarize the changes:

* Hypervisor and service IDs are handled as the UUIDs for those
  resources; this is necessary for accurately working with these
  resources across multiple cells.
* The 'servers' and 'search' routes are deprecated and folded into
  the index and detail methods as query parameters, validated using
  json schema.
* The show method will also be able to return the list of servers
  hosted on the given hypervisor using the with_servers query
  parameter.
* The marker used when paging over lists of hypervisors is the
  compute node UUID.
* Using the hypervisor_hostname_pattern query parameter will not
  work with paging parameters.
* API reference docs are updated for the detailed changes.
* Functional and unit tests are provided for all changes.

Part of blueprint service-hyper-uuid-in-api

Change-Id: I828350c179df8bcfa4739910abeafaba2f96982b
2017-07-18 17:08:01 -04:00
Dan Peschman 2f7bf29d47 Use uuid for id in os-services API
This patch introduces a new microversion to identify services by uuid
instead of id, to ensure uniqueness across cells. GET /os-services
returns uuid in the id field, and uuid must be provided to delete a
service with DELETE /os-services/{service_uuid}.

The old PUT /os-services/* APIs are now capped and replaced
with a new PUT /os-services/{service_uuid} which takes a uuid path
parameter to uniquely identify the service to update. It also restricts
updates to nova-compute services only, since disabling or forcing-down
a non-compute service like nova-scheduler doesn't make sense as it
doesn't do anything.

The new update() method in this microversion also avoids trying to
re-use the existing private action methods like _enable and _disable
since those are predicated on looking up the service by host/binary,
are confusing to follow for code flow, and just don't really make sense
with a pure PUT resource update method.

Part of blueprint service-hyper-uuid-in-api

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

Change-Id: I45494a4df7ee4454edb3ef8e7c5817d8c4e9e5ad
2017-07-18 15:39:57 -04:00
Stephen Finucane 6ef30d5078 conf: remove *_topic config opts
All RPC topic opts were deprecated in Ocata.
This patch removes all *_topic opts from the code.

Change-Id: I41a6be48380999c49d6db3ee5221174a41014002
Implements: blueprint centralize-config-options-pike
2017-07-17 21:27:02 -07:00
melanie witt 26107d6009 Default reservations=None in Cells v1 and conductor APIs
This is a preliminary change for the counting quotas series to make
any legacy quota "reservations" arguments default to None so that in
the next change, we can simply not pass any reservations instead of
passing empty reservations. Reservations are being deprecated as part
of the counting quotas series.

Part of blueprint cells-count-resources-to-check-quota-in-api

Change-Id: I86e56c1abd979ac9968a3ce7daad07530080bde4
2017-07-14 12:25:58 +00:00
Matt Riedemann 69336b024e Handle uuid in HostAPI.compute_node_get
This allows looking up a compute node by its uuid to uniquely
identify it in a list of cells. A later REST API microversion
change will rely on this.

Note that the existing compute_node_get method is used to
minimize the impact to cells v1 (we would have to plumb through
all new support to cells v1 if we added a new HostAPI method).

Since the HostMapping in the API DB does not have the
ComputeNode.uuid we still have to loop over the cells to
find a match. This could be optimized later if needed.

Part of blueprint service-hyper-uuid-in-api

Change-Id: I705119442552e3d507e8d514218466942c5767f5
2017-06-19 09:57:49 -04:00
Mike Perez 7815108d48 Remove cells topic configuration option
This has been deprecated since 15.0.0. It will now continue to use the
default value 'cells'.

Change-Id: Ic2922f0a64f8a099778d3f6934143080d4ea1ccd
2017-06-07 10:04:33 +00:00
Matt Riedemann a59e2b196a Replace messaging.get_transport with get_rpc_transport
The get_transport method was deprecated in the oslo.messaging
5.24.2 release in favor of get_rpc_transport and
get_notification_transport. We are already using get_notification_transport,
we just need to change to use get_rpc_transport.

Change-Id: Ie276fedef35f411cafbaf25c2148fea42ae01410
2017-06-05 15:05:29 -04:00
melanie witt 564958dba6 Use six.text_type() when logging Instance object
We're seeing a trace in gate jobs, for example:

  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
  402: ordinal not in range(128)

when attempting to log an Instance object with a unicode display name.

This resurfaced relatively recently because of the change in devstack
to use the new OSJournalHandler with use_journal=True which is
suspected of causing some deadlock issues [1] unrelated to this bug.

The problem occurs in code that logs an entire Instance object when
the object has a field with unicode characters in it (display_name).
When the object is sent to logging, the UnicodeDecodeError is raised
while formatting the log record here [2]. This implies an implicit
conversion attempt to unicode at this point.

I found that with the Instance object, the conversion to unicode fails
with the UnicodeDecodeError unless the encoding 'utf-8' is explicitly
specified to six.text_type(). And when specifying an encoding to
six.text_type(), the argument to convert must be a string, not an
Instance object, so this does the conversion in two steps as a utility
function:

  1. Get the string representation of the Instance with repr()
  2. Call six.text_type(instance_repr, 'utf-8') passing the encoding
     if not six.PY3

Closes-Bug: #1580728

[1] https://review.openstack.org/#/c/462163
[2] https://github.com/python/cpython/blob/2e576f5/Lib/logging/__init__.py#L338

Change-Id: I0fc3ae02cb2e401b3240faf0d8b6aa5dc52b91fc
2017-05-03 22:45:49 +00:00
Jenkins ddc807f85a Merge "remove log translation tags from nova.cells" 2017-04-21 15:24:59 +00:00
Chris Friesen c6c68ba00b remove unused parameter in rpc call
The oslo.messaging rpc client call() method does not actually make
any use of a "timeout" parameter, so drop it from the call.  (It's
actually set up in the preceeding prepare() call.)

Change-Id: I662948cbb0c1fb89d8cb1e1ffad1909dc5b1dc68
2017-04-17 08:27:20 -06:00
Sean Dague 1cda41f4a3 remove log translation tags from nova.cells
Change-Id: Iad2ad3b865873ca510edb9a6e93b6d44d9b24ed9
2017-04-10 14:48:07 +00:00
ChangBo Guo(gcb) 05c50f2479 Remove old oslo.messaging transport aliases
Those are remnants from the oslo-incubator times. Also, oslo.messaging
deprecated [1] transport aliases since 5.2.0+ that is the minimal
version supported for stable/newton. The patch that bumped the minimal
version for Nova landed 3 months+ ago, so we can proceed ripping
those aliases from the code base.

[1] I314cefa5fb1803fa7e21e3e34300e5ced31bba89

Change-Id: Id8c0bc6733e930803b8e9fcf42a9a1f81dcbb356
Closes-Bug: #1424728
2017-03-17 20:41:16 +08:00
Eric Brown f52521a253 Add RPC version aliases for Ocata
This adds upgrade level aliases for ocata for all of our services.

Change-Id: I28b806ea98318286a02a4b319a6272170dd41689
2017-02-27 18:37:48 +04:00
Dan Smith 6e5b1d289b Remove straggling use of main db flavors in cellsv1 code
This remaining use of the flavor query routine from the cellsv1 code
still looks at the main database. This patch converts it to use the
object which looks in the right place.

Closes-Bug: #1663729
Change-Id: I418988ae1d72d541ace867a22b2c9267164bf61b
2017-02-10 11:59:13 -08:00
Jenkins c9eb953031 Merge "[2/3]Replace six.iteritems() with .items()" 2017-01-21 06:55:52 +00:00
Dina Belova ecc8de8d6c Integrate OSProfiler and Nova
* Add osprofiler wsgi middleware. This middleware is used for 2 things:
  1) It checks that person who want to trace is trusted and knows
     secret HMAC key.
  2) It starts tracing in case of proper trace headers
     and adds the first wsgi trace point with info about the HTTP request

* Add initialization of osprofiler on start of a service
  Currently that includes oslo.messaging notifier instance creation
  to send Ceilometer backend notifications.

oslo-spec: https://review.openstack.org/#/c/103825/
python-novaclient change: https://review.openstack.org/#/c/254699/
based on: https://review.openstack.org/#/c/105096/

Co-Authored-By: Boris Pavlovic <boris@pavlovic.me>
Co-Authored-By: Munoz, Obed N <obed.n.munoz@intel.com>
Co-Authored-By: Roman Podoliaka <rpodolyaka@mirantis.com>
Co-Authored-By: Tovin Seven <vinhnt@vn.fujitsu.com>

Implements: blueprint osprofiler-support-in-nova
Change-Id: I82d2badc8c1fcec27c3fce7c3c20e0f3b76414f1
2017-01-18 15:00:14 +07:00
Spencer Yu 70730c09ab [2/3]Replace six.iteritems() with .items()
1.As mentioned in [1], we should avoid using
six.iteritems to achieve iterators. We can
use dict.items instead, as it will return
iterators in PY3 as well. And dict.items/keys
will more readable. 2.In py2, the performance
about list should be negligible, see the link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

The patch list:
    1. cells.
    2. compute api.
    3. image.
    4. network.
    5. objects.
    6. scheduler.
    7. virt.
    8. other resources.

Partial-Implements: blueprint replace-iteritems-with-items

Change-Id: Ic6e469eb80ee1774de1374bb36f38b5134b6b311
2017-01-09 09:11:00 +00:00
jeckxie 10fdc075fd [TrivialFix] Fix comment typo error
Change-Id: I3134bebb30f43a38d716060f99890645d809bf91
2016-12-22 15:11:45 +08:00
int32bit 58bf5d0053 Fix error if free_disk_gb is None in CellStateManager
The field 'free_disk_gb' in Objects.ComputeNode can be nullable.
In CellStateManager._get_compute_hosts, we compute free_disk_mb
by 'free_disk_gb * 1024'. If the free_disk_gb is None, it will raise
a TypeError exception because None type can't multiply by an integer.
We should check this value, and if it's None, we just let it return
zero.

Closes-Bug: #1648983

Change-Id: I558d544ff838807c1d605cb5ed8d0e0fa97ab00e
2016-12-19 02:37:48 +00:00
Jenkins 4e747092bc Merge "Add RPC version aliases for Newton" 2016-11-28 18:01:39 +00:00
Maciej Szankin f8c69efdf1 conf: remove deprecated cells driver option
Change-Id: I582e53c24f1eebf83bbbdaa00164336d10bbcfdb
Implements: blueprint centralize-config-options-ocata
2016-11-17 18:58:47 +00:00
Dan Smith 54686bbf18 Add RPC version aliases for Newton
This adds upgrade level aliases for newton for all of our services,
including the ones we expect to remove soon.

Change-Id: If97f8f87f3d8b4db8f6b6b826c5c1f5d0b3f10a8
2016-10-28 03:11:38 -07:00
Claudiu Belu e6593d3a4b compute: fixes python 3 related unit tests
Fixes volume related unit tests.
Fixes non-sortable None items.
Fixes __getattr__ infinite recursion.
Fixes is_dict_like method. Dicts in python 3.4 do not
have the 'has_key' method.

Partially Implements: blueprint goal-python35

Change-Id: I97efc09f7657436f706b08e0b2795f0e59ac1dcd
2016-10-18 07:07:43 +00:00
Andrew Laski 00e46a313c Fix migration list + MigrationList operation
Fixes up the get_migrations cells method and corresponding tests. The
tests were not in line with reality since the MigrationList object was
introduced.

This patch removes the [] + MigrationList operation that was occurring
since the operation is poorly defined and only works by accident. Future
objects work may break this so it should be removed now.

Change-Id: I5dabd8c745cc287322a1ef0f0dd2d4733484188d
2016-08-15 10:05:23 -04:00
Alex Szarka 5ef2f3c3d0 Fixed typos in nova, nova/api, nova/cells directory
This patchset fixes the typo errors in nova root(non recursively),
nova/api, nova/cells and nova/cmd directory.
TrivialFix

Change-Id: Id4e5dbeafb6fdb63bb733eef203a676f94143f32
2016-08-01 07:14:04 +00:00
Andrew Laski dc6a3f4abb Refactor block_device_mapping handling during boot
It has become clear that it will be necessary to store a copy of the
block_device_mapping on the BuildRequest object so that it can be
returned via the API(os-extended-volumes). In order to prepare for doing
so the block_device_mapping needs to be validated and fully set, but not
persisted to the database. This patch refactors some methods to allow
that.

Change-Id: If2020f00e15ca1b067620f880a6f7d3a8ad5281c
2016-07-05 14:38:21 -04:00
Claudiu Belu 7d01bceaa0 policy: clean-up
Registers in-code the last remaining policy rules.
Adds missing 'discoverable' rules. Without them,
the extension_info API can fail, as it tries to check the
os_compute_api:os_server_tags:discoverable rule. As it wasn't
previously registered, when listing the available extensions,
an exception of type PolicyNotRegistered is encountered.
In order to validate this, functional/api_sample_tests/test_extension_info.py
now runs without mocking policy.authorize.

Switches extension_info to context.can.
Switches nova.cells.filters to context.can.
Switches network.neutronv2.api to context.can.

Removes the rest of the entries in etc/policy.json.
Removes DefaultPolicyTestCase, as it tests the default
policy rule, which is not registered.
Removes rules from fake_policy.py that brings no value,
that are the same as the default values.
Removes extensions authorizer factories.
Removes nova.policy.enforce.

Change-Id: Ie7771768f4f3efe0edc787c12f297aa93d533d7e
Partially-Implements: bp policy-in-code
2016-06-30 19:56:14 +00:00
Esra Celik d7d67e409a Improve the help text for cells options (7)
Some comments on `Improve the help text for cells options`
reviews are implemented with this patch.

- nova.cells.opts:list_ops function removed.

Implements blueprint centralize-config-options-newton
Change-Id: Idcaf66f0db1695d4fff34a656df2934c1b6d2ede
2016-06-09 08:39:46 +03:00
Sylvain Bauza 76dfb4ba9f Cold migrate using the RequestSpec object
Cold migrate and resize can now get the Spec object and pass it
down the wire to the conductor so that it could use it for the
move.

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

Co-Authored-By: Pawel Koniszewski <pawel.koniszewski@intel.com>
Change-Id: Ic3968721d257a167f3f946e5387cd227a7eeec6c
2016-05-17 11:01:22 +02:00
Dan Smith 9880a164d4 Create Instances with keypairs
This makes compute_api create Instance objects with keypairs set,
so that they are persisted in the instance_extra table and thus
available without hitting the API DB once we move keypairs up there.

Related to blueprint cells-keypairs-api-db

Change-Id: I8d055265c8900b7fff8a209bb48884c9a734ceaf
2016-05-11 13:24:50 -07:00
Jesse J. Cook 016b810f67 Unavailable hosts have no resources for use
If a host's:

  * resources are unavailable
  * in a unusable state

the system should:

  * report 0 resources
  * show 0 resources
  * not be scheduled to

Change-Id: Ia1c2f6f161dde1e23acce85a54566d07805d13df
Closes-Bug: 1503453
2016-04-18 19:07:23 +00:00
Ryan Rossiter 8806ac9e41 Remove DictCompat from ComputeNode
This change removes NovaObjectDictCompat from the ComputeNode object.
The only changes needed were changing dict syntax over to either use
dot syntax or getattr/setattr. In cases where the dict function update()
was used, the update dictionary was unchanged, but was not passed into
a new update helper function that applies the updates using setattr() on
the given kwargs.

Change-Id: Iba5303d23492db55f46df8b8f6b3dbae5b4971c1
Partially-Implements: bp rm-object-dict-compat-newton
2016-03-30 13:45:13 +00:00
Dan Smith 1969d89d40 Set RPC version aliases for Mitaka
Per our usual procedure, this sets version aliases for the current RPC
versions of all our internal RPC APIs for mitaka.

Change-Id: I455f3b80a9b64dfea42ee1c74685d11ae0178513
2016-03-16 09:54:49 -07:00
Dan Smith c5a5a7f322 Avoid lazy-loads of ec2_ids on Instance
Right now, we only create the ec2_ids for an Instance when they are first
accessed, not at instance creation time. However, we always touch them
later for building metadata, configdrive, etc, which means we end up with
an expensive lazy-load later.

This makes us always create ec2_ids at instance create time. Since it's in
instance.create(), it runs on conductor, straight to the database, avoiding
a round-trip later (assuming this instance is passed to the compute node
for create and/or that the field is specified in a later call under
expected_attrs).

Partial-Bug: #1540526
Change-Id: I29bc317f990bfa0f01b4f9615699debcc3a3c2c6
2016-03-15 07:07:15 -07:00
Andrew Laski 62835426f7 Create BuildRequest object during boot process
The BuildRequest object represents a boot request before an instance has
been created and written to the database. It will be required to respond
to API requests to list/show an instance in cellsv2 where the instance
is not written to the database immediately. An upcoming change will
modify the boot process to defer instance creation until after
scheduling has picked a cell/host and having this BuildRequest object
persisted is a prerequisite for that work. The BuildRequest object
lifetime ends as soon as the instance has been written to a database and
a mapping is in place for it. Until instance creation moves the
BuildRequest object is destroyed rather quickly.

Note there is a small optimization added here such that when creating
instances in the API, only populate the SecurityGroupList once rather
than each pass in the for loop (if building multiple instances).

Change-Id: I080fa53d13f7301f6f7f2977a8e3cb287a46c02c
Partially-implements: bp cells-scheduling-interaction
2016-03-02 21:53:15 -05:00
Sylvain Bauza 9ab6840af6 Fix Cells RPC API by accepting a RequestSpec arg
Since cells v1 adds a proxy to a call to ComputeTaskAPI for live_migrate
and rebuild_instance, we need to augment the Cells RPC API to accept
the request_spec argument for both methods.

That said, since cells v1 is quite feature-freeze, it's okay to not pass
the RequestSpec down to the pipe because the cell conductor will then
act as if the instance was not having a Spec object, which is a compat
behaviour we want to keep for a very long time.

Closes-Bug: #1550018

Change-Id: I1c2aaedfc83e4e97f53c9c504e4585b1f0510d4b
2016-02-29 21:37:00 +01:00