Browse Source

Merge "Remove deprecated commit_required parameter from python-dracclient"

changes/13/629613/1
Zuul 2 years ago
committed by Gerrit Code Review
parent
commit
cc3f57ac3a
6 changed files with 26 additions and 110 deletions
  1. +7
    -23
      dracclient/client.py
  2. +1
    -7
      dracclient/resources/bios.py
  3. +0
    -18
      dracclient/resources/raid.py
  4. +2
    -4
      dracclient/tests/test_bios.py
  5. +12
    -25
      dracclient/tests/test_raid.py
  6. +4
    -33
      dracclient/utils.py

+ 7
- 23
dracclient/client.py View File

@ -175,11 +175,6 @@ class DRACClient(object):
each key being the name of attribute and the value
being the proposed value.
:returns: a dictionary containing:
- The commit_required key with a boolean value indicating
whether a config job must be created for the values to be
applied. This key actually has a value that indicates if
a reboot is required. This key has been deprecated and
will be removed in a future release.
- The is_commit_required key with a boolean value indicating
whether a config job must be created for the values to be
applied.
@ -705,11 +700,6 @@ class DRACClient(object):
become part of the RAID. The same flag is applied to all
listed disks
:returns: a dictionary containing:
- The commit_required key with a boolean value indicating
whether a config job must be created for the values to be
applied. This key actually has a value that indicates if
a reboot is required. This key has been deprecated and
will be removed in a future release.
- The is_commit_required key with the value always set to
True indicating that a config job must be created to
complete disk conversion.
@ -735,11 +725,6 @@ class DRACClient(object):
:param span_length: number of disks per span (optional)
:param span_depth: number of spans in virtual disk (optional)
:returns: a dictionary containing:
- The commit_required key with a boolean value indicating
whether a config job must be created for the values to be
applied. This key actually has a value that indicates if
a reboot is required. This key has been deprecated and
will be removed in a future release.
- The is_commit_required key with the value always set to
True indicating that a config job must be created to
complete virtual disk creation.
@ -765,11 +750,6 @@ class DRACClient(object):
:param virtual_disk: id of the virtual disk
:returns: a dictionary containing:
- The commit_required key with a boolean value indicating
whether a config job must be created for the values to be
applied. This key actually has a value that indicates if
a reboot is required. This key has been deprecated and
will be removed in a future release.
- The is_commit_required key with the value always set to
True indicating that a config job must be created to
complete virtual disk deletion.
@ -892,9 +872,13 @@ class DRACClient(object):
:param settings: dictionary containing the proposed values, with
each key being the name of an attribute and the
value being the proposed value
:returns: dictionary containing a 'commit_required' key with a
boolean value indicating whether a configuration job
must be created for the new settings to be applied
:returns: dictionary containing:
- The is_commit_required key with a boolean value
indicating whether a config job must be created for
the values to be applied.
- The is_reboot_required key with a RebootRequired
enumerated value indicating whether the server must
be rebooted for the values to be applied.
:raises: WSManRequestFailure on request failures
:raises: WSManInvalidResponse when receiving invalid response
:raises: DRACOperationFailed on error reported back by the iDRAC


+ 1
- 7
dracclient/resources/bios.py View File

@ -500,11 +500,6 @@ class BIOSConfiguration(object):
each key being the name of attribute and the
value being the proposed value.
:returns: a dictionary containing:
- The commit_required key with a boolean value indicating
whether a config job must be created for the values to be
applied. This key actually has a value that indicates if
a reboot is required. This key has been deprecated and
will be removed in a future release.
- The is_commit_required key with a boolean value indicating
whether a config job must be created for the values to be
applied.
@ -526,5 +521,4 @@ class BIOSConfiguration(object):
uris.DCIM_BIOSService,
"DCIM_BIOSService",
"DCIM:BIOSService",
'BIOS.Setup.1-1',
include_commit_required=True)
'BIOS.Setup.1-1')

