Redefine libvirt domain on Restart

Ensures changes to the domain take effect (required when
disable_power_off=True in ironic node)

Change-Id: Ia5df946eb6015dcf5b82f09d8ea532fcd9978ff7
This commit is contained in:
Derek Higgins
2025-03-04 10:45:51 +00:00
parent 8f5b808cf1
commit 64348a6598
2 changed files with 4 additions and 2 deletions

View File

@@ -306,7 +306,8 @@ class LibvirtDriver(AbstractSystemsDriver):
domain.reboot()
elif state == 'ForceRestart':
if domain.isActive():
domain.reset()
domain.destroy()
domain.create()
elif state == 'Nmi':
if domain.isActive():
domain.injectNMI()

View File

@@ -152,7 +152,8 @@ class LibvirtDriverTestCase(base.BaseTestCase):
self.test_driver.set_power_state(self.uuid, 'ForceRestart')
domain_mock.reset.assert_called_once_with()
domain_mock.destroy.assert_called_once_with()
domain_mock.create.assert_called_once_with()
@mock.patch('libvirt.open', autospec=True)
def test_set_power_state_nmi(self, libvirt_mock):