Merge "Replaces InitiateSystemShutdownW"
This commit is contained in:
commit
83743c7f5c
@ -311,9 +311,9 @@ class WindowsUtils(base.BaseOSUtils):
|
||||
|
||||
def reboot(self):
|
||||
with privilege.acquire_privilege(win32security.SE_SHUTDOWN_NAME):
|
||||
ret_val = advapi32.InitiateSystemShutdownW(
|
||||
ret_val = advapi32.InitiateSystemShutdownExW(
|
||||
0, "Cloudbase-Init reboot",
|
||||
0, True, True)
|
||||
0, True, True, 0)
|
||||
if not ret_val:
|
||||
raise exception.WindowsCloudbaseInitException(
|
||||
"Reboot failed: %r")
|
||||
|
@ -101,7 +101,7 @@ class TestWindowsUtils(testutils.CloudbaseInitTestBase):
|
||||
expected_ret_value=None):
|
||||
mock_privilege_module.acquire_privilege = mock.MagicMock()
|
||||
advapi32 = self._windll_mock.advapi32
|
||||
advapi32.InitiateSystemShutdownW = mock.MagicMock(
|
||||
advapi32.InitiateSystemShutdownExW = mock.MagicMock(
|
||||
return_value=ret_value)
|
||||
|
||||
if not ret_value:
|
||||
@ -111,10 +111,10 @@ class TestWindowsUtils(testutils.CloudbaseInitTestBase):
|
||||
else:
|
||||
self._winutils.reboot()
|
||||
|
||||
advapi32.InitiateSystemShutdownW.assert_called_with(
|
||||
advapi32.InitiateSystemShutdownExW.assert_called_with(
|
||||
0,
|
||||
"Cloudbase-Init reboot",
|
||||
0, True, True)
|
||||
0, True, True, 0)
|
||||
mock_privilege_module.acquire_privilege.assert_called_once_with(
|
||||
self._win32security_mock.SE_SHUTDOWN_NAME)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user