Commit Graph

55215 Commits

Author SHA1 Message Date
Adam Spiers 84db8b3f3d Reject live migration and suspend on SEV guests
As per the spec[0], live migration and suspend are not (yet) supported
for SEV guests, so reject them at the API level with an HTTP
409 (Conflict).

[0] http://specs.openstack.org/openstack/nova-specs/specs/train/approved/amd-sev-libvirt-support.html#limitations

blueprint: amd-sev-libvirt-support
Change-Id: I69b6e153324a3e5680e096cd714e5d4dd05bae34
2019-09-10 13:59:02 +01:00
Boris Bobrov cedc850e4e Apply SEV-specific guest config when SEV is required
Add a new sev_enabled() function to the libvirt utils to detect that
SEV is required and return True if and only if the following are both
true:

  a) the supports_amd_sev instance variable in the host is
     true, *and*

  b) the instance extra specs and/or image properties request
     memory encryption to be enabled.

In this case we know that SEV functionality is required, so tweak the
guest config accordingly in various ways:

- Ensure that the machine type is some q35 variant.  If the image had
  an hw_machine_type property requesting some other type, an
  InvalidMachineType exception will be raised.

- Set the "iommu" attribute to "on" for all relevant devices including
  disk / network devices, but excluding input/graphics/video/serial
  devices.  This is achieved via a new set_driver_iommu_for_sev()
  method added to nova.virt.libvirt.designer.  In order to test this
  thoroughly, beef up the fake KVM guest fixture with extra devices
  of each type.

- Add the <launchSecurity> element to enable use of SEV.  Two related
  configuration values are extracted from domain capabilities and set
  on the element.

- Enable memory locking.  All the memory pages allocated by QEMU must
  be pinned for SEV, which is achieved via <memoryBacking> and <locked />
  elements.

blueprint: amd-sev-libvirt-support
Change-Id: Ie54fca066f3333d1d5d18a2c0e8f6c7d5042490b
2019-09-10 13:59:02 +01:00
Zuul 43afc0443c Merge "Don't duplicate PlacementFixture in libvirt func tests" 2019-09-09 22:25:45 +00:00
Zuul 8126ba54d1 Merge "Func test for migrate server with ports having resource request" 2019-09-09 20:12:25 +00:00
Zuul c1de64a657 Merge "prepare func test env for moving servers with bandwidth" 2019-09-09 19:21:07 +00:00
Zuul 56873d1258 Merge "resize: Add bw min service level check of source compute" 2019-09-09 19:20:59 +00:00
Zuul e01b628581 Merge "migrate: Add bw min service level check of source compute" 2019-09-09 19:10:08 +00:00
Zuul a0622ae883 Merge "Add min service level check for migrate with bandwidth" 2019-09-09 19:09:06 +00:00
Chris Dent 5e1b096894 Don't duplicate PlacementFixture in libvirt func tests
libvirt/base.py inherits from test_servers.ServersTestBase which
itself mixes in _IntegratedTestBase. _IntegratedTestBase starts
the PlacementFixture so we don't need to do so a second time.

If we do, then the things can get very weird during the test
cleanUp period with misleading exception and requests made to
placement when it seems like placement should already be gone
(because the inner fixture has alread been cleaned up, but not
the outer).

Change-Id: I057a07c8d0b880c8d09fc2e618ce1f7fc885beda
2019-09-09 17:23:39 +01:00
Takashi NATSUME b244a02730 doc: Fix a broken reference link
Fix a broken reference link in
contributor/testing/zero-downtime-upgrade.rst

Change-Id: I1c0054175f9d665fecd76a03466663177c49f774
Closes-Bug: #1842985
2019-09-09 07:58:38 +09:00
Zuul ba3147420c Merge "Fix rebuild of baremetal instance when vm_state is ERROR" 2019-09-07 23:08:19 +00:00
Zuul c51187ab5b Merge "Decouple NVMe tests from os-brick" 2019-09-07 12:23:15 +00:00
Zuul b879f1b6df Merge "Move get_machine_type() test to test_utils.py" 2019-09-07 08:55:08 +00:00
Zuul b96f932fdf Merge "Extract fake KVM guest fixture for reuse" 2019-09-07 08:54:59 +00:00
Zuul 0a8444e903 Merge "Ensure non-q35 machine type is not used when booting with SEV" 2019-09-07 08:54:50 +00:00
Zuul ade53dc9cd Merge "Fix incorrect invocation of openstacksdk's baremetal.nodes()" 2019-09-07 08:54:11 +00:00
Zuul 535af1ee12 Merge "Use fields="instance_uuid" when calling Ironic API" 2019-09-07 05:19:49 +00:00
Zuul c4555f34ad Merge "Remove old comments about caching scheduler compat" 2019-09-06 23:28:32 +00:00
Zuul e25f3e31c5 Merge "doc: cleanup references to conductor doc" 2019-09-06 22:53:59 +00:00
Mohammed Naser e840135a17 Decouple NVMe tests from os-brick
The existing tests for NVMe with Libvirt were using
APIs inside of os-brick rather than making sure that
we are calling os-brick with the right values.

