mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-12-09 05:52:05 +00:00
misc: life_mngr: refine lifecycle manager for windows VM
Refine lifecycle manager for windows VM since new commands are introduced in the lifecycle manager. v1-->v2: Implement socket service to receive system shutdown request command through local host socket. Add one python script to trigger system shutdown request in windows VM. v2-->v3: Update log message. v3-->v4: Support guest shutdown. v4-->v5: Update command name. v5-->v7: Add resend message logic. Tracked-On: #6652 Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com> Reviewed-by: fei1.li@intel.com
This commit is contained in:
37
misc/services/life_mngr/s5_trigger_win.py
Normal file
37
misc/services/life_mngr/s5_trigger_win.py
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (C) 2021 Intel Corporation.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
import socket
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
HOST = '127.0.0.1'
|
||||
PORT = 8193
|
||||
SHUTDOWN_REQ = 'req_sys_shutdown'
|
||||
MSG_LEN = 32
|
||||
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
print(["Socket Created"])
|
||||
|
||||
try:
|
||||
s.connect((HOST,PORT))
|
||||
print("[Connection established]")
|
||||
except Exception:
|
||||
print('[Connection error: ' + HOST + ":" + str(PORT)+']')
|
||||
s.close()
|
||||
|
||||
try:
|
||||
s.send(SHUTDOWN_REQ.encode('utf-8'))
|
||||
except Exception as _:
|
||||
raise _
|
||||
print(["Shutdown request sent\n"])
|
||||
|
||||
try:
|
||||
data_input = (s.recv(MSG_LEN).decode("UTF-8"))
|
||||
except Exception:
|
||||
pass
|
||||
print("Waiting for ACK message...: ", data_input)
|
||||
s.close()
|
||||
Reference in New Issue
Block a user