diff options
author | Stephen Finucane <stephenfin@redhat.com> | 2020-11-16 17:35:07 +0000 |
---|---|---|
committer | Stephen Finucane <stephenfin@redhat.com> | 2020-11-19 15:19:55 +0000 |
commit | eaecd1ceb0243b31cde9b3c909e8fb3fbef7e635 (patch) | |
tree | d2628e8d7fafc22b530a34cb41b0cd2d1817baa6 | |
parent | 60071a2c83ad1d7ed6fd50f8af0bb4d92aa84bea (diff) | |
download | nova-eaecd1ceb0243b31cde9b3c909e8fb3fbef7e635.tar.gz |
Add missing exception
Change Idd49b0c70caedfcd42420ffa2ac926a6087d406e added support for
discovery of PMEM devices by the libvirt driver. Some error handling
code in this was expected to raise a 'GetPMEMNamespacesFailed'
exception, however, a typo meant the exception was actually called
'GetPMEMNamespaceFailed' (singular). This exception was later removed in
change I6fd027fb51823b8a8a24ed7b864a2191c4e8e8c0 because it had no
references.
Re-introduce the exception, this time with the correct name, and add
some unit tests to prevent us regressing.
Conflicts:
nova/exception.py
NOTE(stephenfin): Conflicts are because change
I6fd027fb51823b8a8a24ed7b864a2191c4e8e8c0 doesn't exist on this branch,
meaning the misnamed exception still exists and simply needs to be
renamed.
Change-Id: I3b597a46314a1b29a952fc0f7a9c4537341e37b8
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-Bug: #1904446
(cherry picked from commit 160ed6ff652b80cd0a86d41dc3f66c15cee66290)
(cherry picked from commit 82d415d200e39a5c11fe134e9ef62e427988f2ba)
(cherry picked from commit 8f65de96a07623c6a8a9cd49db942ad6d4d3ab03)
-rw-r--r-- | nova/exception.py | 2 | ||||
-rw-r--r-- | nova/tests/unit/virt/libvirt/test_driver.py | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/nova/exception.py b/nova/exception.py index 7a5c523933..3971ef9c44 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -2541,7 +2541,7 @@ class PMEMNamespaceConfigInvalid(NovaException): "please check your conf file. ") -class GetPMEMNamespaceFailed(NovaException): +class GetPMEMNamespacesFailed(NovaException): msg_fmt = _("Get PMEM namespaces on host failed: %(reason)s.") diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index 3b131f4da7..adef6c4c6f 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -25471,6 +25471,15 @@ class LibvirtPMEMNamespaceTests(test.NoDBTestCase): self.assertRaises(exception.PMEMNamespaceConfigInvalid, drvr._discover_vpmems, vpmem_conf) + @mock.patch('nova.privsep.libvirt.get_pmem_namespaces') + def test_get_vpmems_on_host__exception(self, mock_get_ns): + drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True) + mock_get_ns.side_effect = Exception('foo') + + self.assertRaises( + exception.GetPMEMNamespacesFailed, + drvr._get_vpmems_on_host) + @mock.patch('nova.virt.hardware.get_vpmems') def test_get_ordered_vpmems(self, mock_labels): # get orgered vpmems based on flavor extra_specs |