Commit Graph

2227 Commits

Author SHA1 Message Date
Stephen Finucane adb28f503c xenapi: Remove driver and tests
Change-Id: I42b302afbb1cfede7a0f7b16485a596cd70baf17
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-09-11 14:09:06 +01:00
Takashi Natsume 28ed0c5c9a Remove six.PY2 and six.PY3
Remove six.PY2 and six.PY3.
Subsequent patches will replace other six usages.

Change-Id: Iccce0ab50eee515e533ab36c8e7adc10cb3f7019
Implements: blueprint six-removal
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2020-08-15 07:45:23 +00:00
Stephen Finucane 7e4d8afb95 virt: Add 'context', drop 'network_info' parameters for 'unrescue'
In a future change, we'll want access to this so that it's possible to
retrieve vTPM data during the unrescue operation. While we're here, it
seems nothing is using the 'network_info' argument anymore, presumably
since the demise of nova-network, and this can and should be dropped.
Resolve both issues in one go, adding the 'context' parameter, dropping
the 'network_info' one, and updating the various callers and tests for
same.

Maintainers of out-of-tree drivers have been notified of these changes
[1].

[1] http://lists.openstack.org/pipermail/openstack-discuss/2020-July/015824.html

Part of blueprint add-emulated-virtual-tpm

Change-Id: Id5e4b0f26d5a2a93db6a7d96555a2cff29d9a2cf
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-07-08 11:56:01 +01:00
Zuul 8988316b8c Merge "Remove inject_file from compute manager and virt driver" 2020-06-02 16:06:16 +00:00
Stephen Finucane 21fecc7060 trivial: Remove log translations
We neither need nor want these translated so remove them. A couple of
logs with unnecessary brackets or weird indentation were identified in
the process, and these are also modified. Note that exceptions must
still be translated. Refer to [1] for more details.

[1] https://docs.openstack.org/oslo.i18n/latest/user/guidelines.html

Change-Id: I4573a7c5f3a7b5716a15fbd15ad9336807843a03
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-05-27 09:40:47 +00:00
Balazs Gibizer 2e7acc3249 Remove inject_file from compute manager and virt driver
The inject_file call was removed from the compute RPC at 3.18.
As we have RCP 5.x now it is safe to remove the manager method
handing that call. This removes the last user of the inject_file virt
diver method so that is deleted too.

Change-Id: If257fa301e8c12bb0c5e4d396ccc2c7277b25233
2020-05-22 11:48:04 +02:00
Sylvain Bauza 580eedbe2d Pass allocations to virt drivers when resizing
Some features like vGPUs require to have allocations to be checked locally
by the virt driver but resize (and cold migrate) was not passing them.

This change just gives the allocations to the target node when the resize
is done by adding the allocations to the finish_migration() interface.

Related-Bug: #1778563
Change-Id: Ifd76289964d513e9544544e5787f5f8999589475
2020-04-10 12:49:16 +02:00
Lee Yarwood d6e47ee0c3 virt: Provide block_device_info during rescue
This change adds block_device_info as an argument to the rescue method
signature for all virt divers currently implementing instance rescue.
This will allow future changes to provide all disks during a stable
device rescue attempt.

Change-Id: I9c2d9013d741774e521021913ec04f37b310e9d4
2020-04-09 08:39:35 +01:00
Sundar Nadathur f002274c6a Enable and use COMPUTE_ACCELERATORS trait.
For description, see https://review.opendev.org/#/c/698961.

Change-Id: I324adf88e54ce09c13ca2dbe638905769806d81b
Blueprint: nova-cyborg-interaction
2020-03-27 22:42:37 -07:00
Sundar Nadathur 536d42d807 Enable start/stop of instances with accelerators.
. Do not delete accelerator requests in stop code paths.
. In the start code path, get the list of accelerator requests from
  Cyborg in the compute manager 'power_on'.
. Pass accel_info (said list) to the virt driver power_on.
. In libvirt driver, pass that accel_info to driver power_on.

Change-Id: I8c94504b87aa4450d163fe2b33f6aa0eb5dae5ff
Blueprint: nova-cyborg-interaction
2020-03-24 22:44:26 -07:00
Sundar Nadathur b5527c07fb Enable hard/soft reboot with accelerators.
Blueprint: nova-cyborg-interaction
Change-Id: Ibf9cca80e34c573a6dcc77dd88514bfa673a0b42
2020-03-24 22:44:26 -07:00
Sundar Nadathur 1ff60fa52d Pass accelerator requests to each virt driver from compute manager.
Update the signature of the spawn() API for each virt driver
to include accel_info, which is a list of accelerator requests.

