Commit Graph

57400 Commits

Author SHA1 Message Date
Stephen Finucane 72cf37bca0 utils: Move 'get_bdm_image_metadata' to nova.block_device
The 'nova.block_device' module is essentially a catchall utils-like
module for all things BDM. The 'get_bdm_image_metadata' module, and
closely related 'get_image_metadata_from_volume' both fall into the
category of functions that belong here so move them. This allows us to
clean up tests and, crucially, avoid a circular reference seen when we
want to use proper type hints in the 'nova.virt.driver' module.

  nova.context imports...
  nova.utils, which imports...
  nova.block_device, which imports...
  nova.virt.driver, which tries to import...
  nova.context, causing a circular dependency

Change-Id: I48177d6e93f2ff132d26b53cd682fd24a43a4b31
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-07-08 11:56:01 +01:00
Zuul bc784a1c1f Merge "Add traits for new AVX512 CPU feature" 2020-07-07 02:11:34 +00:00
Zuul 19dffce56e Merge "Fix mock for 'autospec' and 'new' together" 2020-07-06 21:36:45 +00:00
Zuul d3903547b5 Merge "catch libvirt exception when nodedev not found." 2020-07-06 17:48:09 +00:00
Lin Yang 8fa83ff62a Add traits for new AVX512 CPU feature
To support new AVX512 cpu feature, this patch adds the mapping
between cpu features reported by libvirt [1] and corresponding
os-traits [2]. The traits include 'AVX512VBMI', 'AVX512IFMA',
'AVX512VBMI2', 'AVX512BITALG', 'AVX512VAES', 'AVX512GFNI',
'AVX512VPCLMULQDQ' and 'AVX512VPOPCNTDQ'.

[1] https://github.com/libvirt/libvirt/blob/master/src/cpu_map/x86_features.xml
[2] https://review.opendev.org/#/c/728576/

Depends-On: I58cba02f204d2e19a1a838852c628694edd47d73
Change-Id: I212a84e5cae15bc133aafd538d55f85149ab360f
2020-07-06 16:30:43 +00:00
Ghanshyam Mann 2ee9ad2516 Fix mock for 'autospec' and 'new' together
mock does not accept 'autospec' and 'new' attributes
together to create mock object for tests. If autospec
is True the mock object is created using create_autospec()
and pass the keyword args to called function.

If both are passed then it start failing with oslotest 4.4.0
which is migrated to unittest.mock.
- https://d088a63e8edc60022939-485bd9eedc766dc9e54cbbb4001038bd.ssl.cf5.rackcdn.com/739330/1/check/cross-nova-py36/843ec44/testr_results.html

Creating mock with autospec only to fix this test to make
nova pass for oslo 4.4.0 so that requirement
can constraint oslotest to 4.4.0 (needed-by patch).

Change-Id: I9d6d97563114380f9a7549f08cede4b808352a3e
Needed-By: https://review.opendev.org/#/c/739531/
2020-07-06 16:11:15 +00:00
Zuul bcd94d1f7e Merge "libvirt: ensure disk_over_commit is not negative" 2020-07-06 13:14:37 +00:00
Sean Mooney af80c3ffd1 catch libvirt exception when nodedev not found.
This is a minimal fix to workaround instance where libvirt
retruns stale data due to internal caching. In some cases
libivrt can return stale data vai the nodedev api when the
mac adress of an interface such as an sriov virtual function
canages, i.e. when a mac adress is reset after a vm with
a virtual funciton is migrated.

