diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 68cf726d26de..d48ab8d0890b 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -1207,7 +1207,7 @@ class ServersController(wsgi.Controller): 'trigger_crash_dump', id) except (exception.InstanceNotReady, exception.InstanceIsLocked) as e: raise webob.exc.HTTPConflict(explanation=e.format_message()) - except exception.NMINotSupported as e: + except exception.TriggerCrashDumpNotSupported as e: raise webob.exc.HTTPBadRequest(explanation=e.format_message()) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 47cf2c869d6c..1c4c21148948 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -2589,20 +2589,20 @@ class ComputeManager(manager.Manager): self._notify_about_instance_usage(context, instance, "power_on.end") @messaging.expected_exceptions(NotImplementedError, - exception.NMINotSupported, + exception.TriggerCrashDumpNotSupported, exception.InstanceNotRunning) @wrap_exception() @wrap_instance_event @wrap_instance_fault def trigger_crash_dump(self, context, instance): - """Trigger crash dump in an instance by injecting NMI.""" + """Trigger crash dump in an instance.""" self._notify_about_instance_usage(context, instance, "trigger_crash_dump.start") # This method does not change task_state and power_state because the - # effect of an NMI depends on user's configuration. - self.driver.inject_nmi(instance) + # effect of a trigger depends on user's configuration. + self.driver.trigger_crash_dump(instance) self._notify_about_instance_usage(context, instance, "trigger_crash_dump.end") diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py index af4125247edf..0f8950cf6513 100644 --- a/nova/compute/rpcapi.py +++ b/nova/compute/rpcapi.py @@ -1059,7 +1059,7 @@ class ComputeAPI(object): version = '4.6' if not self.client.can_send_version(version): - raise exception.NMINotSupported() + raise exception.TriggerCrashDumpNotSupported() cctxt = self.client.prepare(server=_compute_host(None, instance), version=version) diff --git a/nova/exception.py b/nova/exception.py index d0c182ce90d0..f16769de0ad5 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -2077,8 +2077,8 @@ class UEFINotSupported(Invalid): msg_fmt = _("UEFI is not supported") -class NMINotSupported(Invalid): - msg_fmt = _("Injecting NMI is not supported") +class TriggerCrashDumpNotSupported(Invalid): + msg_fmt = _("Triggering crash dump is not supported") class UnsupportedHostCPUControlPolicy(Invalid): diff --git a/nova/tests/unit/api/openstack/compute/test_serversV21.py b/nova/tests/unit/api/openstack/compute/test_serversV21.py index f4318588cd96..b85d1ea263fe 100644 --- a/nova/tests/unit/api/openstack/compute/test_serversV21.py +++ b/nova/tests/unit/api/openstack/compute/test_serversV21.py @@ -2136,7 +2136,7 @@ class ServersControllerTriggerCrashDumpTest(ControllerTest): self.req, FAKE_UUID, body=self.body) @mock.patch.object(compute_api.API, 'trigger_crash_dump', - side_effect=exception.NMINotSupported) + side_effect=exception.TriggerCrashDumpNotSupported) def test_trigger_crash_dump_not_supported(self, mock_trigger_crash_dump): self.assertRaises(webob.exc.HTTPBadRequest, self.controller._action_trigger_crash_dump, diff --git a/nova/tests/unit/compute/test_rpcapi.py b/nova/tests/unit/compute/test_rpcapi.py index ff3f0f239536..a3b3f369d0df 100644 --- a/nova/tests/unit/compute/test_rpcapi.py +++ b/nova/tests/unit/compute/test_rpcapi.py @@ -554,7 +554,7 @@ class ComputeRpcAPITestCase(test.NoDBTestCase): def test_trigger_crash_dump_incompatible(self): self.flags(compute='4.0', group='upgrade_levels') - self.assertRaises(exception.NMINotSupported, + self.assertRaises(exception.TriggerCrashDumpNotSupported, self._test_compute_api, 'trigger_crash_dump', 'cast', instance=self.fake_instance_obj, version='4.6') diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index ee2e7197dc61..37f65e72b974 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -15553,15 +15553,15 @@ class LibvirtDriverTestCase(test.NoDBTestCase): cpumodel.POLICY_FORBID]), set([f.policy for f in cpu.features])) - def test_inject_nmi(self): + def test_trigger_crash_dump(self): mock_guest = mock.Mock(libvirt_guest.Guest, id=1) instance = objects.Instance(uuid='fake-uuid', id=1) with mock.patch.object(self.drvr._host, 'get_guest', return_value=mock_guest): - self.drvr.inject_nmi(instance) + self.drvr.trigger_crash_dump(instance) - def test_inject_nmi_not_running(self): + def test_trigger_crash_dump_not_running(self): ex = fakelibvirt.make_libvirtError( fakelibvirt.libvirtError, 'Requested operation is not valid: domain is not running', @@ -15574,9 +15574,9 @@ class LibvirtDriverTestCase(test.NoDBTestCase): with mock.patch.object(self.drvr._host, 'get_guest', return_value=mock_guest): self.assertRaises(exception.InstanceNotRunning, - self.drvr.inject_nmi, instance) + self.drvr.trigger_crash_dump, instance) - def test_inject_nmi_not_supported(self): + def test_trigger_crash_dump_not_supported(self): ex = fakelibvirt.make_libvirtError( fakelibvirt.libvirtError, '', @@ -15588,10 +15588,10 @@ class LibvirtDriverTestCase(test.NoDBTestCase): with mock.patch.object(self.drvr._host, 'get_guest', return_value=mock_guest): - self.assertRaises(exception.NMINotSupported, - self.drvr.inject_nmi, instance) + self.assertRaises(exception.TriggerCrashDumpNotSupported, + self.drvr.trigger_crash_dump, instance) - def test_inject_nmi_unexpected_error(self): + def test_trigger_crash_dump_unexpected_error(self): ex = fakelibvirt.make_libvirtError( fakelibvirt.libvirtError, 'UnexpectedError', @@ -15604,7 +15604,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase): with mock.patch.object(self.drvr._host, 'get_guest', return_value=mock_guest): self.assertRaises(fakelibvirt.libvirtError, - self.drvr.inject_nmi, instance) + self.drvr.trigger_crash_dump, instance) class LibvirtVolumeUsageTestCase(test.NoDBTestCase): diff --git a/nova/tests/unit/virt/test_virt_drivers.py b/nova/tests/unit/virt/test_virt_drivers.py index 519c42a6ba80..8840a04cb936 100644 --- a/nova/tests/unit/virt/test_virt_drivers.py +++ b/nova/tests/unit/virt/test_virt_drivers.py @@ -395,9 +395,9 @@ class _VirtDriverTestCase(_FakeDriverBackendTestCase): self.connection.power_on(self.ctxt, instance_ref, network_info, None) @catch_notimplementederror - def test_inject_nmi(self): + def test_trigger_crash_dump(self): instance_ref, network_info = self._get_running_instance() - self.connection.inject_nmi(instance_ref) + self.connection.trigger_crash_dump(instance_ref) @catch_notimplementederror def test_soft_delete(self): diff --git a/nova/virt/driver.py b/nova/virt/driver.py index 6d5090e3e8e1..0412ec1fdc16 100644 --- a/nova/virt/driver.py +++ b/nova/virt/driver.py @@ -740,14 +740,14 @@ class ComputeDriver(object): """ raise NotImplementedError() - def inject_nmi(self, instance): - """Inject an non-maskable interruption (NMI) into the given instance. + def trigger_crash_dump(self, instance): + """Trigger crash dump mechanism on the given instance. Stalling instances can be triggered to dump the crash data. How the guest OS reacts in details, depends on the configuration of it. :param nova.objects.instance.Instance instance: - The instance where the NMI should be injected to. + The instance where the crash dump should be triggered. :return: None """ diff --git a/nova/virt/fake.py b/nova/virt/fake.py index 5b305492e7b7..4435590b07ff 100644 --- a/nova/virt/fake.py +++ b/nova/virt/fake.py @@ -240,7 +240,7 @@ class FakeDriver(driver.ComputeDriver): block_device_info=None): pass - def inject_nmi(self, instance): + def trigger_crash_dump(self, instance): pass def soft_delete(self, instance): diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 99d305b927b7..d808b7017ad3 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -2609,16 +2609,16 @@ class LibvirtDriver(driver.ComputeDriver): # and available before we attempt to start the instance. self._hard_reboot(context, instance, network_info, block_device_info) - def inject_nmi(self, instance): + def trigger_crash_dump(self, instance): - """Inject an NMI to the specified instance.""" + """Trigger crash dump by injecting an NMI to the specified instance.""" try: self._host.get_guest(instance).inject_nmi() except libvirt.libvirtError as ex: error_code = ex.get_error_code() if error_code == libvirt.VIR_ERR_NO_SUPPORT: - raise exception.NMINotSupported() + raise exception.TriggerCrashDumpNotSupported() elif error_code == libvirt.VIR_ERR_OPERATION_INVALID: raise exception.InstanceNotRunning(instance_id=instance.uuid)