+ 0
- 18
dracclient/resources/raid.py View File

@ -291,11 +291,6 @@ class RAIDManagement(object):
become part of the RAID. The same flag is applied
to all listed disks
:returns: a dictionary containing:
- The commit_required key with a boolean value indicating
whether a config job must be created for the values to be
applied. This key actually has a value that indicates if
a reboot is required. This key has been deprecated and
will be removed in a future release.
- The is_commit_required key with the value always set to
True indicating that a config job must be created to
complete disk conversion.
@ -317,7 +312,6 @@ class RAIDManagement(object):
expected_return_value=utils.RET_SUCCESS)
return utils.build_return_dict(doc, uris.DCIM_RAIDService,
include_commit_required=True,
is_commit_required_value=True)
def create_virtual_disk(self, raid_controller, physical_disks, raid_level,
@ -336,11 +330,6 @@ class RAIDManagement(object):
:param span_length: number of disks per span (optional)
:param span_depth: number of spans in virtual disk (optional)
:returns: a dictionary containing:
- The commit_required key with a boolean value indicating
whether a config job must be created for the values to be
applied. This key actually has a value that indicates if
a reboot is required. This key has been deprecated and
will be removed in a future release.
- The is_commit_required key with the value always set to
True indicating that a config job must be created to
complete virtual disk creation.
@ -415,7 +404,6 @@ class RAIDManagement(object):
expected_return_value=utils.RET_SUCCESS)
return utils.build_return_dict(doc, uris.DCIM_RAIDService,
include_commit_required=True,
is_commit_required_value=True)
def delete_virtual_disk(self, virtual_disk):
@ -426,11 +414,6 @@ class RAIDManagement(object):
:param virtual_disk: id of the virtual disk
:returns: a dictionary containing:
- The commit_required key with a boolean value indicating
whether a config job must be created for the values to be
applied. This key actually has a value that indicates if
a reboot is required. This key has been deprecated and
will be removed in a future release.
- The is_commit_required key with the value always set to
True indicating that a config job must be created to
complete virtual disk deletion.
@ -455,7 +438,6 @@ class RAIDManagement(object):
expected_return_value=utils.RET_SUCCESS)
return utils.build_return_dict(doc, uris.DCIM_RAIDService,
include_commit_required=True,
is_commit_required_value=True)
def is_jbod_capable(self, raid_controller_fqdd):


+ 2
- 4
dracclient/tests/test_bios.py View File

