Commit Graph

26 Commits

Author SHA1 Message Date
Nobuhiro MIKI 2fd034ec48 libvirt: Add 'COMPUTE_ADDRESS_SPACE_*' traits support
Based on the Libvirt and QEMU versions, two traits,
COMPUTE_ADDRESS_SPACE_PASSTHROUGH and COMPUTE_ADDRESS_SPACE_EMULATED,
are controlled. Since the two are supported from the same version on
the Libvirt and QEMU, Nova handles them in the same way.

Blueprint: libvirt-maxphysaddr-support
Depends-On: https://review.opendev.org/c/openstack/os-traits/+/871226
Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
Change-Id: If6c7169b7b8f43ad15a8992831824fb546e85aab
2023-07-24 17:09:19 +09:00
Rajesh Tailor 2521810e55 Fix typos
This change fixes some of the typos in unit tests as well
as in nova code-base.

Change-Id: I209bbb270baf889fcb2b9a4d1ce0ab4a962d0d0e
2022-05-30 17:40:00 +05:30
Dmitrii Shcherbakov d1e9ecb443 Add supports_remote_managed_ports capability
In order to support remote-managed ports the following is needed:

* Nova compute driver needs to support this feature;
* For the Libvirt compute driver, a given host needs to have the right
  version of Libvirt - the one which supports PCI VPD (7.9.0
  https://libvirt.org/news.html#v7-9-0-2021-11-01).

Therefore, this change introduces a new capability to track driver
support for remote-managed ports.

Change-Id: I7ea96fd85d2607e0af0f6918b0b45c58e8bec058
2022-02-09 01:23:27 +03:00
Takashi Natsume 383e2a8bdc Remove six.text_type (1/2)
Replace six.text_type with str.
A subsequent patch will replace other six.text_type.

Change-Id: I23bb9e539d08f5c6202909054c2dd49b6c7a7a0e
Implements: blueprint six-removal
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2020-12-13 11:25:31 +00:00
Takashi Natsume 1d0a0e8c20 Remove six.moves
Replace the following items with Python 3 style code.

- six.moves.configparser
- six.moves.StringIO
- six.moves.cStringIO
- six.moves.urllib
- six.moves.builtins
- six.moves.range
- six.moves.xmlrpc_client
- six.moves.http_client
- six.moves.http_cookies
- six.moves.queue
- six.moves.zip
- six.moves.reload_module
- six.StringIO
- six.BytesIO

Subsequent patches will replace other six usages.

Change-Id: Ib2c406327fef2fb4868d8050fc476a7d17706e23
Implements: blueprint six-removal
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2020-11-07 03:25:02 +00:00
Balazs Gibizer 450213f1f0 Clean up the DynamicVendorData constructor
There are a bunch of unused parameters in DynamicVendorData constructor
and a comment that they cannot be removed due to JsonFileVendorData. But
JsonFileVendorData does not depends on those paramters and both the
base class and JsonFileVendorData uses *args **kwargs. So it is safe to
remove the unused params.

The context field of DynamicVendorData is also removed as it is unused.
This makes the request_context parameter of the InstanceMeta
constructor also unused so that is removed.

Change-Id: Ie27fd6a5513e53903b9acd5d63038b3b484acbde
2020-10-12 08:25:32 +00: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
jichenjc 560987f920 set default value to 0 instead of ''
hypervisor_version of z/VM driver returned '' but
in fact it is defined as fields.IntegerField() which
means it should be int value by default.

Closes-Bug: 1862750
Change-Id: Ib4f2ecbbb731943eda996d525ddaafd2260fd1a3
2020-02-11 10:01:37 +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
Stephen Finucane 846fc0a0b7 zvm: Remove vestigial nova-network support
Only one reference to worry about here. I imagine nova-network never
worked with this driver.

Change-Id: I149bd481cdd4fd4f2fa1e47339a83ea14e287a37
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-11-29 17:20:03 +00:00
Dong Ma a76a4dd227 ZVM: Implement update_provider_tree
This patch implements update_provider_tree() in the ZVMDriver

As in Train [1] nova deprecated support for compute drivers
that did not implement the update_provider_tree method.
And the compat code is now removed in [2].

[1] I1eae47bce08f6292d38e893a2122289bcd6f4b58
[2] Ib62ac0b692eb92a2ed364ec9f486ded05def39ad

Change-Id: I76192a4c8adb192b12c0ceb71bf5f5a318018b87
2019-11-21 15:37:54 +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 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
Dan Smith 8eb53f5b5c Add zvm 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: I0b6fd6c9bcc95582718355019e467f6d6cc1c8a4
2019-05-07 07:40:06 -07:00
Stephen Finucane 6a4e1d4b5b zvm: Remove dead code
Looks like these two functions have never been used within the nova
codebase.

Change-Id: Icf48ffa61323fb54a73a62d2003ddfea217949e9
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-04-03 11:27:35 +01:00
Zuul a5e3054e1d Merge "Share snapshot image membership with instance owner" 2019-03-12 18:43:12 +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
Matt Riedemann 35cc0f5e94 Share snapshot image membership with instance owner
When an admin creates a snapshot of another project owners
instance, either via the createImage API directly, or via the
shelve or createBackup APIs, the admin project is the owner
of the image and the owner of the instance (in another project)
cannot "see" the image. This is a problem, for example, if an
admin shelves a tenant user's server and then the user tries to
unshelve the server because the user will not have access to
get the shelved snapshot image.

This change fixes the problem by leveraging the sharing feature [1]
in the v2 image API. When a snapshot is created where the request
context project_id does not match the owner of the instance project_id,
the instance owner project_id is granted sharing access to the image.
By default, this means the instance owner (tenant user) can get the
image directly via the image ID if they know it, but otherwise the image
is not listed for the user to avoid spamming their image listing. In the
case of unshelve, the end user does not need to know the image ID since
it is stored in the instance system_metadata. Regardless, the user could
accept the pending image membership if they want to see the snapshot
show up when listing available images.

Note that while the non-admin project has access to the snapshot
image, they cannot delete it. For example, if the user tries to
delete or unshelve a shelved offloaded server, nova will try to
delete the snapshot image which will fail and log a warning since
the user does not own the image (the admin does). However, the
delete/unshelve operations will not fail because the image cannot
be deleted, which is an acceptable trade-off.

Due to some very old legacy virt driver code which started in the
libvirt driver and was copied to several other drivers, several virt
drivers had to be modified to not overwrite the "visibility=shared"
image property by passing "is_public=False" when uploading the image
data. There was no point in the virt drivers setting is_public=False
since the API already controls that. It does mean, however, that
the bug fix is not really in effect until both the API and compute
service code has this fix.

A functional test is added which depends on tracking the owner/member
values in the _FakeImageService fixture. Impacted unit tests are
updated accordingly.

[1] https://developer.openstack.org/api-ref/image/v2/index.html#sharing

Change-Id: If53bc8fa8ab4a8a9072061af7afed53fc12c97a5
Closes-Bug: #1675791
2019-02-08 18:06:27 -05:00
zhufl 7b8dd39985 Fix missing print format error
Missing print format will cause 'ValueError: unsupported
format character' error, this is to fix it.

Change-Id: I1a18a6357056a3a7bfa729b9fccb288437564937
2018-07-20 16:29:53 +08:00
Huang Rui 50906f150f z/VM Driver: add get console output
Implement get_console_output for zvm virt driver.

Change-Id: I2158d34a87ca9104076bd234134aa4cab9c4e882
blueprint: add-zvm-driver-rocky
2018-07-16 11:35:11 +08:00
Huang Rui cc06ee1766 z/VM Driver: add power actions
Implement power_on, power_off, pause, unpause and reboot methods for
zvm virt driver.

Change-Id: I4199ec0e52ef2c9bd1cce2c8bc30097aaa5d7b82
blueprint: add-zvm-driver-rocky
2018-07-16 11:35:11 +08:00
nafei yang c50a39f8c8 z/VM Driver: add snapshot function
This patch add snapshot function to z/VM driver, it will call
underlying zvmsdk to generate the image

Change-Id: I0409aba55487e92efa6370eed41936bf8a4ef25d
blueprint: add-zvm-driver-rocky
2018-07-16 11:35:11 +08:00
PanYaLian 3e1692b966 z/VM Driver: Spawn and destroy function of z/VM driver
It includes two main function, Spawn is used to deploy an
instance on the z/VM, and destroy is used to delete the instance

Change-Id: Ie3db769c5e62353b2fa39c1a7e1f025171ff4a4a
blueprint: add-zvm-driver-rocky
2018-07-16 11:35:11 +08:00
Huang Rui e5acf4f961 z/VM Driver: Initial change set of z/VM driver
This is the first change that implements basic virt.driver methods
to allow nova-compute process start successfully.

A set of subsequent changes will implement spawn, snapshot, destroy
and instance power actions.

Change-Id: Ica6117c2c64f7518b78b7fb02487622250638e88
blueprint: add-zvm-driver-rocky
2018-07-16 11:35:10 +08:00