Change-Id: Ic5e60c8e28263365fad5867e483b6ad55cee7281
Partial-Bug: #1883671
2020-07-06 12:28:45 +00:00
Zuul 24223ce1cb Merge "Snapshot: offload glance upload in a native thread" 2020-07-06 10:19:16 +00:00
Zuul 43802e5170 Merge "Fix user creation with GRANT in MySQL 8.0(Ubuntu Focal)" 2020-07-02 18:40:46 +00:00
Zuul 1c102141db Merge "Fix cherry-pick check for merge patch" 2020-07-02 18:40:36 +00:00
Zuul 2a0cc70202 Merge "Limit the number of concurrent snapshots" 2020-07-01 21:56:24 +00:00
Zuul 8e2170d708 Merge "Prevent libvirt driver starting on non Linux platform" 2020-07-01 19:59:33 +00:00
Zuul 833eaff4d5 Merge "Extend is_ipv6_supported() to cover more error cases" 2020-07-01 15:47:28 +00:00
Zuul ecb9e4271e Merge "Correct reported system memory" 2020-07-01 15:47:11 +00:00
Ghanshyam Mann e0d541073d Fix user creation with GRANT in MySQL 8.0(Ubuntu Focal)
In Ubuntu Bionic (18.04) mysql 5.7 version used to create
the user implicitly when using using the GRANT.

Ubuntu Focal (20.04) has mysql 8.0 and with mysql 8.0 there
is no implicit user creation with GRANT. We need to
create the user first before using GRANT command.

Nova unit and functional tests job using tools/test-setup.sh
script start failing when running on Ubuntu Focal

https://zuul.opendev.org/t/openstack/build/8b0f4fcc21854655a638c413b6fe1a91

Error log:
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 4: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to use near
'identified by 'openstack_citest' WITH GRANT OPTION' at line 2

Story: #2007865
Task: #40200

Change-Id: I97b0dcbb88c6ef7c22e3c55970211bed792bbd0d
Closes-Bug: #1885825
2020-06-30 21:21:39 -05:00
Alexandre Arents be9b735847 Snapshot: offload glance upload in a native thread
Execute glance upload in a native thread as it may block the current
coroutine until it completes.

Despite the fact we use eventlet monkey_patching [1] to achieve cooperative
yielding for network IO, file IO on busy file system may still get
nova-compute hanging.

Stick those IO in a native thread using eventlet tpool.execute() [2]
avoid this issue.

[1] https://eventlet.net/doc/patching.html
[2] https://eventlet.net/doc/threading.html

Closes-Bug: #1874032
Change-Id: I8dbc579e0037969aab4f2bb500fccfbde4190726
2020-06-30 07:21:02 +00:00
Alexandre Arents 6bb0c4fdab Limit the number of concurrent snapshots
This change introduces new [DEFAULT]/max_concurrent_snapshots parameter
in order to limit by default compute resource overuse related
to snapshot.

Implements: blueprint max-concurrent-snapshots

Change-Id: I40b8caf06ed525e97e871cf381776164208461fb
2020-06-30 06:02:05 +00:00
Zuul d4c857dfcb Merge "objects: Add MigrationTypeField" 2020-06-29 17:38:07 +00:00
Balazs Gibizer 01e3c8778d Extend is_ipv6_supported() to cover more error cases
It seems that with certain host configuration the ipv6 wsgi tests are
failing as the test only skipped if no ipv6 interface is available but
it does not check if the test will be able to bind to a port on that
interface. So this patch extends the skip criteria by checking if
binding is possible.

Change-Id: Iffea0586f02e8d4020cadc8c513bafe984e07a6e
Closes-Bug: #1883885
2020-06-29 15:13:55 +02:00
Zuul d4d8ea1da3 Merge "hardware: Rework 'get_realtime_constraint'" 2020-06-27 08:57:32 +00:00
Zuul 279aa24b54 Merge "Fix aggregate placement sync issue" 2020-06-27 05:31:10 +00:00
Zuul c6d6907651 Merge "Delete resource provider in tree by top-down traversable order" 2020-06-26 19:40:40 +00:00
Elod Illes c7c48c6f52 Fix cherry-pick check for merge patch
Cherry-pick check script validates the proposed patch's commit message.
If a patch is not on top of the given branch then Zuul rebases it to
the top and the patch becomes a merge patch. In this case the script
validates the merge patch's commit message instead of the original
patch's commit message and fails.

This fix selects the parent of the patch if it is a merge patch.