This patch mocks up the factory function instead and
makes sure we call it with the right values, it also
adds a few more things to test if the root helper and
`device_scan_attempts` are passed down through to
os-brick as well.

Change-Id: I067f9e29b4db3bba0601041cf3603b9653a240b9
2019-09-06 21:53:53 +00:00
Zuul 31aa0c58c5 Merge "Bump min for oslo.service & .privsep to fix SIGHUP" 2019-09-06 19:34:16 +00:00
Zuul 840a556bd2 Merge "objects: Remove ConsoleAuthToken.to_dict" 2019-09-06 18:51:31 +00:00
Balazs Gibizer d2c4550a1e Func test for migrate server with ports having resource request
A new functional test proves that bandwidth allocation is made on the
destination host during the migration and the binding:profile of the
port is updated to point to the destination resource provider.

As a result, migrate_instance_finish has to be un-stubbed in the
NeutronFixture to update the port's binding profile.

blueprint: support-move-ops-with-qos-ports

Change-Id: Ia69dace6d3b395fa113c1382e8eb52c2cc36119d
2019-09-06 16:43:11 +02:00
Balazs Gibizer f55faf5fc3 prepare func test env for moving servers with bandwidth
To be able to test server move operations with ports having resource
request (e.g. bandwidth) we need a bit of work on the functional test
env to be able to create two computes with bandwidth resources.

blueprint: support-move-ops-with-qos-ports

Change-Id: I4ed0381ec3bbcc9c72a7d5c0e232ac7b44241205
2019-09-06 16:43:11 +02:00
Balazs Gibizer d19b8badbc resize: Add bw min service level check of source compute
During resize the RequestSpec goes from the dest compute to the
source compute and then back to the dest. The previous patch [1] added
service level check for the dest compute. However the source compute also
needs to be new enough so the RequestSpec is passed through it.

Please note that the functional coverage for this api change is in a
later patch [2].

[1] https://review.opendev.org/#/c/680394
[2] https://review.opendev.org/#/c/679019

blueprint: support-move-ops-with-qos-ports
Change-Id: Ib1a73f5e20b6f9a325d8b24d9253a18f2a46db1f
2019-09-06 16:42:41 +02:00
Balazs Gibizer a061b0ea2e migrate: Add bw min service level check of source compute
During cold migrate the RequestSpec goes from the dest compute to the
source compute and then back to the dest. The previous patch [1] added
service level check for the dest compute. However the source compute also
needs to be new enough so the RequestSpec is passed through it.

Please note that the functional coverage for this api change is in a
later patch [2].

[1] https://review.opendev.org/#/c/680394
[2] https://review.opendev.org/#/c/655113

blueprint: support-move-ops-with-qos-ports
Change-Id: I09cac780b9ee5b5726874d4e6f895fd0cd4bff8c
2019-09-06 16:41:52 +02:00
Balazs Gibizer d6795e1393 Add min service level check for migrate with bandwidth
During resize and cold migrate the dest compute service needs to update
the port binding based on the re-calculated port - resource provider mapping.
This update happens in finish_resize.

To do that the dest compute service needs to be at least on service level
39.

The calculation is based on the RequestSpec. The RequestSpec is sent
to the dest compute in pre_resize but the dest compute only sends it to the
source compute in resize_instance if the compute rpc api version is at least
5.2. Also the source compute only sends the RequestSpec to the dest
compute in the finish_resize if the rpc api version is at least 5.2. So
migration with bandwidth only works if both compute talks at least 5.2
which means that the min service level is at least 39.

