From 3639725789277d513e188317b4444ba66af96cd2 Mon Sep 17 00:00:00 2001
From: ISIB-Group <67364259+ISIB-Group@users.noreply.github.com>
Date: Fri, 19 Nov 2021 15:47:43 +0800
Subject: [PATCH] Release 2.0.0 (#49)
Add the onboard_disk_info module
---
CHANGELOG.rst | 16 +
changelogs/.plugin-cache.yaml | 7 +-
changelogs/changelog.yaml | 17 ++
changelogs/fragments/46-add_user_email.yml | 2 -
.../fragments/47-edit_creaete_ldisk.yml | 2 -
changelogs/fragments/48-edit_pdisk.yml | 2 -
docs/add_ldisk_module.rst | 68 ++++-
docs/edit_pdisk_module.rst | 97 +++++-
docs/index.rst | 1 +
docs/onboard_disk_info_module.rst | 289 ++++++++++++++++++
galaxy.yml | 2 +-
.../modules/examples-onboard_disk_info.yml | 15 +
plugins/modules/onboard_disk_info.py | 97 ++++++
13 files changed, 595 insertions(+), 20 deletions(-)
delete mode 100644 changelogs/fragments/46-add_user_email.yml
delete mode 100644 changelogs/fragments/47-edit_creaete_ldisk.yml
delete mode 100644 changelogs/fragments/48-edit_pdisk.yml
create mode 100644 docs/onboard_disk_info_module.rst
create mode 100644 playbooks/modules/examples-onboard_disk_info.yml
create mode 100644 plugins/modules/onboard_disk_info.py
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 2dcc9c9..d33748d 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -5,6 +5,22 @@ Inspur.sm Release Notes
.. contents:: Topics
+v2.0.0
+======
+
+Minor Changes
+-------------
+
+- Add the onboard_disk_info module.
+- Modified logical disk Settings, added logical disk Settings for M6 PMC card.
+- Modify the edit_pdisk function to add new parameters.
+- The user module adds the mailbox field.
+
+New Modules
+-----------
+
+- inspur.sm.onboard_disk_info - Get onboard disks information.
+
v1.2.0
======
diff --git a/changelogs/.plugin-cache.yaml b/changelogs/.plugin-cache.yaml
index a9b9ff0..1143a18 100644
--- a/changelogs/.plugin-cache.yaml
+++ b/changelogs/.plugin-cache.yaml
@@ -518,6 +518,11 @@ plugins:
name: ntp_info
namespace: ''
version_added: 0.1.0
+ onboard_disk_info:
+ description: Get onboard disks information.
+ name: onboard_disk_info
+ namespace: ''
+ version_added: 2.0.0
pcie_info:
description: Get PCIE information.
name: pcie_info
@@ -692,4 +697,4 @@ plugins:
shell: {}
strategy: {}
vars: {}
-version: 1.2.0
+version: 2.0.0
diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml
index d5e2c70..0490fb1 100644
--- a/changelogs/changelog.yaml
+++ b/changelogs/changelog.yaml
@@ -116,3 +116,20 @@ releases:
fragments:
- m6_compatible.yml
release_date: '2021-05-19'
+ 2.0.0:
+ changes:
+ minor_changes:
+ - Add the onboard_disk_info module.
+ - Modified logical disk Settings, added logical disk Settings for M6 PMC card.
+ - Modify the edit_pdisk function to add new parameters.
+ - The user module adds the mailbox field.
+ fragments:
+ - 46-add_user_email.yml
+ - 47-edit_creaete_ldisk.yml
+ - 48-edit_pdisk.yml
+ - 49-add_onboard_disk_info.yml
+ modules:
+ - description: Get onboard disks information.
+ name: onboard_disk_info
+ namespace: ''
+ release_date: '2021-11-18'
diff --git a/changelogs/fragments/46-add_user_email.yml b/changelogs/fragments/46-add_user_email.yml
deleted file mode 100644
index 629a7fa..0000000
--- a/changelogs/fragments/46-add_user_email.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-minor_changes:
- - The user module adds the mailbox field.
\ No newline at end of file
diff --git a/changelogs/fragments/47-edit_creaete_ldisk.yml b/changelogs/fragments/47-edit_creaete_ldisk.yml
deleted file mode 100644
index d4c8211..0000000
--- a/changelogs/fragments/47-edit_creaete_ldisk.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-minor_changes:
- - Modified logical disk Settings, added logical disk Settings for M6 PMC card.
\ No newline at end of file
diff --git a/changelogs/fragments/48-edit_pdisk.yml b/changelogs/fragments/48-edit_pdisk.yml
deleted file mode 100644
index cf7c910..0000000
--- a/changelogs/fragments/48-edit_pdisk.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-minor_changes:
- - Modify the edit_pdisk function to add new parameters.
\ No newline at end of file
diff --git a/docs/add_ldisk_module.rst b/docs/add_ldisk_module.rst
index 10af1d8..f01bf9e 100644
--- a/docs/add_ldisk_module.rst
+++ b/docs/add_ldisk_module.rst
@@ -65,6 +65,27 @@ Parameters
+
+ accelerator
+
+
+ integer
+
+ |
+
+
+ |
+
+ Driver accelerator, 1 - 1h, 2 - 2h, 3 - 3h.
+ Required when Info=None and controller type is PMC.
+ |
+
+
+
access
@@ -81,7 +102,7 @@ Parameters
|
Access Policy, 1 - Read Write, 2 - Read Only, 3 - Blocked.
- Required when Info=None.
+ Required when Info=None and controller type is LSI.
|
@@ -102,7 +123,7 @@ Parameters
Drive Cache, 1 - Unchanged, 2 - Enabled,3 - Disabled.
- Required when Info=None.
+ Required when Info=None and controller type is LSI.
|
@@ -118,7 +139,7 @@ Parameters
Raid controller ID.
- Required when Info=None.
+ Required when Info=None and controller type is LSI or PMC.
|
@@ -172,7 +193,7 @@ Parameters
Init State, 1 - No Init, 2 - Quick Init, 3 - Full Init.
- Required when Info=None.
+ Required when Info=None and controller type is LSI.
|
@@ -192,7 +213,7 @@ Parameters
IO Policy, 1 - Direct IO, 2 - Cached IO.
- Required when Info=None.
+ Required when Info=None and controller type is LSI.
|
@@ -215,7 +236,7 @@ Parameters
RAID Level, 0 - RAID0, 1 - RAID1, 5 - RAID5, 6 - RAID6, 10 - RAID10.
- Required when Info=None.
+ Required when Info=None and controller type is LSI or PMC.
|
@@ -314,7 +335,7 @@ Parameters
Read Policy, 1 - Read Ahead, 2 - No Read Ahead.
- Required when Info=None.
+ Required when Info=None and controller type is LSI.
|
@@ -330,7 +351,7 @@ Parameters
Select Size, from 1 to 100.
- Required when Info=None.
+ Required when Info=None and controller type is LSI.
|
@@ -353,7 +374,7 @@ Parameters
Strip Size, 1 - 64k, 2 - 128k, 3 - 256k, 4 - 512k, 5 - 1024k.
- Required when Info=None.
+ Required when Info=None and controller type is LSI or PMC.
|
@@ -369,7 +390,7 @@ Parameters
Slot Num,input multiple slotNumber like 0,1,2....
- Required when Info=None.
+ Required when Info=None and controller type is LSI.
|
@@ -386,6 +407,22 @@ Parameters
Configures the username to use to authenticate the connection to the remote device. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.
|
+
+
+
+
+ vname
+
+
+ string
+
+ |
+
+ |
+
+ Virtual drive name.
+ Required when Info=None and controller type is PMC.
+ |
@@ -405,7 +442,7 @@ Parameters
|
Write Policy, 1 - Write Throgh, 2 - Write Back, 3 - Write caching ok if bad BBU.
- Required when Info=None.
+ Required when Info=None and controller type is LSI.
|
@@ -457,6 +494,15 @@ Examples
slot: 0,1
provider: "{{ ism }}"
+ - name: "Add PMC ldisk"
+ inspur.sm.add_ldisk:
+ ctrl_id: 0
+ level: 1
+ size: 1
+ accelerator: 1
+ vname: "test"
+ provider: "{{ ism }}"
+
diff --git a/docs/edit_pdisk_module.rst b/docs/edit_pdisk_module.rst
index 6c23df7..b3932e3 100644
--- a/docs/edit_pdisk_module.rst
+++ b/docs/edit_pdisk_module.rst
@@ -65,6 +65,28 @@ Parameters
+
+ action
+
+
+ string
+
+ |
+
+ Choices:
+ - remove
+ - global
+ - dedicate
+
+ |
+
+ Action while set physical drive hotspare.
+ Required when Info=None and option=HS.
+ Only the M5 model supports this parameter.
+ |
+
+
+
ctrl_id
@@ -94,6 +116,27 @@ Parameters
physical drive id.
Required when Info=None.
|
+
+
+
+
+ encl
+
+
+ string
+
+ |
+
+
+ |
+
+ IsEnclAffinity while set physical drive hotspare.
+ Required when Info=None and option=HS and action=dedicate.
+ Only the M5 model supports this parameter.
+ |
@@ -127,6 +170,23 @@ Parameters
|
Show controller and pdisk info.
|
+
+
+
+
+ logical_drivers
+
+
+ list
+ / elements=integer
+ |
+
+ |
+
+ Logical Drivers while set physical drive hotspare, input multiple Logical Drivers index like 0,1,2.....
+ Required when Info=None and option=HS and action=dedicate.
+ Only the M5 model supports this parameter.
+ |
@@ -152,6 +212,7 @@ Parameters
ET
LOC
STL
+ HS
|
@@ -160,8 +221,10 @@ Parameters
OFF is offline,FAIL is Failed,RBD is Rebuild,
ON is Online,JB is JBOD,ES is Drive Erase stop,
EM is Drive Erase Simple,EN is Drive Erase Normal,
- ET is Drive Erase Through,LOC is Locate,STL is Stop Locate.
+ ET is Drive Erase Through,LOC is Locate,STL is Stop Locate,
+ HS is Hot spare.
Required when Info=None.
+ Only the M5 model supports HS Settings.
|
@@ -243,6 +306,27 @@ Parameters
+
+
+
+ revertible
+
+
+ string
+
+ |
+
+
+ |
+
+ IsRevertible while set physical drive hotspare.
+ Required when Info=None and option=HS and action=dedicate.
+ Only the M5 model supports this parameter.
+ |
+
@@ -299,6 +383,17 @@ Examples
option: "LOC"
provider: "{{ ism }}"
+ - name: "M5 Edit pdisk"
+ inspur.sm.edit_pdisk:
+ ctrl_id: 0
+ device_id: 1
+ option: "HS"
+ action: "dedicate"
+ revertible: "yes"
+ encl: "yes"
+ logical_drivers: 1
+ provider: "{{ ism }}"
+
diff --git a/docs/index.rst b/docs/index.rst
index b3c2ab3..5c315b5 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -116,6 +116,7 @@ Module Plugins
* :ref:`network_info ` -- Get network information.
* :ref:`network_link_info ` -- Get network link information.
* :ref:`ntp_info ` -- Get NTP information.
+* :ref:`onboard_disk_info ` -- Get onboard disks information.
* :ref:`pcie_info ` -- Get PCIE information.
* :ref:`pdisk_info ` -- Get physical disks information.
* :ref:`power_budget_info ` -- Get power budget information.
diff --git a/docs/onboard_disk_info_module.rst b/docs/onboard_disk_info_module.rst
new file mode 100644
index 0000000..b15c477
--- /dev/null
+++ b/docs/onboard_disk_info_module.rst
@@ -0,0 +1,289 @@
+.. Document meta
+
+:orphan:
+
+.. Anchors
+
+.. _ansible_collections.inspur.sm.onboard_disk_info_module:
+
+.. Anchors: short name for ansible.builtin
+
+.. Anchors: aliases
+
+
+
+.. Title
+
+inspur.sm.onboard_disk_info -- Get onboard disks information.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+.. Collection note
+
+.. note::
+ This plugin is part of the `inspur.sm collection `_.
+
+ To install it use: :code:`ansible-galaxy collection install inspur.sm`.
+
+ To use it in a playbook, specify: :code:`inspur.sm.onboard_disk_info`.
+
+.. version_added
+
+.. versionadded:: 2.0.0 of inspur.sm
+
+.. contents::
+ :local:
+ :depth: 1
+
+.. Deprecated
+
+
+Synopsis
+--------
+
+.. Description
+
+- Get onboard disks information on Inspur server.
+
+.. Aliases
+
+
+.. Requirements
+
+
+.. Options
+
+Parameters
+----------
+
+.. raw:: html
+
+
+
+ Parameter |
+ Choices/Defaults |
+ Comments |
+
+
+
+
+ host
+
+
+ string
+
+ |
+
+ |
+
+ Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.
+ |
+
+
+
+
+ password
+
+
+ string
+
+ |
+
+ |
+
+ Specifies the password to use to authenticate the connection to the remote device. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_PASSWORD will be used instead.
+ |
+
+
+
+
+ provider
+
+
+ dictionary
+
+ |
+
+ |
+
+ A dict object containing connection details.
+ |
+
+
+ |
+
+
+ host
+
+
+ string
+
+ |
+
+ |
+
+ Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.
+ |
+
+
+ |
+
+
+ password
+
+
+ string
+
+ |
+
+ |
+
+ Specifies the password to use to authenticate the connection to the remote device. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_PASSWORD will be used instead.
+ |
+
+
+ |
+
+
+ username
+
+
+ string
+
+ |
+
+ |
+
+ Configures the username to use to authenticate the connection to the remote device. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.
+ |
+
+
+
+
+
+ username
+
+
+ string
+
+ |
+
+ |
+
+ Configures the username to use to authenticate the connection to the remote device. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.
+ |
+
+
+
+
+.. Notes
+
+
+.. Seealso
+
+
+.. Examples
+
+Examples
+--------
+
+.. code-block:: yaml+jinja
+
+
+ - name: Onboard test
+ hosts: ism
+ connection: local
+ gather_facts: no
+ vars:
+ ism:
+ host: "{{ ansible_ssh_host }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+
+ tasks:
+
+ - name: "Get onboard disks information"
+ inspur.sm.onboard_disk_info:
+ provider: "{{ ism }}"
+
+
+
+
+.. Facts
+
+
+.. Return values
+
+Return Values
+-------------
+Common return values are documented :ref:`here `, the following are the fields unique to this module:
+
+.. raw:: html
+
+
+
+ Key |
+ Returned |
+ Description |
+
+
+
+
+ changed
+
+
+ boolean
+
+ |
+ always |
+
+ Check to see if a change was made on the device.
+
+ |
+
+
+
+
+ message
+
+
+ string
+
+ |
+ always |
+
+ Messages returned after module execution.
+
+ |
+
+
+
+
+ state
+
+
+ string
+
+ |
+ always |
+
+ Status after module execution.
+
+ |
+
+
+
+
+.. Status (Presently only deprecated)
+
+
+.. Authors
+
+Authors
+~~~~~~~
+
+- WangBaoshan (@ISIB-group)
+
+
+
+.. Parsing errors
+
diff --git a/galaxy.yml b/galaxy.yml
index c8ee9ac..7c38e4d 100644
--- a/galaxy.yml
+++ b/galaxy.yml
@@ -9,7 +9,7 @@ namespace: inspur
name: sm
# The version of the collection. Must be compatible with semantic versioning
-version: 1.3.0
+version: 2.0.0
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
diff --git a/playbooks/modules/examples-onboard_disk_info.yml b/playbooks/modules/examples-onboard_disk_info.yml
new file mode 100644
index 0000000..20489e6
--- /dev/null
+++ b/playbooks/modules/examples-onboard_disk_info.yml
@@ -0,0 +1,15 @@
+- name: Onboard test
+ hosts: ism
+ connection: local
+ gather_facts: no
+ vars:
+ ism:
+ host: "{{ ansible_ssh_host }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+
+ tasks:
+
+ - name: "Get onboard disks information"
+ inspur.sm.onboard_disk_info:
+ provider: "{{ ism }}"
\ No newline at end of file
diff --git a/plugins/modules/onboard_disk_info.py b/plugins/modules/onboard_disk_info.py
new file mode 100644
index 0000000..4914c78
--- /dev/null
+++ b/plugins/modules/onboard_disk_info.py
@@ -0,0 +1,97 @@
+#!/usr/bin/python
+# -*- coding:utf-8 -*-
+
+# Copyright (C) 2020 Inspur Inc. All Rights Reserved.
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
+DOCUMENTATION = '''
+---
+module: onboard_disk_info
+version_added: "2.0.0"
+author:
+ - WangBaoshan (@ISIB-group)
+short_description: Get onboard disks information.
+description:
+ - Get onboard disks information on Inspur server.
+options: {}
+extends_documentation_fragment:
+ - inspur.sm.ism
+'''
+
+EXAMPLES = '''
+- name: Onboard test
+ hosts: ism
+ connection: local
+ gather_facts: no
+ vars:
+ ism:
+ host: "{{ ansible_ssh_host }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+
+ tasks:
+
+ - name: "Get onboard disks information"
+ inspur.sm.onboard_disk_info:
+ provider: "{{ ism }}"
+'''
+
+RETURN = '''
+message:
+ description: Messages returned after module execution.
+ returned: always
+ type: str
+state:
+ description: Status after module execution.
+ returned: always
+ type: str
+changed:
+ description: Check to see if a change was made on the device.
+ returned: always
+ type: bool
+'''
+
+from ansible.module_utils.basic import AnsibleModule
+from ansible_collections.inspur.sm.plugins.module_utils.ism import (ism_argument_spec, get_connection)
+
+
+class Disk(object):
+ def __init__(self, argument_spec):
+ self.spec = argument_spec
+ self.module = None
+ self.init_module()
+ self.results = dict()
+
+ def init_module(self):
+ """Init module object"""
+
+ self.module = AnsibleModule(
+ argument_spec=self.spec, supports_check_mode=True)
+
+ def run_command(self):
+ self.module.params['subcommand'] = 'gethdddisk'
+ self.results = get_connection(self.module)
+
+ def show_result(self):
+ """Show result"""
+ self.module.exit_json(**self.results)
+
+ def work(self):
+ """Worker"""
+ self.run_command()
+ self.show_result()
+
+
+def main():
+ argument_spec = dict()
+ argument_spec.update(ism_argument_spec)
+ disk_obj = Disk(argument_spec)
+ disk_obj.work()
+
+
+if __name__ == '__main__':
+ main()
|