Change-Id: I8e4e5afc773d53dee9c1c24951bb07a45ddc2f1a
2020-06-26 20:31:20 +02:00
Zuul f644da10b2 Merge "Update interop repo link" 2020-06-26 17:40:35 +00:00
Zuul 4ae5b61c4f Merge "Make libvirt able to trigger a backend image copy when needed" 2020-06-26 13:42:26 +00:00
Zuul 6f62db9462 Merge "hardware: Remove handling of pre-Train compute nodes" 2020-06-26 13:12:21 +00:00
Zuul 7c8c6b809d Merge "hardware: Don't consider overhead CPUs for unpinned instances" 2020-06-26 13:12:14 +00:00
Zuul d7f9862427 Merge "libvirt: Remove workaround for unsupported libvirt version" 2020-06-26 08:53:43 +00:00
Zuul 7f4d59a674 Merge "Remove deprecated nova.image.download hook" 2020-06-26 08:53:36 +00:00
Zuul b1f4b303f7 Merge "Raise InstanceMappingNotFound if StaleDataError is encountered" 2020-06-26 03:32:14 +00:00
Zuul bbb8e3a17c Merge "Plumb image import functionality through our glance module" 2020-06-25 23:23:27 +00:00
Zuul db916926e5 Merge "Remove lxml deprecated methods" 2020-06-25 14:08:42 +00:00
Balazs Gibizer 68a5531568 Prevent libvirt driver starting on non Linux platform
The libvirt driver reads under /proc and /sys and depends on os.stat to
detect if two directories are on the same device. So the driver is
heavily Linux dependent. This patch makes sure that the nova-compute
service refuse to start with the libvirt driver on a non Linux platform.

Change-Id: I29c5a678efec4fbc4bd7958ebe6d454ae30701cd
2020-06-25 13:20:24 +01:00
Stephen Finucane e567adf7f6 Correct reported system memory
In Python 3.3+, 'sys.platform' no longer includes a major version [1]:

  issue 12326: On Linux, sys.platform doesn't contain the major version
  anymore. It is now always 'linux', instead of 'linux2' or 'linux3'
  depending on the Linux version used to build Python. Replace
  sys.platform == 'linux2' with sys.platform.startswith('linux'), or
  directly sys.platform == 'linux' if you don't need to support older
  Python versions.

Since we only care about Python 3.6 or greater, we could simply check
for 'linux'. However, the libvirt driver isn't supported on non-Linux
hosts so this was always a dumb check. Simply remove it instead.

[1] https://docs.python.org/3.3/whatsnew/3.3.html#porting-python-code

Change-Id: I207a6c8c8cf562477792c69e353ba99b3ec4cb5e
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-Bug: #1882233
2020-06-25 13:19:32 +01:00
Dan Smith 2fbe8e02d5 Remove deprecated nova.image.download hook
In Queens we deprecated the nova.image.download hook, which provided a
mechanism to inject custom code into the download path of our glance
module. This can now be removed.

The one known potential user of this is was a direct-rbd download
proposal, which needs further modification of the base glance client
in order to work. Thus, this removes the hook point, but not the
config option to allow specifying location schemes that should be
considered direct by the glance module. This provides a path forward
to integrate the direct-rbd code as a proper feature to our glance
module, which will mean un-deprecating that config option, but also
providing a stable list of potential options for it.

Change-Id: I7463af2ba9b74a73ffbb0a6b5fa12dff3fa5cac6
2020-06-25 08:03:31 +00:00
Zuul 6bc1352744 Merge "objects: Replace 'cpu_pinning_requested' helper" 2020-06-25 01:20:22 +00:00
melanie witt 16df22dcd5 Raise InstanceMappingNotFound if StaleDataError is encountered
We have a race where if a user issues a delete request while an
instance is in the middle of booting, we could fail to update the
'queued_for_delete' field on the instance mapping with:

  sqlalchemy.orm.exc.StaleDataError: UPDATE statement on table
  'instance_mappings' expected to update 1 row(s); 0 were matched.

This happens if we've retrieved the instance mapping record from the
database and then it gets deleted by nova-conductor before we attempt
to save() it.

This handles the situation by adding try-except around the update call
to catch StaleDataError and raise InstanceMappingNotFound instead,
which the caller does know how to handle.

Closes-Bug: #1882608

