Browse Source

Merge "Add missing exception" into stable/ussuri

changes/70/765770/3
Zuul 6 days ago
committed by Gerrit Code Review
parent
commit
6b951f9b4d
2 changed files with 13 additions and 0 deletions
  1. +4
    -0
      nova/exception.py
  2. +9
    -0
      nova/tests/unit/virt/libvirt/test_driver.py

+ 4
- 0
nova/exception.py View File

@ -2299,6 +2299,10 @@ class PMEMNamespaceConfigInvalid(NovaException):
"please check your conf file. ")
class GetPMEMNamespacesFailed(NovaException):
msg_fmt = _("Get PMEM namespaces on host failed: %(reason)s.")
class VPMEMCleanupFailed(NovaException):
msg_fmt = _("Failed to clean up the vpmem backend device %(dev)s: "
"%(error)s")


+ 9
- 0
nova/tests/unit/virt/libvirt/test_driver.py View File

@ -26808,6 +26808,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


Loading…
Cancel
Save