Summary
A customer has requested that the reset command check whether the host is a Xen guest before proceeding.
Request
Add a check_xen_hvm() helper to tt_smi/tt_smi_utils.py that detects if the system is running as a Xen guest by reading /sys/hypervisor/type. The check should only verify hypervisor_type == "xen" (the HVM guest type condition is not needed). The function should then be called in the reset command flow in tt_smi/tt_smi.py to block the reset when running on Xen.
Proposed implementation
def check_xen_hvm() -> bool:
"""Check if the system is a Xen guest"""
is_xen = False
try:
with open("/sys/hypervisor/type", "r") as f:
hypervisor_type = f.read().strip()
if hypervisor_type == "xen":
is_xen = True
except FileNotFoundError:
pass
except OSError:
pass
# All other types of errors should throw an exception
return is_xen
Files to change
tt_smi/tt_smi_utils.py — add check_xen_hvm()
tt_smi/tt_smi.py — import and call it in the reset command path (around line 769)
Summary
A customer has requested that the reset command check whether the host is a Xen guest before proceeding.
Request
Add a
check_xen_hvm()helper tott_smi/tt_smi_utils.pythat detects if the system is running as a Xen guest by reading/sys/hypervisor/type. The check should only verifyhypervisor_type == "xen"(the HVM guest type condition is not needed). The function should then be called in the reset command flow intt_smi/tt_smi.pyto block the reset when running on Xen.Proposed implementation
Files to change
tt_smi/tt_smi_utils.py— addcheck_xen_hvm()tt_smi/tt_smi.py— import and call it in the reset command path (around line 769)