Temporarily comment out the operation of deleting the profile

Change-Id: If8e03826ad58cf5caa1d0c557f3a546e7ae4c3dc
This commit is contained in:
Jin Hase 2021-07-20 13:46:37 +09:00
parent 82b8e6da2e
commit 34ccd96c12
2 changed files with 68 additions and 56 deletions

View File

@ -672,8 +672,12 @@ def _process_session_data(irmc_info, operation, session_id,
if operation == 'CONFIG_RAID':
return result
elcm_profile_delete(irmc_info=irmc_info,
profile_name=PROFILE_BIOS_CONFIG)
# FIXME: Currently, creating a profile will restart the
# machine, which will cause an error during IPI installation,
# so temporarily comment out the operation of deleting the
# profile.
# elcm_profile_delete(irmc_info=irmc_info,
# profile_name=PROFILE_BIOS_CONFIG)
except scci.SCCIError as e:
result['warning'] = e
@ -712,31 +716,36 @@ def backup_bios_config(irmc_info):
'warning': <warning message if there is>
}
"""
result = {}
# 1. Make sure there is no BiosConfig profile in the store
try:
# Get the profile first, if not found, then an exception
# will be raised.
elcm_profile_get(irmc_info=irmc_info,
profile_name=PROFILE_BIOS_CONFIG)
result['bios_config'] = elcm_profile_get(
irmc_info=irmc_info,
profile_name=PROFILE_BIOS_CONFIG)
# FIXME: Currently, creating a profile will restart the machine,
# which will cause an error during IPI installation,
# so temporarily comment out the operation of deleting the profile.
# Profile found, delete it
elcm_profile_delete(irmc_info=irmc_info,
profile_name=PROFILE_BIOS_CONFIG)
# elcm_profile_delete(irmc_info=irmc_info,
# profile_name=PROFILE_BIOS_CONFIG)
except ELCMProfileNotFound:
# Ignore this error as it's not an error in this case
pass
# 2. Send request to create a new profile for BiosConfig
session = elcm_profile_create(irmc_info=irmc_info,
param_path=PARAM_PATH_BIOS_CONFIG)
# 2. Send request to create a new profile for BiosConfig
session = elcm_profile_create(irmc_info=irmc_info,
param_path=PARAM_PATH_BIOS_CONFIG)
# 3. Profile creation is in progress, we monitor the session
session_timeout = irmc_info.get('irmc_bios_session_timeout',
BIOS_CONFIG_SESSION_TIMEOUT)
return _process_session_data(
irmc_info=irmc_info,
operation='BACKUP_BIOS',
session_id=session['Session']['Id'],
session_timeout=session_timeout)
# 3. Profile creation is in progress, we monitor the session
session_timeout = irmc_info.get('irmc_bios_session_timeout',
BIOS_CONFIG_SESSION_TIMEOUT)
return _process_session_data(
irmc_info=irmc_info,
operation='BACKUP_BIOS',
session_id=session['Session']['Id'],
session_timeout=session_timeout)
return result
def restore_bios_config(irmc_info, bios_config):
@ -771,18 +780,21 @@ def restore_bios_config(irmc_info, bios_config):
# 1. Parse the bios config and create the input data
input_data = _process_bios_config()
# FIXME: Currently, creating a profile will restart the machine,
# which will cause an error during IPI installation,
# so temporarily comment out the operation of deleting the profile.
# 2. Make sure there is no BiosConfig profile in the store
try:
# Get the profile first, if not found, then an exception
# will be raised.
elcm_profile_get(irmc_info=irmc_info,
profile_name=PROFILE_BIOS_CONFIG)
# Profile found, delete it
elcm_profile_delete(irmc_info=irmc_info,
profile_name=PROFILE_BIOS_CONFIG)
except ELCMProfileNotFound:
# Ignore this error as it's not an error in this case
pass
# try:
# Get the profile first, if not found, then an exception
# will be raised.
# elcm_profile_get(irmc_info=irmc_info,
# profile_name=PROFILE_BIOS_CONFIG)
# Profile found, delete it
# elcm_profile_delete(irmc_info=irmc_info,
# profile_name=PROFILE_BIOS_CONFIG)
# except ELCMProfileNotFound:
# Ignore this error as it's not an error in this case
# pass
# 3. Send a request to apply the param values
session = elcm_profile_set(irmc_info=irmc_info,
@ -897,7 +909,7 @@ def _update_raid_input_data(target_raid_config, raid_input):
array_info['LogicalDrives']['LogicalDrive'].append(
{'@Action': 'Create',
'RaidLevel': logical_disk['raid_level'],
'InitMode': 'slow'})
'InitMode': 'fast'})
array_info['LogicalDrives']['LogicalDrive'][i].update({
"@Number": i})
@ -919,7 +931,7 @@ def _update_raid_input_data(target_raid_config, raid_input):
"ArrayRef": [
]
},
"InitMode": "slow"
"InitMode": "fast"
}
array_info['Arrays']['Array'].append(arrays)

View File

@ -852,7 +852,7 @@ class ELCMTestCase(testtools.TestCase):
self.assertEqual(2, mock_sleep.call_count)
self.assertEqual(1, mock_session_delete.call_count)
self.assertEqual(1, mock_profile_delete.call_count)
self.assertEqual(0, mock_profile_delete.call_count)
@mock.patch.object(elcm, 'elcm_profile_delete')
@mock.patch.object(elcm, 'elcm_profile_get')
@ -884,7 +884,7 @@ class ELCMTestCase(testtools.TestCase):
mock_profile_get.assert_not_called()
self.assertEqual(2, mock_sleep.call_count)
self.assertEqual(1, mock_session_delete.call_count)
self.assertEqual(1, mock_profile_delete.call_count)
self.assertEqual(0, mock_profile_delete.call_count)
@mock.patch.object(elcm, 'elcm_profile_delete')
@mock.patch.object(elcm, 'elcm_profile_get')
@ -971,12 +971,12 @@ class ELCMTestCase(testtools.TestCase):
result = elcm.backup_bios_config(irmc_info=self.irmc_info)
self.assertEqual(expected_bios_cfg, result['bios_config'])
self.assertEqual(2, mock_sleep.call_count)
self.assertEqual(True, mock_session_get.called)
self.assertEqual(1, mock_session_delete.call_count)
self.assertEqual(2, mock_profile_get.call_count)
self.assertEqual(1, mock_profile_create.call_count)
self.assertEqual(2, mock_profile_delete.call_count)
self.assertEqual(0, mock_sleep.call_count)
self.assertEqual(False, mock_session_get.called)
self.assertEqual(0, mock_session_delete.call_count)
self.assertEqual(1, mock_profile_get.call_count)
self.assertEqual(0, mock_profile_create.call_count)
self.assertEqual(0, mock_profile_delete.call_count)
@mock.patch.object(elcm, 'elcm_profile_delete')
@mock.patch.object(elcm, 'elcm_profile_get')
@ -1005,9 +1005,9 @@ class ELCMTestCase(testtools.TestCase):
self.assertEqual(2, mock_sleep.call_count)
self.assertEqual(True, mock_session_get.called)
self.assertEqual(1, mock_session_delete.call_count)
self.assertEqual(1, mock_profile_get.call_count)
self.assertEqual(0, mock_profile_get.call_count)
self.assertEqual(1, mock_profile_set.call_count)
self.assertEqual(2, mock_profile_delete.call_count)
self.assertEqual(0, mock_profile_delete.call_count)
def test_restore_bios_config_ok_with_dict(self):
bios_cfg = {
@ -1191,7 +1191,7 @@ class ELCMTestCase(testtools.TestCase):
'@Number': 0,
'@Action': 'Create',
'RaidLevel': '1',
'InitMode': 'slow',
'InitMode': 'fast',
'Size': {
'@Unit': 'GB',
'#text': 100
@ -1255,7 +1255,7 @@ class ELCMTestCase(testtools.TestCase):
'@Number': 0,
'@Action': 'Create',
'RaidLevel': '1',
'InitMode': 'slow',
'InitMode': 'fast',
'Size': {
'@Unit': 'GB',
'#text': 100
@ -1314,7 +1314,7 @@ class ELCMTestCase(testtools.TestCase):
'@Number': 0,
'@Action': 'Create',
'RaidLevel': '0',
'InitMode': 'slow',
'InitMode': 'fast',
'Size': {
'@Unit': 'GB',
'#text': 100
@ -1324,7 +1324,7 @@ class ELCMTestCase(testtools.TestCase):
'@Number': 1,
'@Action': 'Create',
'RaidLevel': '1',
'InitMode': 'slow',
'InitMode': 'fast',
'Size': {
'@Unit': 'GB',
'#text': 100
@ -1412,7 +1412,7 @@ class ELCMTestCase(testtools.TestCase):
'@Number': 0,
'@Action': 'Create',
'RaidLevel': '1',
'InitMode': 'slow',
'InitMode': 'fast',
'Size': {
'@Unit': 'GB',
'#text': 100
@ -1521,7 +1521,7 @@ class ELCMTestCase(testtools.TestCase):
'@Number': 0,
'@Action': 'Create',
'RaidLevel': '0',
'InitMode': 'slow',
'InitMode': 'fast',
'Size': {
'@Unit': 'GB',
'#text': 100
@ -1538,7 +1538,7 @@ class ELCMTestCase(testtools.TestCase):
'@Number': 1,
'@Action': 'Create',
'RaidLevel': '1',
'InitMode': 'slow',
'InitMode': 'fast',
'Size': {
'@Unit': 'GB',
'#text': 100
@ -1662,7 +1662,7 @@ class ELCMTestCase(testtools.TestCase):
'@Number': 0,
'@Action': 'Create',
'RaidLevel': '1',
'InitMode': 'slow',
'InitMode': 'fast',
'Size': {
'@Unit': 'GB',
'#text': 100
@ -1732,7 +1732,7 @@ class ELCMTestCase(testtools.TestCase):
'@Number': 0,
'@Action': 'Create',
'RaidLevel': '0',
'InitMode': 'slow'
'InitMode': 'fast'
}
]
}
@ -1809,7 +1809,7 @@ class ELCMTestCase(testtools.TestCase):
'@Number': 0,
'@Action': 'Create',
'RaidLevel': '0',
'InitMode': 'slow',
'InitMode': 'fast',
'Size': {
'@Unit': 'GB',
'#text': 100
@ -1820,7 +1820,7 @@ class ELCMTestCase(testtools.TestCase):
'@Number': 1,
'@Action': 'Create',
'RaidLevel': '1',
'InitMode': 'slow',
'InitMode': 'fast',
'Size': {
'@Unit': 'GB',
'#text': 100
@ -1904,7 +1904,7 @@ class ELCMTestCase(testtools.TestCase):
'@Number': 0,
'@Action': 'Create',
'RaidLevel': '10',
'InitMode': 'slow',
'InitMode': 'fast',
'Size': {
'@Unit': 'GB',
'#text': 100
@ -1974,7 +1974,7 @@ class ELCMTestCase(testtools.TestCase):
'@Number': 0,
'@Action': 'Create',
'RaidLevel': '50',
'InitMode': 'slow',
'InitMode': 'fast',
'Size': {
'@Unit': 'GB',
'#text': 100
@ -2056,7 +2056,7 @@ class ELCMTestCase(testtools.TestCase):
'@Number': 0,
'@Action': 'None',
'RaidLevel': '0',
'InitMode': 'slow',
'InitMode': 'fast',
'Size': {
'@Unit': 'GB',
'#text': 100