[SWDEV-513807] Fix amd-smi partition --accelerator not returning AMDSMI_STATUS_NO_PERM (#192)
* [SWDEV-513807] Fix amd-smi partition --accelerator not returning AMDSMI_STATUS_NO_PERM Changes: - Fixed amdsmi_get_gpu_accelerator_partition_profile_config() from not returning AMDSMI_STATUS_NO_PERM - Changed amd-smi partition --accelerator to provide user with a warning if users does not use sudo or root permissions. - Updated changelog for fixes planned for 6.4.1 release Signed-off-by: Charis Poag <Charis.Poag@amd.com>
This commit is contained in:
@@ -5882,7 +5882,7 @@ class AMDSMICommands():
|
||||
tabular_output.append(tabular_output_dict)
|
||||
|
||||
self.logger.multiple_device_output = tabular_output
|
||||
self.logger.table_title = "\nCURRENT_PARTITION"
|
||||
self.logger.table_title = "CURRENT_PARTITION"
|
||||
self.logger.print_output(multiple_device_enabled=True, tabular=True, dynamic=True)
|
||||
self.logger.clear_multiple_devices_output()
|
||||
|
||||
@@ -6054,8 +6054,18 @@ class AMDSMICommands():
|
||||
|
||||
self.logger.multiple_device_output = tabular_output
|
||||
self.logger.table_title = "\nACCELERATOR_PARTITION_PROFILES"
|
||||
# only display warning message if not running as root or with sudo
|
||||
if os.geteuid() != 0:
|
||||
self.logger.warning_message = """
|
||||
***************************************************************************
|
||||
** WARNING: **
|
||||
** ACCELERATOR_PARTITION_PROFILES requires sudo/root permissions to run. **
|
||||
** Please run the command with sudo permissions to get accurate results. **
|
||||
***************************************************************************
|
||||
"""
|
||||
self.logger.print_output(multiple_device_enabled=True, tabular=True, dynamic=True)
|
||||
self.logger.clear_multiple_devices_output()
|
||||
self.logger.warning_message = "" # clear the warning message
|
||||
|
||||
#########################################
|
||||
# print accelerator partition resources #
|
||||
|
||||
@@ -40,6 +40,7 @@ class AMDSMILogger():
|
||||
self.table_header = ""
|
||||
self.secondary_table_title = ""
|
||||
self.secondary_table_header = ""
|
||||
self.warning_message = ""
|
||||
self.helpers = AMDSMIHelpers()
|
||||
|
||||
|
||||
@@ -827,6 +828,8 @@ class AMDSMILogger():
|
||||
primary_table_heading = ''
|
||||
if self.table_title:
|
||||
primary_table_heading = self.table_title + ':\n'
|
||||
if self.warning_message: # Add warning message below the table title
|
||||
primary_table_heading += self.warning_message + '\n'
|
||||
primary_table_heading += self.table_header + '\n'
|
||||
primary_table = primary_table_heading + primary_table
|
||||
|
||||
@@ -884,6 +887,8 @@ class AMDSMILogger():
|
||||
primary_table_heading = ''
|
||||
if self.table_title:
|
||||
primary_table_heading = self.table_title + ':\n'
|
||||
if self.warning_message: # Add warning message below the table title
|
||||
primary_table_heading += self.warning_message + '\n'
|
||||
primary_table_heading += self.table_header + '\n'
|
||||
primary_table = primary_table_heading + primary_table
|
||||
|
||||
|
||||
Reference in New Issue
Block a user