Change-Id: I2cdcad7226312ed81f4242c8d9ac919715524b48
2020-06-24 20:29:44 +00:00
Dan Smith 07025abf72 Make libvirt able to trigger a backend image copy when needed
This teaches libvirt's RBD image backend about the outside world, that
other ceph clusters may exist, and how to use Glance's multi-store image
import-via-copy mechanism.

The basic theory is that when we go to do the normal CoW clone for RBD,
we do the "does this image have a location that matches my RBD backend?"
check. If that check does not pass, if configured, we avoid failing
and ask Glance to copy it to our store instead. After that has completed,
we just recurse (once) and re-try our existing logic to see if the image
is now in a reachable location. If so, we pass like we would have
originally, and if not, we fail in the same way we would have.

The copy-to-store logic sets up a looping poll to check for copy completion
every N seconds according to a tunable, with a total timeout value in
case it never completes. If the timeout expires or Glance reports failure,
we will treat that the same as unreachable-due-to-location.

Related to blueprint rbd-glance-multistore

Change-Id: Ia839ad418b0f2887cb8e8f5ee3e660a0751db9ce
2020-06-24 07:37:51 -07:00
Dan Smith 4a6a366b05 Plumb image import functionality through our glance module
This just provides minimal support for calling the import API in Glance.
That API can do more things, but it is unlikely Nova would ever need to
call them, so this is rather opinionated and could be extended later if
needed.

Related to blueprint rbd-glance-multistore

Change-Id: Icf78fcabad8b966b6b5c289e1b660c01c928272d
2020-06-24 07:37:51 -07:00
Zuul 1cae0cd722 Merge "tests: Split instance NUMA object tests" 2020-06-24 03:16:28 +00:00
Zuul 13fd3e323e Merge "hardware: Add validation for 'cpu_realtime_mask'" 2020-06-24 03:16:21 +00:00
Zuul 9cdf90add4 Merge "libvirt: Add typing information" 2020-06-24 03:01:54 +00:00
Zuul 1c3dd7ce0a Merge "hardware: Update and correct typing information" 2020-06-24 03:01:42 +00:00
Zuul 173b4bed77 Merge "Guard against missing image cache directory" 2020-06-24 02:27:15 +00:00
Zuul f612fbf088 Merge "Cap jsonschema 3.2.0 as the minimal version" 2020-06-24 01:54:33 +00:00
Hervé Beraud 385df41b70 Remove lxml deprecated methods
All our supported runtimes [1] are compatible with the recommended
alternatives.

The `getchildren` method is deprecated [2] since lxml 2.0 and will be removed
in future versions, these changes switch usages to `list(elem)` as
recommended in the official documentation [2].

[1] https://governance.openstack.org/tc/reference/runtimes/victoria.html#python-runtimes-for-train
[2] https://lxml.de/api/lxml.etree._Element-class.html#getchildren

Change-Id: Ibdc54cdc62d84ea98d4f21bb3698e6726e56365a
2020-06-23 13:26:20 +02:00
songwenping a45daafd31 Delete resource provider in tree by top-down traversable order
When delete nova service by "nova service-delete <id>", this will delete the
compute node's resource provider in Placement. But if there are child resource
provider, Placement will throw exception(CannotDeleteParentResourceProvider)
and don't delete the resource provider. When we add the host service again,
Placement cannot insert new compute node resource provider, and we cannot use
the compute node any more. So we should delete sub resource provider in tree
when delete resource provider.

Modify unit test.

Change-Id: Ide8732be6c047ad1b141b89df676783b2fa2f25a
Closes-Bug: #1872385
2020-06-23 07:20:29 +00:00
Balazs Gibizer a85753778f Guard against missing image cache directory
The original fix of bug 1878024 missed an edge case where on a fresh
hypervisor the image cache directory hasn't been created yet. That
directory is only created when the first image is downloaded.

This patch makes sure that if the cache dir hasn't been created yet then
0 disk is reserved for the cache usage instead of raising and logging an
exception.

Change-Id: Id1bbc955a9099de1abc11b9063fe177896646d03
Related-Bug: #1878024
Closes-Bug: #1884214
2020-06-22 17:44:09 +02:00
Zuul f1ebc15dfc Merge "Remove hooks" 2020-06-21 06:46:45 +00:00