@ -348,8 +348,7 @@ class ClientBIOSConfigurationTestCase(base.BaseTest):
result = self.drac_client.set_bios_settings(
{'ProcVirtualization': 'Disabled'})
self.assertEqual({'commit_required': True,
'is_commit_required': True,
self.assertEqual({'is_commit_required': True,
'is_reboot_required': constants.RebootRequired.true},
result)
mock_invoke.assert_called_once_with(
@ -398,8 +397,7 @@ class ClientBIOSConfigurationTestCase(base.BaseTest):
result = self.drac_client.set_bios_settings(
{'ProcVirtualization': 'Enabled'})
self.assertEqual({'commit_required': False,
'is_commit_required': False,
self.assertEqual({'is_commit_required': False,
'is_reboot_required':
constants.RebootRequired.false},
result)


+ 12
- 25
dracclient/tests/test_raid.py View File

@ -283,8 +283,7 @@ class ClientRAIDManagementTestCase(base.BaseTest):
physical_disks=[device_fqdd],
raid_enable=True)
self.assertEqual({'commit_required': True,
'is_commit_required': True,
self.assertEqual({'is_commit_required': True,
'is_reboot_required': constants.RebootRequired.true},
result)
mock_invoke.assert_called_once_with(
@ -315,8 +314,7 @@ class ClientRAIDManagementTestCase(base.BaseTest):
physical_disks=device_list,
raid_enable=True)
self.assertEqual({'commit_required': True,
'is_commit_required': True,
self.assertEqual({'is_commit_required': True,
'is_reboot_required': constants.RebootRequired.true},
result)
mock_invoke.assert_called_once_with(
@ -345,8 +343,7 @@ class ClientRAIDManagementTestCase(base.BaseTest):
physical_disks=[device_fqdd],
raid_enable=False)
self.assertEqual({'commit_required': True,
'is_commit_required': True,
self.assertEqual({'is_commit_required': True,
'is_reboot_required': constants.RebootRequired.true},
result)
mock_invoke.assert_called_once_with(
@ -378,8 +375,7 @@ class ClientRAIDManagementTestCase(base.BaseTest):
physical_disks=device_list,
raid_enable=False)
self.assertEqual({'commit_required': True,
'is_commit_required': True,
self.assertEqual({'is_commit_required': True,
'is_reboot_required': constants.RebootRequired.true},
result)
mock_invoke.assert_called_once_with(
@ -424,8 +420,7 @@ class ClientRAIDManagementTestCase(base.BaseTest):
raid_controller='controller', physical_disks=['disk1', 'disk2'],
raid_level='1', size_mb=42)
self.assertEqual({'commit_required': True,
'is_commit_required': True,
self.assertEqual({'is_commit_required': True,
'is_reboot_required': constants.RebootRequired.true},
result)
mock_invoke.assert_called_once_with(
@ -457,8 +452,7 @@ class ClientRAIDManagementTestCase(base.BaseTest):
raid_level='1', size_mb=42, disk_name='name', span_length=2,
span_depth=3)
self.assertEqual({'commit_required': True,
'is_commit_required': True,
self.assertEqual({'is_commit_required': True,
'is_reboot_required': constants.RebootRequired.true},
result)
mock_invoke.assert_called_once_with(
@ -570,8 +564,7 @@ class ClientRAIDManagementTestCase(base.BaseTest):
result = self.drac_client.delete_virtual_disk('disk1')
self.assertEqual({'commit_required': True,
'is_commit_required': True,
self.assertEqual({'is_commit_required': True,
'is_reboot_required': constants.RebootRequired.true},
result)
mock_invoke.assert_called_once_with(
@ -926,8 +919,7 @@ class ClientRAIDManagementTestCase(base.BaseTest):
mock_requests.post(
'https://1.2.3.4:443/wsman',
text=test_utils.RAIDEnumerations[uris.DCIM_PhysicalDiskView]['ok'])
mock_convert_physical_disks.return_value = {'commit_required': True,
'is_commit_required': True,
mock_convert_physical_disks.return_value = {'is_commit_required': True,
'is_reboot_required':
constants.RebootRequired
.true}
@ -953,8 +945,7 @@ class ClientRAIDManagementTestCase(base.BaseTest):
physical_disks = [disk_1_non_raid, disk_2_non_raid,
self.disk_3, self.disk_4]
mock_list_physical_disks.return_value = physical_disks
mock_convert_physical_disks.return_value = {'commit_required': True,
'is_commit_required': True,
mock_convert_physical_disks.return_value = {'is_commit_required': True,
'is_reboot_required':
constants.RebootRequired
.true}
@ -976,8 +967,7 @@ class ClientRAIDManagementTestCase(base.BaseTest):
mock_list_physical_disks):
mode = constants.RaidStatus.raid
physical_disks = [self.disk_1, self.disk_2, self.disk_3, self.disk_4]
mock_convert_physical_disks.return_value = {'commit_required': True,
'is_commit_required': True,
mock_convert_physical_disks.return_value = {'is_commit_required': True,
'is_reboot_required':
constants.RebootRequired
.true}
@ -1079,8 +1069,7 @@ class ClientRAIDManagementTestCase(base.BaseTest):
text=test_utils.RAIDEnumerations[uris.DCIM_ControllerView]['ok'])
mode = constants.RaidStatus.jbod
physical_disks = [self.disk_1, self.disk_2, self.disk_3, self.disk_4]
mock_convert_physical_disks.return_value = {'commit_required': True,
'is_commit_required': True,
mock_convert_physical_disks.return_value = {'is_commit_required': True,
'is_reboot_required':
constants.RebootRequired
.true}
@ -1143,9 +1132,7 @@ class ClientRAIDManagementTestCase(base.BaseTest):
'''Where convert_physical_disks() does not require a commit after
executing, unlikely case but provides 100% code coverage of all
logic branches.'''
mock_convert_physical_disks.return_value = {'commit_required':
True,
'is_commit_required':
mock_convert_physical_disks.return_value = {'is_commit_required':
False,
'is_reboot_required':
constants.RebootRequired


+ 4
- 33
dracclient/utils.py View File

@ -132,9 +132,7 @@ def get_all_wsman_resource_attrs(doc, resource_uri, attr_name, nullable=False):
def build_return_dict(doc, resource_uri,
is_commit_required_value=None,
is_reboot_required_value=None,
commit_required_value=None,
include_commit_required=False):
is_reboot_required_value=None):
"""Builds a dictionary to be returned
Build a dictionary to be returned from WSMAN operations that are not
@ -148,17 +146,9 @@ def build_return_dict(doc, resource_uri,
:param is_reboot_required_value: The value to be returned for
is_reboot_required, or None if the value should be determined
from the doc.
:param commit_required_value: The value to be returned for
commit_required, or None if the value should be determined
from the doc.
:parm include_commit_required: Indicates if the deprecated commit_required
should be returned in the result.
:returns: a dictionary containing:
- is_commit_required: indicates if a commit is required.
- is_reboot_required: indicates if a reboot is required.
- commit_required: a deprecated key indicating if a commit is
required. This key actually has a value that indicates if a
reboot is required.
"""
if is_reboot_required_value is not None and \
@ -180,14 +170,6 @@ def build_return_dict(doc, resource_uri,
result['is_reboot_required'] = is_reboot_required_value
# Include commit_required in the response for backwards compatibility
# TBD: Remove this parameter in the future
if include_commit_required:
if commit_required_value is None:
commit_required_value = is_reboot_required(doc, resource_uri)
result['commit_required'] = commit_required_value
return result
@ -315,8 +297,7 @@ def set_settings(settings_type,
cim_creation_class_name,
cim_name,
target,
name_formatter=None,
include_commit_required=False):
name_formatter=None):
"""Generically handles setting various types of settings on the iDRAC
This method pulls the current list of settings from the iDRAC then compares
@ -337,14 +318,7 @@ def set_settings(settings_type,
:param name_formatter: a method used to format the keys in the
returned dictionary. By default,
attribute.name will be used.
:parm include_commit_required: Indicates if the deprecated commit_required
should be returned in the result.
:returns: a dictionary containing:
- The commit_required key with a boolean value indicating
whether a config job must be created for the values to be
applied. This key actually has a value that indicates if
a reboot is required. This key has been deprecated and
will be removed in a future release.
- The is_commit_required key with a boolean value indicating
whether a config job must be created for the values to be
applied.
@ -412,10 +386,8 @@ def set_settings(settings_type,
return build_return_dict(
None,
resource_uri,
include_commit_required=include_commit_required,
is_commit_required_value=False,
is_reboot_required_value=constants.RebootRequired.false,
commit_required_value=False)
is_reboot_required_value=constants.RebootRequired.false)
selectors = {'CreationClassName': cim_creation_class_name,
'Name': cim_name,
@ -428,5 +400,4 @@ def set_settings(settings_type,
doc = client.invoke(resource_uri, 'SetAttributes',
selectors, properties)
return build_return_dict(doc, resource_uri,
include_commit_required=include_commit_required)
return build_return_dict(doc, resource_uri)

Loading…
Cancel
Save