Change-Id: I4aac66c125a162bf35991a7d0c2638c7475ec0e7
Blueprint: nova-cyborg-interaction
2020-03-21 12:03:38 -07:00
Stephen Finucane 5fc3b81fdf Remove 'nova.image.api' module
This doesn't exist for 'nova.volume' and no longer exists for
'nova.network'. There's only one image backend we support, so do like
we've done elsewhere and just use 'nova.image.glance'.

Change-Id: I7ca7d8a92dfbc7c8d0ee2f9e660eabaa7e220e2a
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-02-18 11:45:39 +00:00
Zuul 35b2952a7d Merge "Add missing parameter vdi_uuid in log message" 2020-01-10 01:16:07 +00:00
Stephen Finucane 9b321e41f6 nova-net: Remove firewall support (pt. 3)
Firewall support is not needed with neutron, which supports both
security groups for per-port filtering and FWaaS for per-network
filtering. Remove both the generic firewalls and the hypervisor-specific
implementations.

This part focuses on removing the firewall drivers themselves, which are
now unused. It also updates the release note to note the two additional
config options that are removed here, '[DEFAULT] firewall_driver' and
'[DEFAULT] allow_same_net_traffic'.

Change-Id: I2dccf1610d6cbbb076fda393f1ef695d0be84b13
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-01-08 13:53:00 +00:00
Zuul d4a0f69e61 Merge "nova-net: Remove firewall support (pt. 2)" 2020-01-08 01:55:20 +00:00
Stephen Finucane 30141e6b52 nova-net: Remove firewall support (pt. 2)
Firewall support is not needed with neutron, which supports both
security groups for per-port filtering and FWaaS for per-network
filtering. Remove both the generic firewalls and the hypervisor-specific
implementations.

This change focuses on removing the firewall-related API calls from the
various virt drivers. The firewall drivers themselves are removed
separately.

Change-Id: I5a9e5532c46a5f7064441ae644125d21efe5fda1
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-01-06 12:46:30 +00:00
ericxiett e61cb24932 Report trait 'COMPUTE_IMAGE_TYPE_PLOOP'
This patch updates virt interface for reporting
trait 'COMPUTE_IMAGE_TYPE_PLOOP'.

Change-Id: Ifa2c3857725d64963aed2de7fac0b5b424665afe
Closes-Bug: #1854235
2020-01-06 12:32:42 +00:00
zhufl 2fd877310c Add missing parameter vdi_uuid in log message
This is to add missing parameter vdi_uuid in the log message.

Change-Id: If5a2e4245586c54cf575508ab2a5269bd205cb66
2020-01-03 17:09:21 +08:00
Stephen Finucane 295100c3fe xenapi: Remove vestigial nova-network support
I suspect there is more to be removed here, but this is all I could spot
for the moment.

