From 1cd47f71b262827b215d40111b8387f1aedfff14 Mon Sep 17 00:00:00 2001 From: Vlad Spoiala Date: Fri, 16 Jul 2021 10:57:46 +0300 Subject: [PATCH] Configure default initialization when creating a volume. When a volume is created the default initialization method can now be configured. Change-Id: I6d87c7b5847a2c24858d97928b19bc3a3532eaec --- pyghmi/ipmi/oem/lenovo/imm.py | 6 +++++- pyghmi/redfish/oem/lenovo/xcc.py | 6 +++++- pyghmi/storage.py | 5 ++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index 1785eacd..1178ff91 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -1344,6 +1344,10 @@ class XCCClient(IMMClient): write_policy = vol.write_policy else: write_policy = props["cpwb"] + if vol.default_init is not None: + default_init = vol.default_init + else: + default_init = props["initstate"] strsize = 'remainder' if vol.size is None else str(vol.size) if strsize in ('all', '100%'): volsize = params['capacity'] @@ -1364,7 +1368,7 @@ class XCCClient(IMMClient): 'Requested sizes exceed available capacity') vols.append('{0};{1};{2};{3};{4};{5};{6};{7};{8};|'.format( name, volsize, stripsize, write_policy, read_policy, - props['cpio'], props['ap'], props['dcp'], props['initstate'])) + props['cpio'], props['ap'], props['dcp'], default_init)) url = '/api/function' cid = params['controller'].split(',') cnum = cid[0] diff --git a/pyghmi/redfish/oem/lenovo/xcc.py b/pyghmi/redfish/oem/lenovo/xcc.py index 9eaa4f88..54871962 100644 --- a/pyghmi/redfish/oem/lenovo/xcc.py +++ b/pyghmi/redfish/oem/lenovo/xcc.py @@ -515,6 +515,10 @@ class OEMHandler(generic.OEMHandler): write_policy = vol.write_policy else: write_policy = props["cpwb"] + if vol.default_init is not None: + default_init = vol.default_init + else: + default_init = props["initstate"] strsize = 'remainder' if vol.size is None else str(vol.size) if strsize in ('all', '100%'): volsize = params['capacity'] @@ -536,7 +540,7 @@ class OEMHandler(generic.OEMHandler): 'Requested sizes exceed available capacity') vols.append('{0};{1};{2};{3};{4};{5};{6};{7};{8};|'.format( name, volsize, stripsize, write_policy, read_policy, - props['cpio'], props['ap'], props['dcp'], props['initstate'])) + props['cpio'], props['ap'], props['dcp'], default_init)) url = '/api/function' cid = params['controller'].split(',') cnum = cid[0] diff --git a/pyghmi/storage.py b/pyghmi/storage.py index 74e0773d..54aa893e 100644 --- a/pyghmi/storage.py +++ b/pyghmi/storage.py @@ -64,7 +64,8 @@ class Array(object): class Volume(object): def __init__(self, name=None, size=None, status=None, id=None, - stripsize=None, read_policy=None, write_policy=None): + stripsize=None, read_policy=None, write_policy=None, + default_init=None): """Define a Volume as an object :param name: Name of the volume @@ -74,6 +75,7 @@ class Volume(object): :param stripsize: The stripsize of the volume in kibibytes :param read_policy: The read policy of the volume :param write_policy: The write policy of the volume + :param default_init: The default initialization of the volume """ self.name = name if isinstance(size, int): @@ -93,6 +95,7 @@ class Volume(object): self.stripsize = stripsize self.read_policy = read_policy self.write_policy = write_policy + self.default_init = default_init class ConfigSpec(object):