Change-Id: Ia500b105b9ec70c0d8bd38faa084270b825476eb
blueprint: support-move-ops-with-qos-ports
2019-09-06 16:41:08 +02:00
Dmitry Tantsur 6bf0467303 Fix incorrect invocation of openstacksdk's baremetal.nodes()
This call accepts keyword arguments, not a dictionary. The dictionary
ends up passed into the 'details' argument, making it True, so the
query returns all nodes instead of just one. Fix it and raise an error
in case it ever repeats.

Closes-Bug: #1843050
Change-Id: If464423b3c5bc05e2b22ff2245828c677b264d15
2019-09-06 14:39:41 +00:00
Zuul a2b814619b Merge "update allocation in binding profile during migrate" 2019-09-06 10:20:57 +00:00
Zuul 965142459b Merge "Add delete_on_termination to volume-attach API" 2019-09-06 09:31:14 +00:00
Zuul 7020196aaa Merge "Handle VirtDriverNotReady in _cleanup_running_deleted_instances" 2019-09-06 01:39:22 +00:00
Dustin Cowles 19f01023c2 Use fields="instance_uuid" when calling Ironic API
IronicDriver should be using fields="instance_uuid" when calling Ironic
API via the OpenStack SDK, but instead is using fields="instance_id".
This patch corrects the calls and adds new tests to cover it.

Change-Id: I4b976b7ea60c63ec334b5eb78c1ad7972fbed574
Closes-Bug: #1842989
2019-09-05 16:51:36 -07:00
Eric Fried 73f1fda7e9 Bump min for oslo.service & .privsep to fix SIGHUP
The combined fixes for the two related bugs resolve the problem where
SIGHUP breaks the nova-compute service. Bump the minimum requirements
for oslo.privsep and oslo.service to make sure these fixes are in place,
and add a reno to advertise resolution of the issue.

This also bumps oslo.utils to match the lower constraint from
oslo.service.

Change-Id: I39ead744b21a4423352a88573f327273e4d09630
Related-Bug: #1794708
Related-Bug: #1715374
2019-09-05 18:16:43 -05:00
Matt Riedemann 37164b418e doc: cleanup references to conductor doc
The conductor doc is not really end user material,
so this moves it under reference/, removes it from the
user page and adds it to the reference index for internals.
Also makes the contributor page link to the reference internals
since it's kind of weird to have one contributor section that
only mentions one thing but the internals under reference have
a lot more of that kind of detail. Finally, a todo is added so
we don't forget to update the reference internals about versioned
objects at some point since that's always a point of confusion
for people.

Change-Id: I8d3dbce5334afaa3e1ca309b2669eff9933a0104
2019-09-05 18:37:31 -04:00
Matt Riedemann d11a335ea5 Remove old comments about caching scheduler compat
The CachingScheduler driver was removed in Stein [1] but
there are a couple of comments in the FilterScheduler
driver code that reference conditions from when the
CachingScheduler existed. This removes them to avoid
confusion.

[1] I1832da2190be5ef2b04953938860a56a43e8cddf

Change-Id: If71a7ac7a33dbc45f417368e3e705f444a3e5bd3
2019-09-05 17:20:49 -04:00
Zuul c84400f152 Merge "Trap and log errors from _update_inst_info_cache_for_disassociated_fip" 2019-09-05 21:08:37 +00:00
Adam Spiers 1e10f58eef Move get_machine_type() test to test_utils.py
SEV work uncovered that test_get_guest_config_machine_type_s390(), a
unit test for nova.virt.libvirt.utils.get_machine_type(), was
misplaced in test_driver.py, so move that to test_utils.py and in the
process extend it to test other architectures.

Also rename three related unit tests of the same get_machine_type()
for increased clarity.

Change-Id: Ib43f96445e7c13f4abc4522f1d3567a4a5499382
blueprint: amd-sev-libvirt-support
2019-09-05 22:03:34 +01:00
Adam Spiers dbbaf1a00a Extract fake KVM guest fixture for reuse
A future test in the SEV patch series will require a fake of a fully
configured KVM guest in order to test enabling of IOMMU for relevant
drivers.  So extract the fixture factory and the resulting XML out
into fake_libvirt_data.py where it can also be used by
libvirt/test_designer.py.

It is not sufficient to only extract the XML, because parts of the
config do not have parse_dom() implemented and therefore can only be
generated via code rather than by parsing the XML.

