Adjusted private helper variables

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
Change-Id: I0590b9ee5a1b4d5e6d4ae71c9587550c8d95033b
Этот коммит содержится в:
Maisam Arif
2024-11-08 11:25:50 -06:00
родитель abee26d4ab
Коммит 5449d78cc4
+38 -35
Просмотреть файл
@@ -78,41 +78,6 @@ class AMDSMIHelpers():
self._is_passthrough = True
def os_info(self, string_format=True):
"""Return operating_system and type information ex. (Linux, Baremetal)
params:
string_format (bool) True to return in string format, False to return Tuple
returns:
str or (str, str)
"""
operating_system = ""
if self._is_linux:
operating_system = "Linux"
elif self._is_windows:
operating_system = "Windows"
else:
operating_system = "Unknown"
operating_system_type = ""
if self._is_baremetal:
operating_system_type = "Baremetal"
elif self._is_virtual_os:
operating_system_type = "Guest"
elif self._is_hypervisor:
operating_system_type = "Hypervisor"
else:
operating_system_type = "Unknown"
# Passthrough Override
if self._is_passthrough:
operating_system_type = "Guest (Passthrough)"
if string_format:
return f"{operating_system} {operating_system_type}"
return (operating_system, operating_system_type)
def is_virtual_os(self):
return self._is_virtual_os
@@ -126,6 +91,9 @@ class AMDSMIHelpers():
# Returns True if system is baremetal, if system is hypervisor this should return False
return self._is_baremetal
def is_passthrough(self):
return self._is_passthrough
def is_linux(self):
return self._is_linux
@@ -135,6 +103,41 @@ class AMDSMIHelpers():
return self._is_windows
def os_info(self, string_format=True):
"""Return operating_system and type information ex. (Linux, Baremetal)
params:
string_format (bool) True to return in string format, False to return Tuple
returns:
str or (str, str)
"""
operating_system = ""
if self.is_linux():
operating_system = "Linux"
elif self.is_windows():
operating_system = "Windows"
else:
operating_system = "Unknown"
operating_system_type = ""
if self.is_baremetal():
operating_system_type = "Baremetal"
elif self.is_virtual_os():
operating_system_type = "Guest"
elif self.is_hypervisor():
operating_system_type = "Hypervisor"
else:
operating_system_type = "Unknown"
# Passthrough Override
if self.is_passthrough():
operating_system_type = "Guest (Passthrough)"
if string_format:
return f"{operating_system} {operating_system_type}"
return (operating_system, operating_system_type)
def get_amdsmi_init_flag(self):
return AMDSMI_INIT_FLAG