Move BGI into FGI mechanism for safe operation
This commit will move background initialization(BGI) into foreground initialization (FGI). Due to safe opperation, we need prevent any accessing during RAID configuration. Thus FGI mechanism is suitable solution for us. Change-Id: If90f2f79df1f7928c0177d1f8b22623d37e4bc0a
This commit is contained in:
parent
7c1c9288de
commit
b798c1c2e8
|
@ -780,8 +780,6 @@ def _update_raid_input_data(target_raid_config, raid_input):
|
|||
'execute'})
|
||||
array_info = raid_input['Server']['HWConfigurationIrmc']['Adapters'][
|
||||
'RAIDAdapter'][0]
|
||||
# Set max value for BGI
|
||||
array_info['BGIRate'] = 100
|
||||
array_info['LogicalDrives'] = {'LogicalDrive': []}
|
||||
array_info['Arrays'] = {'Array': []}
|
||||
|
||||
|
@ -796,7 +794,7 @@ def _update_raid_input_data(target_raid_config, raid_input):
|
|||
array_info['LogicalDrives']['LogicalDrive'].append(
|
||||
{'@Action': 'Create',
|
||||
'RaidLevel': logical_disk['raid_level'],
|
||||
'InitMode': 'fast'})
|
||||
'InitMode': 'slow'})
|
||||
array_info['LogicalDrives']['LogicalDrive'][i].update({
|
||||
"@Number": i})
|
||||
|
||||
|
@ -818,7 +816,7 @@ def _update_raid_input_data(target_raid_config, raid_input):
|
|||
"ArrayRef": [
|
||||
]
|
||||
},
|
||||
"InitMode": "fast"
|
||||
"InitMode": "slow"
|
||||
}
|
||||
|
||||
array_info['Arrays']['Array'].append(arrays)
|
||||
|
@ -919,7 +917,7 @@ def create_raid_configuration(irmc_info, target_raid_config):
|
|||
if logical_drives is not None:
|
||||
# Delete exist logical drives in server.
|
||||
# NOTE(trungnv): Wait session complete and raise error if
|
||||
# delete raid config during BGI(BackGround Initialize) in-progress
|
||||
# delete raid config during FGI(Foreground Initialization) in-progress
|
||||
# in previous mechanism.
|
||||
delete_raid_configuration(irmc_info)
|
||||
# Updating raid adapter profile after deleted profile.
|
||||
|
|
|
@ -58,6 +58,16 @@ class SCCIClientError(SCCIError):
|
|||
super(SCCIClientError, self).__init__(message)
|
||||
|
||||
|
||||
class SCCIRAIDNotReady(SCCIError):
|
||||
"""SCCIRAIDNotReady
|
||||
|
||||
This exception is used when a mechanism not applied
|
||||
into a configuration on the iRMC yet
|
||||
"""
|
||||
def __init__(self, message):
|
||||
super(SCCIRAIDNotReady, self).__init__(message)
|
||||
|
||||
|
||||
"""
|
||||
List of iRMC S4 supported SCCI commands
|
||||
|
||||
|
@ -550,25 +560,26 @@ def get_capabilities_properties(d_info,
|
|||
raise SCCIClientError('Capabilities inspection failed: %s' % err)
|
||||
|
||||
|
||||
def get_raid_bgi_status(report):
|
||||
"""Gather bgi(background initialize) information of raid configuration
|
||||
def get_raid_fgi_status(report):
|
||||
"""Gather fgi(foreground initialization) information of raid configuration
|
||||
|
||||
This function returns a bgi status which contains activity status
|
||||
This function returns a fgi status which contains activity status
|
||||
and its values from the report.
|
||||
|
||||
:param report: SCCI report information
|
||||
:returns: dict of bgi status of logical_drives, such as BGI(10%) or
|
||||
Idle. e.g: {'0': 'Idle', '1': 'BGI(10%)'}
|
||||
:returns: dict of fgi status of logical_drives, such as Initializing (10%)
|
||||
or Idle. e.g: {'0': 'Idle', '1': 'Initializing (10%)'}
|
||||
:raises: SCCIInvalidInputError: fail report input.
|
||||
SCCIRAIDNotReady: waiting for RAID configuration to complete.
|
||||
"""
|
||||
bgi_status = {}
|
||||
fgi_status = {}
|
||||
raid_path = "./Software/ServerView/ServerViewRaid"
|
||||
|
||||
if not report.find(raid_path):
|
||||
raise SCCIInvalidInputError(
|
||||
"ServerView RAID not available in Bare metal Server")
|
||||
if not report.find(raid_path + "/amEMSV/System/Adapter/LogicalDrive"):
|
||||
raise SCCIInvalidInputError(
|
||||
raise SCCIRAIDNotReady(
|
||||
"RAID configuration not configure in Bare metal Server yet")
|
||||
|
||||
logical_drives = report.findall(raid_path +
|
||||
|
@ -576,6 +587,6 @@ def get_raid_bgi_status(report):
|
|||
for logical_drive_name in logical_drives:
|
||||
status = logical_drive_name.find("./Activity").text
|
||||
name = logical_drive_name.find("./LogDriveNumber").text
|
||||
bgi_status.update({name: status})
|
||||
fgi_status.update({name: status})
|
||||
|
||||
return bgi_status
|
||||
return fgi_status
|
||||
|
|
|
@ -1130,14 +1130,13 @@ class ELCMTestCase(testtools.TestCase):
|
|||
'Arrays': {
|
||||
'Array': []
|
||||
},
|
||||
'BGIRate': 100,
|
||||
'LogicalDrives': {
|
||||
'LogicalDrive': [
|
||||
{
|
||||
'@Number': 0,
|
||||
'@Action': 'Create',
|
||||
'RaidLevel': '1',
|
||||
'InitMode': 'fast',
|
||||
'InitMode': 'slow',
|
||||
'Size': {
|
||||
'@Unit': 'GB',
|
||||
'#text': 100
|
||||
|
@ -1190,14 +1189,13 @@ class ELCMTestCase(testtools.TestCase):
|
|||
'Arrays': {
|
||||
'Array': []
|
||||
},
|
||||
'BGIRate': 100,
|
||||
'LogicalDrives': {
|
||||
'LogicalDrive': [
|
||||
{
|
||||
'@Number': 0,
|
||||
'@Action': 'Create',
|
||||
'RaidLevel': '0',
|
||||
'InitMode': 'fast',
|
||||
'InitMode': 'slow',
|
||||
'Size': {
|
||||
'@Unit': 'GB',
|
||||
'#text': 100
|
||||
|
@ -1207,7 +1205,7 @@ class ELCMTestCase(testtools.TestCase):
|
|||
'@Number': 1,
|
||||
'@Action': 'Create',
|
||||
'RaidLevel': '1',
|
||||
'InitMode': 'fast',
|
||||
'InitMode': 'slow',
|
||||
'Size': {
|
||||
'@Unit': 'GB',
|
||||
'#text': 100
|
||||
|
@ -1289,14 +1287,13 @@ class ELCMTestCase(testtools.TestCase):
|
|||
}
|
||||
]
|
||||
},
|
||||
'BGIRate': 100,
|
||||
'LogicalDrives': {
|
||||
'LogicalDrive': [
|
||||
{
|
||||
'@Number': 0,
|
||||
'@Action': 'Create',
|
||||
'RaidLevel': '1',
|
||||
'InitMode': 'fast',
|
||||
'InitMode': 'slow',
|
||||
'Size': {
|
||||
'@Unit': 'GB',
|
||||
'#text': 100
|
||||
|
@ -1399,14 +1396,13 @@ class ELCMTestCase(testtools.TestCase):
|
|||
},
|
||||
]
|
||||
},
|
||||
'BGIRate': 100,
|
||||
'LogicalDrives': {
|
||||
'LogicalDrive': [
|
||||
{
|
||||
'@Number': 0,
|
||||
'@Action': 'Create',
|
||||
'RaidLevel': '0',
|
||||
'InitMode': 'fast',
|
||||
'InitMode': 'slow',
|
||||
'Size': {
|
||||
'@Unit': 'GB',
|
||||
'#text': 100
|
||||
|
@ -1423,7 +1419,7 @@ class ELCMTestCase(testtools.TestCase):
|
|||
'@Number': 1,
|
||||
'@Action': 'Create',
|
||||
'RaidLevel': '1',
|
||||
'InitMode': 'fast',
|
||||
'InitMode': 'slow',
|
||||
'Size': {
|
||||
'@Unit': 'GB',
|
||||
'#text': 100
|
||||
|
@ -1541,14 +1537,13 @@ class ELCMTestCase(testtools.TestCase):
|
|||
'Arrays': {
|
||||
'Array': []
|
||||
},
|
||||
'BGIRate': 100,
|
||||
'LogicalDrives': {
|
||||
'LogicalDrive': [
|
||||
{
|
||||
'@Number': 0,
|
||||
'@Action': 'Create',
|
||||
'RaidLevel': '1',
|
||||
'InitMode': 'fast',
|
||||
'InitMode': 'slow',
|
||||
'Size': {
|
||||
'@Unit': 'GB',
|
||||
'#text': 100
|
||||
|
@ -1612,14 +1607,13 @@ class ELCMTestCase(testtools.TestCase):
|
|||
'Arrays': {
|
||||
'Array': []
|
||||
},
|
||||
'BGIRate': 100,
|
||||
'LogicalDrives': {
|
||||
'LogicalDrive': [
|
||||
{
|
||||
'@Number': 0,
|
||||
'@Action': 'Create',
|
||||
'RaidLevel': '0',
|
||||
'InitMode': 'fast'
|
||||
'InitMode': 'slow'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1690,14 +1684,13 @@ class ELCMTestCase(testtools.TestCase):
|
|||
},
|
||||
]
|
||||
},
|
||||
'BGIRate': 100,
|
||||
'LogicalDrives': {
|
||||
'LogicalDrive': [
|
||||
{
|
||||
'@Number': 0,
|
||||
'@Action': 'Create',
|
||||
'RaidLevel': '0',
|
||||
'InitMode': 'fast',
|
||||
'InitMode': 'slow',
|
||||
'Size': {
|
||||
'@Unit': 'GB',
|
||||
'#text': 100
|
||||
|
@ -1708,7 +1701,7 @@ class ELCMTestCase(testtools.TestCase):
|
|||
'@Number': 1,
|
||||
'@Action': 'Create',
|
||||
'RaidLevel': '1',
|
||||
'InitMode': 'fast',
|
||||
'InitMode': 'slow',
|
||||
'Size': {
|
||||
'@Unit': 'GB',
|
||||
'#text': 100
|
||||
|
@ -1786,14 +1779,13 @@ class ELCMTestCase(testtools.TestCase):
|
|||
'Arrays': {
|
||||
'Array': []
|
||||
},
|
||||
'BGIRate': 100,
|
||||
'LogicalDrives': {
|
||||
'LogicalDrive': [
|
||||
{
|
||||
'@Number': 0,
|
||||
'@Action': 'Create',
|
||||
'RaidLevel': '10',
|
||||
'InitMode': 'fast',
|
||||
'InitMode': 'slow',
|
||||
'Size': {
|
||||
'@Unit': 'GB',
|
||||
'#text': 100
|
||||
|
@ -1857,14 +1849,13 @@ class ELCMTestCase(testtools.TestCase):
|
|||
'Arrays': {
|
||||
'Array': []
|
||||
},
|
||||
'BGIRate': 100,
|
||||
'LogicalDrives': {
|
||||
'LogicalDrive': [
|
||||
{
|
||||
'@Number': 0,
|
||||
'@Action': 'Create',
|
||||
'RaidLevel': '50',
|
||||
'InitMode': 'fast',
|
||||
'InitMode': 'slow',
|
||||
'Size': {
|
||||
'@Unit': 'GB',
|
||||
'#text': 100
|
||||
|
@ -1940,14 +1931,13 @@ class ELCMTestCase(testtools.TestCase):
|
|||
}
|
||||
]
|
||||
},
|
||||
'BGIRate': 100,
|
||||
'LogicalDrives': {
|
||||
'LogicalDrive': [
|
||||
{
|
||||
'@Number': 0,
|
||||
'@Action': 'None',
|
||||
'RaidLevel': '0',
|
||||
'InitMode': 'fast',
|
||||
'InitMode': 'slow',
|
||||
'Size': {
|
||||
'@Unit': 'GB',
|
||||
'#text': 100
|
||||
|
|
|
@ -881,22 +881,22 @@ class SCCITestCase(testtools.TestCase):
|
|||
**kwargs)
|
||||
self.assertEqual('Capabilities inspection failed: IPMI error', str(e))
|
||||
|
||||
def test_fail_get_raid_bgi_status(self):
|
||||
def test_fail_get_raid_fgi_status(self):
|
||||
report_fake = self.report_ok_xml
|
||||
report_fake.find("./Software/ServerView/ServerViewRaid").clear()
|
||||
self.assertRaises(scci.SCCIInvalidInputError,
|
||||
scci.get_raid_bgi_status, report=report_fake)
|
||||
scci.get_raid_fgi_status, report=report_fake)
|
||||
|
||||
def test_fail_get_raid_bgi_status_1(self):
|
||||
def test_fail_get_raid_fgi_status_1(self):
|
||||
report_fake = self.report_ok_xml
|
||||
report_fake.find("./Software/ServerView/ServerViewRaid/amEMSV"
|
||||
"/System/Adapter").clear()
|
||||
self.assertRaises(scci.SCCIInvalidInputError,
|
||||
scci.get_raid_bgi_status, report=report_fake)
|
||||
self.assertRaises(scci.SCCIRAIDNotReady,
|
||||
scci.get_raid_fgi_status, report=report_fake)
|
||||
|
||||
def test_get_raid_bgi_status_ok(self):
|
||||
def test_get_raid_fgi_status_ok(self):
|
||||
|
||||
# Fake activity status of BGI in xml report
|
||||
# Fake activity status of FGI in xml report
|
||||
url = "./Software/ServerView/ServerViewRaid/amEMSV/System/Adapter"
|
||||
report_fake = self.report_ok_xml
|
||||
report_input = report_fake.find(url)
|
||||
|
@ -909,6 +909,6 @@ class SCCITestCase(testtools.TestCase):
|
|||
report_input.find("./LogicalDrive").append(element_3)
|
||||
report_fake.find(url + "/LogicalDrive/Activity").text = 'Idle'
|
||||
|
||||
bgi_status_expect = {'0': 'Idle'}
|
||||
result = scci.get_raid_bgi_status(report_fake)
|
||||
self.assertEqual(result, bgi_status_expect)
|
||||
fgi_status_expect = {'0': 'Idle'}
|
||||
result = scci.get_raid_fgi_status(report_fake)
|
||||
self.assertEqual(result, fgi_status_expect)
|
||||
|
|
Loading…
Reference in New Issue