Change-Id: Ifb8dc7de5d4845dd639fba71b853d38cdb851c7d
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-11-29 17:20:03 +00:00
Stephen Finucane f329ee5a3b Validate CPU config options against running instances
We want to make sure people who have both pinned and unpinned instances
on a host (yes, it's dumb, but it happens) won't do a straightforward
'vcpu_pin_set' -> '[compute] cpu_dedicated_set' or '[compute]
cpu_shared_set' transition, breaking their ability to restart or rebuild
instances. We add a new 'supports_pcpus' driver capability to avoid
needing to do this on drivers that don't support PCPUs and CPU pinning
in general.

Change-Id: Ia1b3ab0b66fdaf569f6c7a09510f208ee28725b2
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-09-18 00:19:33 +01:00
Matt Riedemann af280ffe30 Deprecate the XenAPIDriver
After three months since the quality warning change merged [1]
there has still been no progress in finding a maintainer for
the xenapi driver or someone to get the third party CI running
again - which has been off/broken for more than a release.

This change formally deprecates the driver, logging a warning
on startup along with providing a release note and warnings
in the docs and [xenserver] config group help.

Note that this does not mean the driver will absolutely be
removed in the Ussuri release, but it leaves the option open
to do so if the nova team decides that should happen.

This was discussed at the 2019-09-05 nova meeting [2] and
also at the Train PTG.

[1] I7f8eb7d5c5a9b1cb0a8d5e607d719b49a22675d3
[2] http://eavesdrop.openstack.org/meetings/nova/2019/nova.2019-09-05-14.01.log.html#l-227

Change-Id: Ie7e66ff64185d9fd4be2265e040e1afc45b95174
2019-09-06 11:36:22 -04:00
Takashi NATSUME 2311a194e1 Remove unused methods
The following methods have not been used any more
since the following change IDs or a commit.

* _add_vif_extension

  I56d859beb675199b209587bfe0a23cd9b75233ad

* _node_dict

  Ia76e41a8a3b7230701872ae7a1975edc3d9ea847

* _bdms_from_legacy and _bdms_to_legacy

  I01c108ceb539bb99491ed542c683e36fbf0c2bbe

* _create_block_device_mapping

  Ib0e0b708c46e4330e51f8f8fdfbb02d45aaf0f44

* _get_folder

  If734e22af223836b424561e8e9ca65e6c39fe5c2

* _details_map

  This method has not been used since the commit
  that added the method (initial commit).
  e7562217ed

Change-Id: Ica00c013961366d044f5a4ad3ed24568d60288b3
2019-09-04 15:26:59 +09:00
Matt Riedemann a958dc5fcc Add power_on kwarg to ComputeDriver.spawn() method
For a cross-cell resize, the equivalent of the "finish_resize"
method on the destination compute is going to call the
driver spawn() method rather than the finish_migration()
method and needs to pass through the power_on value, similar
to finish_migration, so that when resizing a stopped server
it remains stopped once it is resized.

The finish_migration method in the driver behaves very similar
to spawn so the semantics are the same.

This change updates the spawn method signature for all in-tree
compute drivers but only implements the logic for the libvirt
driver as that is the only driver (currently) which supports
cross-cell resize (note the can_connect_volume method is also
necessary for cross-cell resize implementation in the driver).

Part of blueprint cross-cell-resize

Change-Id: I6929c588dd2e0e805f2e30b2e30d29967469d756
2019-08-27 14:26:33 -04:00
Michael Still 54bf4694b9 Move iptables rule fetching and setting to privsep.
Rules are fetched, edited, and set. Keep the edit logic in nova/network,
but move the bits requiring elevated permissions to privsep.

Change-Id: I1f8382c450b95d261f68ec8bae2a2077f9361fe0
2019-08-16 11:24:07 +01:00
Zuul c92cb75675 Merge "Pass migration to finish_revert_migration()" 2019-08-06 22:01:18 +00:00
Stephen Finucane 97096c8e4a Remove 'nova.virt.driver.ComputeDriver.estimate_instance_overhead'
With the removal of the Core, Ram and Disk filters in change
I8a0d332877fbb9794700081e7954f2501b7e7c09, there's now only a single
caller for the 'estimate_instance_overhead' function. This call results
in the 'memory_mb_used', 'local_gb_used', 'vcpus_used', 'free_ram_mb'
and 'free_disk_gb' fields of a compute nodes 'ComputeNode' object being
modified when calculating usage as part of the resource tracker to
include driver-specific overhead. However, these fields are no longer
used for for anything except logging and the 'os-hypervisors' API. Since
overhead is not reflected in placement (and therefore the scheduler),
reporting them as part of the various usage values for both logging and
that API is actually a bit of a lie and is likely to cause confusion
among users. Remove the whole thing and make our logs and the
'os-hypervisors' API better match what's stored in placement.

Change-Id: I033e8269194de54432079cbc970431e3dcea7ce5
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-07-24 16:26:01 +01:00
Artom Lifshitz 78a08d44ea Pass migration to finish_revert_migration()
In order to obtain plug-time events, the libvirt driver needs to pass
a Migration object to the network model. Previously [1], this object
was obtained with a database lookup. This was done to avoid modifying
the virt driver interface, thus making the fix backportable. This
patch makes the compute manager pass the migration object to the virt
driver in order to avoid a needless database query.

[1] https://review.opendev.org/#/c/667177/

Change-Id: I9095c1be65b127d40f5bbe7af5d63fefedb73d33
2019-07-22 16:53:27 -04:00
Zuul 3dd8b9ac5b Merge "xenapi: implement update_provider_tree" 2019-07-09 17:12:48 +00:00
Matt Riedemann 154334b4b2 xenapi: implement update_provider_tree
This replaces get_inventory with update_provider_tree
in the xenapi driver. Since the driver is not reporting
traits there is nothing to do with traits in upt. The
VCPU, MEMORY_MB, DISK_GB and VGPU inventory is reported
the same as before, i.e. no support for nested providers
or reshaping allocations. The only additional change is
the need to provide the allocation_ratio and reserved
inventory values for VCPU, MEMORY_MB and DISK_GB since
ResourceTracker._normalize_inventory_from_cn_obj is not
called when the driver implements update_provider_tree.

Change-Id: Ie7bc0b3d3c3d5b1cdea124f6415aa0e87ac8b757
2019-06-25 14:32:01 -04:00
Stephen Finucane dc6fc82c14 hacking: Resolve W605 (invalid escape sequence)
This one's actually important since it will be an error in future
versions of Python.

Change-Id: Ib9f735216773224f91ac7f49fbe2eee119670872
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-06-24 14:24:06 -05:00
Stephen Finucane 231908a7f4 hacking: Resolve W503 (line break occurred before a binary operator)
Change-Id: I6381365ff882cf23808e8dabfce41143c5e35192
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-06-24 14:24:06 -05:00
Eric Fried b4c03e325b Remove nova.compute.*API() shims
When we had cellsv1, we had two different sets of
[Host|InstanceAction|ComputeCells]API. Now that cellsv1 is gone, we only
need nova.compute.api.API, .HostAPI, and .InstanceActionAPI. This patch
removes the dynamic loader shims from nova/compute/__init__.py and swaps
out all references to directly access the classes in nova.compute.api.

Note that there are a couple of ways we could have done this. One way
would have been to replace

  from nova import compute

with

  from nova.compute import api

and then change

  self.compute_api = compute.API()

to

  self.compute_api = api.API()

However, the current approach was preferred because
- smaller delta
- the code reads better as compute.API(), which is more important than
  the import being pretty

cleanup for blueprint remove-cells-v1

Change-Id: I84d9692efa3a131d6392dbd1011dfc43e4ac0b53
2019-06-12 16:09:46 +01:00
Matt Riedemann 92c7e0e0b4 xenapi: log quality warning in init_host
The xenapi driver has not had working third party CI
for several months. As a result, this change logs a
warning on startup of the service in the init_host
method indicating the lack of testing and the possibility
that the driver may be deprecated in the future if the
situation does not change.

This was discussed at the 2019-05-30 nova meeting [1] and
also at the Train PTG.

[1] http://eavesdrop.openstack.org/meetings/nova/2019/nova.2019-05-30-14.00.log.html

Change-Id: I7f8eb7d5c5a9b1cb0a8d5e607d719b49a22675d3
2019-05-30 14:57:01 -04:00
Dan Smith 4ed3ea509c Add xenapi driver image type capabilities
This is a static list, so a test is fairly pointless.

Related to blueprint bp/request-filter-image-types

Change-Id: Ic946b56906a3cc88fa9ebd042f56f0f81e3bcb84
2019-05-07 07:40:06 -07:00
Zuul e6f82ce599 Merge "xenapi/agent: Change openssl error handling" 2019-04-28 03:51:05 +00:00
Corey Bryant 1da71fa4ab xenapi/agent: Change openssl error handling
Prior to this patch, if the openssl command returned a zero exit code
and wrote details to stderr, nova would raise a RuntimeError exception.
This patch changes the behavior to only raise a RuntimeError exception
when openssl returns a non-zero exit code. Regardless of the exit code
a warning will always be logged with stderr details if stderr is not
None. Note that processutils.execute will now raise a
processutils.ProcessExecutionError exception for any non-zero exit code
since we are passing check_exit_code=True, which we convert to a
Runtime error.

Thanks to Dimitri John Ledkov <xnox@ubuntu.com> and Eric Fried
<openstack@fried.cc> for helping with this patch.

Change-Id: I212ac2b5ccd93e00adb7b9fe102fcb70857c6073
Partial-Bug: #1771506
2019-04-05 12:48:59 -04:00
Stephen Finucane ec09c06c5a trivial: Remove unused constants, functions
Change-Id: I5943cce6434ece0c6152caf8e097486064296032
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-04-03 13:37:29 +00:00
Zuul 96983e38a5 Merge "ironic: check fresh data when sync_power_state doesn't line up" 2019-03-02 02:36:41 +00:00
Jim Rollenhagen 19cb828023 ironic: check fresh data when sync_power_state doesn't line up
We return cached data to sync_power_state to avoid pummeling the ironic
API. However, this can lead to a race condition where an instance is
powered on, but nova thinks it should be off and calls stop(). Check
again without the cache when this happens to make sure we don't
unnecessarily kill an instance.

Closes-Bug: #1815791
Change-Id: I907b69eb689cf6c169a4869cfc7889308ca419d5
2019-03-01 12:13:28 -05:00
Chris Dent 27617ee193 Switch to using os-resource-classes
With the extraction of placement we ended up with resource class names
being duplicated between nova and placement. To address that, the
os-resource-classes library [1] was created to provide a single
authority for standard resource classes and the format of custom
classes.

This patch changes nova to use it, removing the use of the rc_fields
module which used to have the information. A method left in it
(normalize_name) has been moved to utils.py, renamed as
normalize_rc_name, and callers and tests updated accordingly.

Because the placement code is being kept in nova for the time being,
that code's use of rc_fields is maintained, and the module too.
A note is added in the module explain that. Backporting the changes
from extracted-placement to placement-in-nova was considered but
because we no longer have placement tests in nova, that didn't seem
like the right thing to do.

requirements and lower-constraints have been updated.
os-resource-classes is already in global requirements.

For reference the related placement change is at [2].

[1] https://docs.openstack.org/os-resource-classes
[2] https://review.openstack.org/#/c/623556/

Change-Id: I8e579920c0eaca81b563a87429c930b21b3d4dc5
2019-02-07 11:11:09 +00:00
Michael Still 38343cb1b2 Remove utils.execute() calls from xenapi.
They do not please me.

Change-Id: Ibe2f478288db42f8168b52dfc14d85ab92ace74b
2018-12-04 16:04:30 +11:00
Zuul 8446a1e58d Merge "Add I/O Semaphore to limit concurrent disk ops" 2018-11-30 03:25:18 +00:00
zhufl 8545ba2af7 Add missing ws seperator between words
This is to add missing ws seperator between words, usually
in log messages.

Change-Id: I71bf4c5b5be4dbc89a28bf243b7d11cf1d612ab4
2018-11-26 23:42:18 +00:00
Jack Ding 728f20e8f4 Add I/O Semaphore to limit concurrent disk ops
Introduce an I/O semaphore to limit the number of concurrent
disk-IO-intensive operations. This could reduce disk contention from
image operations like image download, image format conversion, snapshot
extraction, etc.

The new config option max_concurrent_disk_ops can be set in nova.conf
per compute host and would be virt-driver-agnostic. It is default to 0
which means no limit.

blueprint: io-semaphore-for-concurrent-disk-ops
Change-Id: I897999e8a4601694213f068367eae9608cdc7bbb
Signed-off-by: Jack Ding <jack.ding@windriver.com>
2018-11-21 15:57:11 -05:00
Zuul 08e46f8904 Merge "XenAPI/Stops the migration of volume backed VHDS" 2018-09-20 19:25:57 +00:00
Chen a09ba76fe7 Use six.string_types to improve python2/3 compatibility
Change-Id: I336525cf1c49692b1bbd58e42c94dd1670cd071e
2018-09-07 17:05:24 +08:00
Matthew Edmonds d7ed9a550b Make Xen code py3-compatible
A couple places in the Xen code have been using syntax that is
python2-specific. This replaces those instances with code that will
work in both python2 and python3.

PEP 3108 [1] moves urllib.urlopen to urllib.request.urlopen. The six
module is used in order to work in both python2 and python3 [2].

PEP 3110 [3] changed the grammar for except clauses, such that the
'as' keyword is now required in place of a comma when specifying an
exception variable.

[1] https://www.python.org/dev/peps/pep-3108/
[2] https://pythonhosted.org/six/#module-six.moves.urllib.request
[3] https://www.python.org/dev/peps/pep-3110/

Change-Id: I1235d767718a4207f4cef3e5b140319d003ad7b0
2018-08-10 20:04:19 +00:00
Zuul 24bd27fcfd Merge "Rename recreate to evacuate in driver signatures" 2018-07-21 23:19:40 +00:00
Zuul 46bfd6f1c2 Merge "xenapi: drop deprecated vif_driver config option" 2018-06-26 16:14:54 +00:00