@@ -14823,7 +14823,7 @@ def test_private_destroy_processes_refused_to_die_still_raises(self):
14823
14823
instance)
14824
14824
14825
14825
def test_private_destroy_ebusy_timeout(self):
14826
- # Tests that _destroy will retry 3 times to destroy the guest when an
14826
+ # Tests that _destroy will retry 6 times to destroy the guest when an
14827
14827
# EBUSY is raised, but eventually times out and raises the libvirtError
14828
14828
ex = fakelibvirt.make_libvirtError(
14829
14829
fakelibvirt.libvirtError,
@@ -14843,7 +14843,7 @@ def test_private_destroy_ebusy_timeout(self):
14843
14843
self.assertRaises(fakelibvirt.libvirtError, drvr._destroy,
14844
14844
instance)
14845
14845
14846
- self.assertEqual(3 , mock_guest.poweroff.call_count)
14846
+ self.assertEqual(6 , mock_guest.poweroff.call_count)
14847
14847
14848
14848
def test_private_destroy_ebusy_multiple_attempt_ok(self):
14849
14849
# Tests that the _destroy attempt loop is broken when EBUSY is no
@@ -14869,6 +14869,37 @@ def test_private_destroy_ebusy_multiple_attempt_ok(self):
14869
14869
14870
14870
self.assertEqual(2, mock_guest.poweroff.call_count)
14871
14871
14872
+ @mock.patch.object(libvirt_driver.LOG, 'warning')
14873
+ @mock.patch.object(fakelibvirt.Connection, 'getLibVersion',
14874
+ return_value=versionutils.convert_version_to_int(
14875
+ libvirt_driver.MIN_LIBVIRT_BETTER_SIGKILL_HANDLING))
14876
+ def test_min_libvirt_better_sigkill_handling_warning(self,
14877
+ mock_warning,
14878
+ mock_get_libversion):
14879
+ ex = fakelibvirt.make_libvirtError(
14880
+ fakelibvirt.libvirtError,
14881
+ ("Failed to terminate process 26425 with SIGKILL: "
14882
+ "Device or resource busy"),
14883
+ error_code=fakelibvirt.VIR_ERR_SYSTEM_ERROR,
14884
+ int1=errno.EBUSY)
14885
+
14886
+ mock_guest = mock.Mock(libvirt_guest.Guest, id=1)
14887
+ mock_guest.poweroff = mock.Mock(side_effect=ex)
14888
+
14889
+ instance = objects.Instance(**self.test_instance)
14890
+ drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
14891
+
14892
+ with mock.patch.object(drvr._host, 'get_guest',
14893
+ return_value=mock_guest):
14894
+ raised = self.assertRaises(fakelibvirt.libvirtError,
14895
+ drvr._destroy,
14896
+ instance)
14897
+ self.assertEqual(fakelibvirt.VIR_ERR_SYSTEM_ERROR,
14898
+ raised.get_error_code())
14899
+
14900
+ mock_warning.assert_called_once()
14901
+ mock_guest.poweroff.assert_called_once()
14902
+
14872
14903
@mock.patch.object(fakelibvirt.libvirtError, 'get_error_code')
14873
14904
@mock.patch.object(host.Host, '_get_domain',
14874
14905
side_effect=exception.InstanceNotFound(
0 commit comments