Change-Id: I6595d55823e15ef155f8303eb06676494dd0c661
blueprint: amd-sev-libvirt-support
2019-09-05 22:03:32 +01:00
Adam Spiers c1179d1ff2 Ensure non-q35 machine type is not used when booting with SEV
As explained in the SEV spec[0], SEV needs a q35 machine type in order
to bind all the virtio devices to the PCIe bridge so that they use
virtio 1.0 and not virtio 0.9, since QEMU's iommu_platform feature was
added in virtio 1.0 only.

So add an extra check to be run in the API layer whenever SEV is
requested, to ensure that a machine type *outside* the q35
family (e.g. 'pc', or something like 'pc-i440fx-2.11') is not
explicitly selected in the image via the hw_machine_type property.
Since code in the API layer doesn't run on the compute host, at this
stage we can't check CONF.libvirt.hw_machine_type via libvirt.utils.
A subsequent commit will change the libvirt driver to trigger an
extra, later check on the compute node, although if that late check
fails, the best we can do is to fail the operation on that compute
host, in which case it will potentially be retried on another compute
host.

nova's hardcoded default for x86_64 is 'pc' (which in fact matches
QEMU's current default).  This means that it will be recommended that
SEV-capable compute hosts have CONF.libvirt.hw_machine_type configured
to include 'x86_64=q35', otherwise attempts to boot SEV guests without
the image property 'hw_machine_type=q35' will fail unpleasantly.

In the future it is expected that both of these defaults will change
to 'q35'[1].  Once that happens, x86_64 images will be bootable
without needing to set either the hw_machine_type image property or
CONF.libvirt.hw_machine_type.

While extending the unit tests for invalid combinations of image
properties, add tests for the case where the 'hw_firmware_type'
property is not specified at all; previously the tests only covered
the case where it was set to 'bios'.

[0] http://specs.openstack.org/openstack/nova-specs/specs/train/approved/amd-sev-libvirt-support.html
[1] https://bugs.launchpad.net/nova/+bug/1780138

blueprint: amd-sev-libvirt-support
Change-Id: Ibf66a0b371685c673644493bf12663dbf71fab6c
2019-09-05 22:03:30 +01:00
Zuul 86b6906ff4 Merge "neutron: refactor nw info cache refresh out of associate_floating_ip" 2019-09-05 20:43:24 +00:00
Balazs Gibizer a2984b647a update allocation in binding profile during migrate
If the server has port with resource allocation and the server is
migrated then when the port is bound to the destination host the
allocation key needs to be updated in the binding:profile to point to
the resource provider that provides resources for this port on the
destination host.

This patch extends the migrate_instance_finish() network api method to
pass the updated resource providers of the ports during migration.

Change-Id: I220fa02ee916728e241503084b14984bab4b0c3b
blueprint: support-move-ops-with-qos-ports
2019-09-05 14:58:12 +02:00
zhangbailin e5b47543cf Add delete_on_termination to volume-attach API
Add the 'delete_on_termination' field to the volume attach API to support
configuring whether to delete the data volume when the instance is destroyed.

To avoid upgrade impact issues with older computes, the
'delete_on_termination' field is set in the API rather than when the BDM
is created in the compute service.

Implements: blueprint support-delete-on-termination-in-server-attach-volume
Change-Id: I55731b1822a4e32909665a2872d80895cb5b12f7
2019-09-05 20:54:56 +08:00
Zuul f7f5e1846c Merge "Add server sub-resource topology API" 2019-09-05 12:51:36 +00:00
Zuul 27925a0e22 Merge "Use microversion in put allocations in test_report_client" 2019-09-05 03:01:51 +00:00
Zuul 0568676132 Merge "Modernize nova-lvm job" 2019-09-04 20:43:02 +00:00
Zuul 85d21ad5e0 Merge "Convert nova-lvm job to zuul v3" 2019-09-04 20:08:05 +00:00
Zuul 2b2a5cedfc Merge "Remove unused methods" 2019-09-04 19:59:25 +00:00
Zuul b1de451629 Merge "unit test: do not fill rp mapping for failed re-schedule" 2019-09-04 15:58:15 +00:00
Zuul c34b783749 Merge "Refactor MigrationTask._execute" 2019-09-04 15:58:05 +00:00
Zuul b973d44f0e Merge "libvirt: Make scheduler filters customizable" 2019-09-04 14:34:50 +00:00