Debian Codegraph @

ansible_collections/ibm/storage_virtualize/plugins/modules/ibm_svc_info.py

raw symbols SCIP
1 #!/usr/bin/python
2 # Copyright (C) 2024 IBM CORPORATION
3 # Author(s): Peng Wang <[email protected]>
4 # Sreshtant Bohidar <[email protected]>
5 # Sanjaikumaar M <[email protected]>
6 # Sumit Kumar Gupta <[email protected]>
7 # Sandip Gulab Rajbanshi <[email protected]>
8 # Rahul Pawar <[email protected]>
9 # Lavanya C R <[email protected]>
10 #
11 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
12
13 from __future__ import absolute_import, division, print_function
14 __metaclass__ = type
15
16 DOCUMENTATION = '''
17 ---
18 module: ibm_svc_info
19 short_description: This module gathers various information from the IBM Storage Virtualize family systems
20 version_added: "1.0.0"
21 description:
22 - Gathers the list of specified IBM Storage Virtualize family system
23 entities. These include the list of nodes, pools, volumes, hosts,
24 host clusters, FC ports, iSCSI ports, target port FC, FC consistgrp,
25 vdiskcopy, I/O groups, FC map, FC connectivity, NVMe fabric,
26 array, and system.
27 author:
28 - Peng Wang (@wangpww)
29 - Sumit Kumar Gupta (@sumitguptaibm)
30 - Sandip Gulab Rajbanshi (@Sandip-Rajbanshi)
31 - Lavanya C R (@Lavanya-C-R1)
32 options:
33 clustername:
34 description:
35 - The hostname or management IP or Partition IP of the
36 Storage Virtualize system.
37 type: str
38 required: true
39 domain:
40 description:
41 - Domain for the Storage Virtualize system.
42 - Valid when hostname is used for the parameter I(clustername).
43 type: str
44 username:
45 description:
46 - REST API username for the Storage Virtualize system.
47 - The parameters I(username) and I(password) are required if not using I(token) to authenticate a user.
48 type: str
49 password:
50 description:
51 - REST API password for the Storage Virtualize system.
52 - The parameters I(username) and I(password) are required if not using I(token) to authenticate a user.
53 type: str
54 token:
55 description:
56 - The authentication token to verify a user on the Storage Virtualize system.
57 - To generate a token, use the ibm_svc_auth module.
58 type: str
59 version_added: '1.5.0'
60 log_path:
61 description:
62 - Path of debug log file.
63 type: str
64 validate_certs:
65 description:
66 - Validates certification.
67 default: false
68 type: bool
69 objectname:
70 description:
71 - If specified, only the instance with the I(objectname) is returned. If not specified, all the instances are returned.
72 - If I(objectname:"all") specified, display detailed output of all instances of all objects that are specified
73 in gather_subset and command_list.
74 - For entities that require objectname as a mandatory parameter, I(objectname:"all") will throw error.
75 type: str
76 filtervalue:
77 description:
78 - Specifies a set of one or more (key=value) combination separated by a colon that helps in returning a subset of objects satisfying the condition.
79 type: str
80 gather_subset:
81 type: list
82 elements: str
83 description:
84 - List of string variables to specify the Storage Virtualize entities
85 for which information is required.
86 - all - list of all Storage Virtualize entities
87 supported by the module.
88 - vol - lists information for VDisks.
89 - pool - lists information for mdiskgrps.
90 - node - lists information for nodes.
91 - iog - lists information for I/O groups.
92 - host - lists information for hosts.
93 - hostvdiskmap - lists all VDisks mapped to host 'objectname'
94 - vdiskhostmap - lists all hosts VDisk 'objectname' is mapped to
95 - hc - lists information for host clusters.
96 - fc - lists information for FC connectivity.
97 - fcport - lists information for FC ports.
98 - fabricport - list the FDMI information that is discovered by the system.
99 - targetportfc - lists information for WWPN which is required to set up
100 FC zoning and to display the current failover status
101 of host I/O ports.
102 - fcmap - lists information for FC maps.
103 - rcrelationship - lists information for remote copy relationships.
104 - fcconsistgrp - displays a concise list or a detailed
105 view of flash copy consistency groups.
106 - rcconsistgrp - displays a concise list or a detailed
107 view of remote copy consistency groups.
108 - iscsiport - lists information for iSCSI ports.
109 - vdiskcopy - lists information for volume copy.
110 - array - lists information for array MDisks.
111 - system - displays the storage system information.
112 - cloudaccount - lists all the configured cloud accounts.
113 - cloudaccountusage - lists the usage information about the configured cloud storage accounts.
114 - cloudimportcandidate - lists information about systems that have data that is stored in the cloud accounts.
115 - ldapserver - lists the most recent details for all configured Lightweight Directory Access Protocol (LDAP) servers.
116 - drive - lists the configuration information and drive vital product data (VPD).
117 - user - lists all the users that are created on the system.
118 - usergroup - lists the user groups that is created on the system.
119 - ownershipgroup - displays the ownership groups that are available in the system.
120 - partnership - lists all the clustered systems (systems) that are associated with the local system.
121 - replicationpolicy - lists all the replication policies on the system.
122 - cloudbackup - lists the volumes that have cloud snapshot enabled and volumes that have cloud snapshots in the cloud account.
123 - cloudbackupgeneration - lists any volume snapshots available on the specified volume. I(objectname) is a mandatory parameter.
124 - snapshotpolicy - lists all the snapshot policies on the system.
125 - snapshotpolicyschedule - lists all snapshot schedules on the system.
126 - volumegroup - lists all volume groups on the system.
127 - volumepopulation - list the population information about volumes of type clone or thinclone.
128 - volumegrouppopulation - list the information about volume groups of type clone or thinclone.
129 - volumegroupsnapshotpolicy - lists the snapshot policy attributes associated with a volume group on the system.
130 - volumesnapshot - lists all volume snapshots.
131 - dnsserver - lists the information for any Domain Name System (DNS) servers in the system.
132 - systemcertificate - lists the information about the current system Secure Sockets Layer (SSL) certificate.
133 - truststore - lists the current certificate stores.
134 - sra - command to check both secure remote assistance status and the time of the last login.
135 - syslogserver - lists the syslog servers that are configured on the clustered system.
136 - emailserver - lists the email servers that are configured on the system.
137 - emailuser - lists the Email event notification settings for all Email recipients,
138 an individual Email recipient, or a specified type (local or support) of an Email recipient.
139 - provisioningpolicy - lists the provisioning policies available on the system.
140 - volumegroupsnapshot - lists the snapshot objects available on the system.
141 - callhome - displays the status of the Call Home information that is sent to a server in the Cloud.
142 - ip - lists the currently configured IP addresses.
143 - portset - lists the currently configured portset on the system.
144 - safeguardedpolicy - lists the Safeguarded policies available on the system.
145 - mdisk - displays a concise list or a detailed view of managed disks (MDisks) visible to the system.
146 - safeguardedpolicyschedule - displays the Safeguarded backup schedule that is associated with Safeguarded policies.
147 - eventlog - displays the concise view of system event log
148 - enclosurestats - lists the most recent values (averaged) of all enclosure statistics.
149 - enclosurestatshistory - lists the history values of all enclosure statistics including power consumed,
150 temperature in fahrenheit and temperature in celsius.
151 - driveclass - lists all drive classes in the system
152 - security - display the current system Secure Sockets Layer (SSL) or Transport Layer Security (TLS) security and
153 password rules settings
154 - partition - display all the storage partitions information related to storage.
155 - volumegroupreplication - displays all the replication information for the volume group.
156 - plugin - display the information of registered plugins.
157 - quorum - display all the quorum devices that the system uses to store quorum data.
158 - enclosure - displays a summary of the enclosures.
159 - snmpserver - display a concise list or a detailed view of SNMP servers that are configured on the system
160 - testldapserver - tests a Lightweight Directory Access Protocol (LDAP) server.
161 - availablepatch - display the patches that are compatible with the SVC version.
162 - patch - displays a list of all the patches on a specific node.
163 - systempatches - displays patches installed on all the nodes in the system.
164 - grid - displays the summarized view of flashsystem grid.
165 - gridmembers - displays the summarized view of flashsystem grid members.
166 - gridsystem - displays the information about all systems in the flashsystem grid.
167 - gridpartition - displays the information about all partitions in the flashsystem grid.
168 choices: [vol, pool, node, iog, host, hostvdiskmap, vdiskhostmap, hc, fcport
169 , fabricport, iscsiport, fc, fcmap, fcconsistgrp, rcrelationship, rcconsistgrp
170 , vdiskcopy, targetportfc, array, system, 'cloudaccount', 'cloudaccountusage',
171 'ldapserver', 'drive', 'user', 'usergroup', 'ownershipgroup',
172 'partnership', 'replicationpolicy', 'cloudbackup', 'enclosurestats',
173 'cloudbackupgeneration', 'snapshotpolicy', 'snapshotpolicyschedule',
174 'volumegroup', 'volumepopulation', 'volumegrouppopulation', 'volumegroupsnapshotpolicy', 'volumesnapshot',
175 'dnsserver', 'systemcertificate', 'sra', 'syslogserver', 'enclosurestatshistory',
176 'emailserver', 'emailuser', 'provisioningpolicy', 'volumegroupsnapshot',
177 'truststore', 'callhome', 'ip', 'portset', 'safeguardedpolicy',
178 'mdisk', 'safeguardedpolicyschedule', 'cloudimportcandidate', 'eventlog', 'driveclass', 'security', 'partition',
179 'volumegroupreplication', 'plugin', 'quorum', 'enclosure', 'snmpserver', 'testldapserver', 'availablepatch',
180 'patch', 'systempatches', 'grid', 'gridmembers', 'gridsystem', 'gridpartition', all]
181 command_list:
182 type: list
183 elements: str
184 description:
185 - Specify to get information regarding any Storage Virtualize entities other than choices of gather_subset.
186 - Exact command has to be specified to use command_list (i.e. lssystemcert, lstimezones, lsportset etc.).
187 - Output will be stored in this way (i.e. lssystemcert -> Systemcert, lstimezones -> Timezones etc.).
188 notes:
189 - This module supports C(check_mode).
190 - If both I(gather_subset) and I(command_list) are not specified, ibm_svc_info will list information about I(default) objects.
191 - I(lsroute) and I(lsarraylba) commands are not covered.
192 - This module supports logging in via partition IP.
193 '''
194
195 EXAMPLES = '''
196 - name: Get volume info
197 ibm.storage_virtualize.ibm_svc_info:
198 clustername: "{{ clustername }}"
199 domain: "{{ domain }}"
200 username: "{{ username }}"
201 password: "{{ password }}"
202 log_path: /tmp/ansible.log
203 gather_subset: vol
204 - name: Get volume info
205 ibm.storage_virtualize.ibm_svc_info:
206 clustername: "{{ clustername }}"
207 domain: "{{ domain }}"
208 username: "{{ username }}"
209 password: "{{ password }}"
210 log_path: /tmp/ansible.log
211 objectname: volumename
212 gather_subset: vol
213 - name: Get pool info
214 ibm.storage_virtualize.ibm_svc_info:
215 clustername: "{{ clustername }}"
216 domain: "{{ domain }}"
217 username: "{{ username }}"
218 password: "{{ password }}"
219 log_path: /tmp/ansible.log
220 gather_subset: pool
221 - name: Get population information about volumes and volumegroups of type clone or thinclone
222 ibm.storage_virtualize.ibm_svc_info:
223 clustername: "{{ clustername }}"
224 domain: "{{ domain }}"
225 username: "{{ username }}"
226 password: "{{ password }}"
227 log_path: /tmp/ansible.log
228 gather_subset: ['volumepopulation', 'volumegrouppopulation']
229 - name: Get all info related to volume 'Volume1'
230 ibm.storage_virtualize.ibm_svc_info:
231 clustername: "{{ clustername }}"
232 domain: "{{ domain }}"
233 username: "{{ username }}"
234 password: "{{ password }}"
235 log_path: /tmp/ansible.log
236 gather_subset: vol
237 objectname: Volume1
238 - name: Get detailed info of all volumes.
239 ibm.storage_virtualize.ibm_svc_info:
240 clustername: "{{ clustername }}"
241 domain: "{{ domain }}"
242 username: "{{ username }}"
243 password: "{{ password }}"
244 log_path: /tmp/ansible.log
245 gather_subset: vol
246 objectname: all
247 - name: Get detailed info for objects returned by lsvdiskcopy using command_list.
248 ibm.storage_virtualize.ibm_svc_info:
249 clustername: "{{ clustername }}"
250 domain: "{{ domain }}"
251 username: "{{ username }}"
252 password: "{{ password }}"
253 log_path: /tmp/ansible.log
254 command_list: lsvdiskcopy
255 objectname: all
256 - name: Get detailed info of multiple objects using gather_subset and command_list.
257 ibm.storage_virtualize.ibm_svc_info:
258 clustername: "{{ clustername }}"
259 domain: "{{ domain }}"
260 username: "{{ username }}"
261 password: "{{ password }}"
262 log_path: /tmp/ansible.log
263 gather_subset: [vol, host]
264 command_list: [lsvdiskcopy, lssite]
265 objectname: all
266 - name: Get list of candidate drives info using filtervalue and gather_subset.
267 ibm.storage_virtualize.ibm_svc_info:
268 clustername: "{{ clustername }}"
269 domain: "{{ domain }}"
270 username: "{{ username }}"
271 password: "{{ password }}"
272 log_path: /tmp/ansible.log
273 gather_subset: drive
274 filtervalue: "use=candidate:status=online"
275 - name: Get list of replication type portsets info using filtervalue and command_list.
276 ibm.storage_virtualize.ibm_svc_info:
277 clustername: "{{ clustername }}"
278 domain: "{{ domain }}"
279 username: "{{ username }}"
280 password: "{{ password }}"
281 log_path: /tmp/ansible.log
282 command_list: lsportset
283 filtervalue: "type=replication"
284 '''
285
286 RETURN = '''
287 Array:
288 description:
289 - Data will be populated when I(gather_subset=array) or I(gather_subset=all)
290 - Lists information for array MDisks
291 returned: success
292 type: list
293 elements: dict
294 sample: [{...}]
295 CallHome:
296 description:
297 - Data will be populated when I(gather_subset=callhome) or I(gather_subset=all)
298 - Displays the status of the Call Home information that is sent to a server in the Cloud
299 returned: success
300 type: list
301 elements: dict
302 sample: [{...}]
303 CloudAccount:
304 description:
305 - Data will be populated when I(gather_subset=cloudaccount) or I(gather_subset=all)
306 - Lists all the configured cloud accounts
307 returned: success
308 type: list
309 elements: dict
310 sample: [{...}]
311 CloudAccountUsage:
312 description:
313 - Data will be populated when I(gather_subset=cloudaccountusage) or I(gather_subset=all)
314 - Lists the usage information about the configured cloud storage accounts
315 returned: success
316 type: list
317 elements: dict
318 sample: [{...}]
319 CloudBackup:
320 description:
321 - Data will be populated when I(gather_subset=cloudbackup) or I(gather_subset=all)
322 - Lists the volumes that have cloud snapshot that enabled and volumes that have cloud snapshots in the cloud account
323 returned: success
324 type: list
325 elements: dict
326 sample: [{...}]
327 CloudBackupGeneration:
328 description:
329 - Data will be populated when I(gather_subset=cloudbackupgeneration)
330 - List any volume snapshots available on the specified volume
331 returned: success
332 type: list
333 elements: dict
334 sample: [{...}]
335 CloudImportCandidate:
336 description:
337 - Data will be populated when I(gather_subset=cloudimportcandidate) or I(gather_subset=all)
338 - Lists information about systems that have data that is stored in the cloud accounts
339 returned: success
340 type: list
341 elements: dict
342 sample: [{...}]
343 DnsServer:
344 description:
345 - Data will be populated when I(gather_subset=dnsserver) or I(gather_subset=all)
346 - Lists the information for any Domain Name System (DNS) servers in the system
347 returned: success
348 type: list
349 elements: dict
350 sample: [{...}]
351 Drive:
352 description:
353 - Data will be populated when I(gather_subset=drive) or I(gather_subset=all)
354 - Lists the configuration information and drive vital product data (VPD)
355 returned: success
356 type: list
357 elements: dict
358 sample: [{...}]
359 EmailServer:
360 description:
361 - Data will be populated when I(gather_subset=emailserver) or I(gather_subset=all)
362 - Lists the Email servers that are configured on the system
363 returned: success
364 type: list
365 elements: dict
366 sample: [{...}]
367 EmailUser:
368 description:
369 - Data will be populated when I(gather_subset=emailuser) or I(gather_subset=all)
370 - Lists the Email event notification settings for all Email recipients,
371 an individual Email recipient, or a specified type (local or support) of Email recipient
372 returned: success
373 type: list
374 elements: dict
375 sample: [{...}]
376 FCConnectivity:
377 description:
378 - Data will be populated when I(gather_subset=fc) or I(gather_subset=all)
379 - Lists information for FC connectivity
380 returned: success
381 type: list
382 elements: dict
383 sample: [{...}]
384 FCConsistgrp:
385 description:
386 - Data will be populated when I(gather_subset=fcconsistgrp) or I(gather_subset=all)
387 - Displays a concise list or a detailed view of flash copy consistency groups
388 returned: success
389 type: list
390 elements: dict
391 sample: [{...}]
392 FCMap:
393 description:
394 - Data will be populated when I(gather_subset=fcmap) or I(gather_subset=all)
395 - Lists information for FC maps
396 returned: success
397 type: list
398 elements: dict
399 sample: [{...}]
400 FCPort:
401 description:
402 - Data will be populated when I(gather_subset=fcport) or I(gather_subset=all)
403 - Lists information for FC ports
404 returned: success
405 type: list
406 elements: dict
407 sample: [{...}]
408 FabricPort:
409 description:
410 - Data will be populated when I(gather_subset=fabricport) or I(gather_subset=all)
411 - List the FDMI information that is discovered by the system.
412 returned: success
413 type: list
414 elements: dict
415 sample: [{...}]
416 Host:
417 description:
418 - Data will be populated when I(gather_subset=host) or I(gather_subset=all)
419 - Lists information for hosts
420 returned: success
421 type: list
422 elements: dict
423 sample: [{...}]
424 HostCluster:
425 description:
426 - Data will be populated when I(gather_subset=hc) or I(gather_subset=all)
427 - Lists information for host clusters
428 returned: success
429 type: list
430 elements: dict
431 sample: [{...}]
432 HostVdiskMap:
433 description:
434 - Data will be populated when I(gather_subset=hostvdiskmap) or I(gather_subset=all)
435 - Lists all VDisks mapped to host 'objectname'
436 returned: success
437 type: list
438 elements: dict
439 sample: [{...}]
440 IOGroup:
441 description:
442 - Data will be populated when I(gather_subset=iog) or I(gather_subset=all)
443 - Lists information for I/O groups
444 returned: success
445 type: list
446 elements: dict
447 sample: [{...}]
448 IP:
449 description:
450 - Data will be populated when I(gather_subset=ip) or I(gather_subset=all)
451 - Lists the currently configured IP addresses
452 returned: success
453 type: list
454 elements: dict
455 sample: [{...}]
456 LdapServer:
457 description:
458 - Data will be populated when I(gather_subset=ldapserver) or I(gather_subset=all)
459 - Lists the most recent details for all configured Lightweight Directory Access Protocol (LDAP) servers
460 returned: success
461 type: list
462 elements: dict
463 sample: [{...}]
464 Mdisk:
465 description:
466 - Data will be populated when I(gather_subset=mdisk) or I(gather_subset=all)
467 - Displays a concise list or a detailed view of managed disks (MDisks) visible to the system
468 returned: success
469 type: list
470 elements: dict
471 sample: [{...}]
472 Node:
473 description:
474 - Data will be populated when I(gather_subset=node) or I(gather_subset=all)
475 - Lists information for nodes
476 returned: success
477 type: list
478 elements: dict
479 sample: [{...}]
480 Ownershipgroup:
481 description:
482 - Data will be populated when I(gather_subset=ownershipgroup) or I(gather_subset=all)
483 - Displays the ownership groups that are available in the system
484 returned: success
485 type: list
486 elements: dict
487 sample: [{...}]
488 Partnership:
489 description:
490 - Data will be populated when I(gather_subset=partnership) or I(gather_subset=all)
491 - Lists all the clustered systems (systems) that are associated with the local system
492 returned: success
493 type: list
494 elements: dict
495 sample: [{...}]
496 Pool:
497 description:
498 - Data will be populated when I(gather_subset=pool) or I(gather_subset=all)
499 - Lists information for mdiskgrps
500 returned: success
501 type: list
502 elements: dict
503 sample: [{...}]
504 Portset:
505 description:
506 - Data will be populated when I(gather_subset=portset) or I(gather_subset=all)
507 - Lists the currently configured portset on the system
508 returned: success
509 type: list
510 elements: dict
511 sample: [{...}]
512 ProvisioningPolicy:
513 description:
514 - Data will be populated when I(gather_subset=provisioningpolicy) or I(gather_subset=all)
515 - Lists the provisioning policies available on the system
516 returned: success
517 type: list
518 elements: dict
519 sample: [{...}]
520 RCConsistgrp:
521 description:
522 - Data will be populated when I(gather_subset=rcconsistgrp) or I(gather_subset=all)
523 - Displays a concise list or a detailed view of remote copy consistency groups
524 returned: success
525 type: list
526 elements: dict
527 sample: [{...}]
528 RemoteCopy:
529 description:
530 - Data will be populated when I(gather_subset=rcrelationship) or I(gather_subset=all)
531 - Lists information for remote copy relationships
532 returned: success
533 type: list
534 elements: dict
535 sample: [{...}]
536 ReplicationPolicy:
537 description:
538 - Data will be populated when I(gather_subset=replicationpolicy) or I(gather_subset=all)
539 - Lists all the replication policies on the system
540 returned: success
541 type: list
542 elements: dict
543 sample: [{...}]
544 SafeguardedPolicy:
545 description:
546 - Data will be populated when I(gather_subset=safeguardedpolicy) or I(gather_subset=all)
547 - Lists the Safeguarded policies available on the system
548 returned: success
549 type: list
550 elements: dict
551 sample: [{...}]
552 SafeguardedSchedule:
553 description:
554 - Data will be populated when I(gather_subset=safeguardedpolicyschedule) or I(gather_subset=all)
555 - Displays the Safeguarded backup schedule that is associated with Safeguarded policies
556 returned: success
557 type: list
558 elements: dict
559 sample: [{...}]
560 SnapshotPolicy:
561 description:
562 - Data will be populated when I(gather_subset=snapshotpolicy) or I(gather_subset=all)
563 - Lists all the snapshot policies on the system
564 returned: success
565 type: list
566 elements: dict
567 sample: [{...}]
568 SnapshotSchedule:
569 description:
570 - Data will be populated when I(gather_subset=snapshotpolicyschedule) or I(gather_subset=all)
571 - Lists all snapshot schedules on the system
572 returned: success
573 type: list
574 elements: dict
575 sample: [{...}]
576 Sra:
577 description:
578 - Data will be populated when I(gather_subset=sra) or I(gather_subset=all)
579 - Command to check both secure remote assistance status and the time of the last login
580 returned: success
581 type: list
582 elements: dict
583 sample: [{...}]
584 SysLogServer:
585 description:
586 - Data will be populated when I(gather_subset=syslogserver) or I(gather_subset=all)
587 - Lists the syslog servers that are configured on the clustered system
588 returned: success
589 type: list
590 elements: dict
591 sample: [{...}]
592 System:
593 description:
594 - Data will be populated when I(gather_subset=system) or I(gather_subset=all)
595 - Displays the storage system information
596 returned: success
597 type: list
598 elements: dict
599 sample: [{...}]
600 SystemCert:
601 description:
602 - Data will be populated when I(gather_subset=systemcertificate) or I(gather_subset=all)
603 - Lists the information about the current system Secure Sockets Layer (SSL) certificate
604 returned: success
605 type: list
606 elements: dict
607 sample: [{...}]
608 TargetPortFC:
609 description:
610 - Data will be populated when I(gather_subset=targetportfc) or I(gather_subset=all)
611 - Lists information for WWPN which is required to set up FC zoning and to display
612 the current failover status of host I/O ports
613 returned: success
614 type: list
615 elements: dict
616 sample: [{...}]
617 TrustStore:
618 description:
619 - Data will be populated when I(gather_subset=truststore) or I(gather_subset=all)
620 - Lists the current certificate stores
621 returned: success
622 type: list
623 elements: dict
624 sample: [{...}]
625 User:
626 description:
627 - Data will be populated when I(gather_subset=user) or I(gather_subset=all)
628 - Lists all the users that are created on the system
629 returned: success
630 type: list
631 elements: dict
632 sample: [{...}]
633 UserGrp:
634 description:
635 - Data will be populated when I(gather_subset=usergroup) or I(gather_subset=all)
636 - Lists the user groups that is created on the system
637 returned: success
638 type: list
639 elements: dict
640 sample: [{...}]
641 VdiskCopy:
642 description:
643 - Data will be populated when I(gather_subset=vdiskcopy) or I(gather_subset=all)
644 - Lists information for volume copy
645 returned: success
646 type: list
647 elements: dict
648 sample: [{...}]
649 VdiskHostMap:
650 description:
651 - Data will be populated when I(gather_subset=vdiskhostmap) or I(gather_subset=all)
652 - Lists all hosts the VDisk 'objectname' is mapped to
653 returned: success
654 type: list
655 elements: dict
656 sample: [{...}]
657 Volume:
658 description:
659 - Data will be populated when I(gather_subset=vol) or I(gather_subset=all)
660 - Lists information for VDisks
661 returned: success
662 type: list
663 elements: dict
664 sample: [{...}]
665 VolumeGroup:
666 description:
667 - Data will be populated when I(gather_subset=volumegroup) or I(gather_subset=all)
668 - Lists all volume groups on the system
669 returned: success
670 type: list
671 elements: dict
672 sample: [{...}]
673 VolumePopulation:
674 description:
675 - Data will be populated when I(gather_subset=volumepopulation) or I(gather_subset=all)
676 - Lists information about volumes of type clone or thinclone
677 returned: success
678 type: list
679 elements: dict
680 sample: [{...}]
681 VolumeGroupPopulation:
682 description:
683 - Data will be populated when I(gather_subset=volumegrouppopulation) or I(gather_subset=all)
684 - Lists information about volume groups of type clone or thinclone including source and in-progress restore
685 returned: success
686 type: list
687 elements: dict
688 sample: [{...}]
689 VolumeGroupSnapshot:
690 description:
691 - Data will be populated when I(gather_subset=volumegroupsnapshot) or I(gather_subset=all)
692 - Lists the snapshot objects available on the system based on volume group
693 returned: success
694 type: list
695 elements: dict
696 sample: [{...}]
697 VolumeGroupSnapshotPolicy:
698 description:
699 - Data will be populated when I(gather_subset=volumegroupsnapshotpolicy) or I(gather_subset=all)
700 - Lists view snapshot objects on the system
701 returned: success
702 type: list
703 elements: dict
704 sample: [{...}]
705 VolumeSnapshot:
706 description:
707 - Data will be populated when I(gather_subset=volumesnapshot) or I(gather_subset=all)
708 - Lists all volume snapshots
709 returned: success
710 type: list
711 elements: dict
712 sample: [{...}]
713 iSCSIPort:
714 description:
715 - Data will be populated when I(gather_subset=iscsiport) or I(gather_subset=all)
716 - Lists information for iSCSI ports
717 returned: success
718 type: list
719 elements: dict
720 sample: [{...}]
721 EventLog:
722 description:
723 - Data will be populated when I(gather_subset=eventlog) or I(gather_subset=all)
724 - Lists information about the system event log
725 returned: success
726 type: list
727 elements: dict
728 sample: [{...}]
729 EnclosureStats:
730 description:
731 - Data will be populated when I(gather_subset=enclosurestats) or I(gather_subset=all)
732 - Lists the most recent values (averaged) of all enclosure statistics.
733 returned: success
734 type: list
735 elements: dict
736 sample: [{...}]
737 EnclosureStatsHistory:
738 description:
739 - Data will be populated when I(gather_subset=enclosurestatshistory) or I(gather_subset=all)
740 - Lists the history values of all enclosure statistics including power consumed,
741 temperature in fahrenheit and temperature in celsius.
742 returned: success
743 type: list
744 elements: dict
745 sample: [{...}]
746 DriveClass:
747 description:
748 - Data will be populated when I(gather_subset=driveclass) or I(gather_subset=all)
749 - List all drive classes in the system
750 returned: success
751 type: list
752 elements: dict
753 sample: [{...}]
754 Security:
755 description:
756 - Data will be populated when I(gather_subset=security) or I(gather_subset=all)
757 - Displays current security settings of the system
758 returned: success
759 type: list
760 elements: dict
761 sample: [{...}]
762 Partition:
763 description:
764 - Data will be populated when I(gather_subset=partition) or I(gather_subset=all)
765 - Displays all storage partitions
766 returned: success
767 type: list
768 elements: dict
769 sample: [{...}]
770 Plugin:
771 description:
772 - Data will be populated when I(gather_subset=plugin) or I(gather_subset=all)
773 - Displays all registered plugins
774 returned: success
775 type: list
776 elements: dict
777 sample: [{...}]
778 Volumegroupreplication:
779 description:
780 - Data will be populated when I(gather_subset=volumegroupreplication) or I(gather_subset=all)
781 - Displays all replication for the volumegroup
782 returned: success
783 type: list
784 elements: dict
785 sample: [{...}]
786 Quorum:
787 description:
788 - Data will be populated when I(gather_subset=quorum) or I(gather_subset=all)
789 - list the quorum devices that the system uses to store quorum data.
790 returned: success
791 type: list
792 elements: dict
793 sample: [{...}]
794 Enclosure:
795 description:
796 - Data will be populated when I(gather_subset=enclosure) or I(gather_subset=all)
797 - Displays a summary of the enclosures.
798 returned: success
799 type: list
800 elements: dict
801 sample: [{...}]
802 Snmpserver:
803 description:
804 - Data will be populated when I(gather_subset=snmpserver) or I(gather_subset=all)
805 - Display a concise list or a detailed view of SNMP servers that are configured on the system
806 returned: success
807 type: list
808 elements: dict
809 sample: [{...}]
810 Testldapserver:
811 description:
812 - Data will be populated when I(gather_subset=testldapserver)
813 - Tests a Lightweight Directory Access Protocol (LDAP) server.
814 returned: success
815 type: list
816 elements: dict
817 sample: [{...}]
818 Availablepatch:
819 description:
820 - Data will be populated when I(gather_subset=availablepatch) or I(gather_subset=all)
821 - Display the patches that are compatible with the SVC version on the users system.
822 returned: success
823 type: list
824 elements: dict
825 sample: [{...}]
826 Patch:
827 description:
828 - Data will be populated when I(gather_subset=patch) or I(gather_subset=all)
829 - Displays a list of all the patches on a specific node in the system.
830 returned: success
831 type: list
832 elements: dict
833 sample: [{...}]
834 Systempatches:
835 description:
836 - Data will be populated when I(gather_subset=systempatches) or I(gather_subset=all)
837 - Displays patches installed on all the nodes in the system
838 returned: success
839 type: list
840 elements: dict
841 FlashsystemGrid:
842 description:
843 - Data will be populated when I(gather_subset=grid) or I(gather_subset=all)
844 - Displays summarized view of flashsystem grid.
845 returned: success
846 type: list
847 elements: dict
848 FlashsystemGridMembers:
849 description:
850 - Data will be populated when I(gather_subset=gridmembers) or I(gather_subset=all)
851 - Displays summarized view of flashsystem grid members.
852 returned: success
853 type: list
854 elements: dict
855 FlashsystemGridSystem:
856 description:
857 - Data will be populated when I(gather_subset=gridsystem) or I(gather_subset=all)
858 - Displays the information about all systems in the flashsystem grid.
859 returned: success
860 type: list
861 elements: dict
862 FlashsystemGridPartition:
863 description:
864 - Data will be populated when I(gather_subset=gridpartition) or I(gather_subset=all)
865 - Displays the information about all partitions in the flashsystem grid.
866 returned: success
867 type: list
868 elements: dict
869 '''
870
871 from traceback import format_exc
872 from ansible.module_utils.basic import AnsibleModule
873 from ansible_collections.ibm.storage_virtualize.plugins.module_utils.ibm_svc_utils import IBMSVCRestApi, svc_argument_spec, get_logger
874 from ansible.module_utils._text import to_native
875
876
877 class IBMSVCGatherInfo(object):
878 def __init__(self):
879 argument_spec = svc_argument_spec()
880
881 argument_spec.update(
882 dict(
883 objectname=dict(type='str'),
884 filtervalue=dict(type='str'),
885 gather_subset=dict(type='list', elements='str', required=False,
886 choices=['vol',
887 'pool',
888 'node',
889 'iog',
890 'host',
891 'hostvdiskmap',
892 'vdiskhostmap',
893 'hc',
894 'fc',
895 'fcport',
896 'fabricport',
897 'targetportfc',
898 'iscsiport',
899 'fcmap',
900 'rcrelationship',
901 'fcconsistgrp',
902 'rcconsistgrp',
903 'vdiskcopy',
904 'array',
905 'system',
906 'cloudaccount',
907 'cloudaccountusage',
908 'cloudimportcandidate',
909 'ldapserver',
910 'drive',
911 'user',
912 'usergroup',
913 'ownershipgroup',
914 'partnership',
915 'replicationpolicy',
916 'cloudbackup',
917 'cloudbackupgeneration',
918 'snapshotpolicy',
919 'snapshotpolicyschedule',
920 'volumegroup',
921 'volumepopulation',
922 'volumegrouppopulation',
923 'volumegroupsnapshotpolicy',
924 'volumesnapshot',
925 'dnsserver',
926 'systemcertificate',
927 'truststore',
928 'sra',
929 'syslogserver',
930 'emailserver',
931 'emailuser',
932 'provisioningpolicy',
933 'volumegroupsnapshot',
934 'callhome',
935 'ip',
936 'portset',
937 'safeguardedpolicy',
938 'mdisk',
939 'safeguardedpolicyschedule',
940 'eventlog',
941 'enclosurestats',
942 'enclosurestatshistory',
943 'driveclass',
944 'security',
945 'partition',
946 'plugin',
947 'volumegroupreplication',
948 'quorum',
949 'enclosure',
950 'snmpserver',
951 'testldapserver',
952 'availablepatch',
953 'patch',
954 'systempatches',
955 'grid',
956 'gridmembers',
957 'gridsystem',
958 'gridpartition',
959 'all'
960 ]),
961 command_list=dict(type='list', elements='str', required=False)
962 )
963 )
964
965 self.module = AnsibleModule(argument_spec=argument_spec,
966 supports_check_mode=True)
967
968 # logging setup
969 log_path = self.module.params['log_path']
970 self.log = get_logger(self.__class__.__name__, log_path)
971 self.subset = self.module.params['gather_subset']
972 self.objectname = self.module.params['objectname']
973 self.filtervalue = self.module.params['filtervalue']
974 self.command_list = self.module.params['command_list']
975
976 self.basic_checks()
977
978 self.restapi = IBMSVCRestApi(
979 module=self.module,
980 clustername=self.module.params['clustername'],
981 domain=self.module.params['domain'],
982 username=self.module.params['username'],
983 password=self.module.params['password'],
984 validate_certs=self.module.params['validate_certs'],
985 log_path=log_path,
986 token=self.module.params['token']
987 )
988
989 def basic_checks(self):
990 if self.command_list == ["all"]:
991 self.module.fail_json(msg="command_list parameter cannot be specified as 'all'")
992 if self.subset == ["all"] and self.objectname == "all":
993 self.module.fail_json(msg="gather_subset and objectname both cannot be specified as 'all' at the same time.")
994 if not self.subset and not self.command_list and self.objectname:
995 self.module.fail_json(msg="objectname(%s) is specified while gather_subset or command_list is not "
996 "specified" % (self.objectname))
997 if self.filtervalue:
998 if (self.subset and self.command_list) or (not self.subset and not self.command_list):
999 self.module.fail_json(msg="filtervalue must be accompanied with a single object either in gather_subset or command_list")
1000 elif self.subset:
1001 if len(self.subset) != 1:
1002 self.module.fail_json(msg="filtervalue must be accompanied with a single object either in gather_subset or command_list")
1003 elif self.subset[0] == "all":
1004 self.module.fail_json(msg="filtervalue is not supported when gather_subset is specified as 'all'")
1005 elif self.command_list:
1006 if len(self.command_list) != 1:
1007 self.module.fail_json(msg="filtervalue must be accompanied with a single object either in gather_subset or command_list")
1008
1009 def validate(self, subset):
1010 if not self.objectname:
1011 self.module.fail_json(msg='Following parameter is mandatory to execute {0}: objectname'.format(subset))
1012 if self.objectname == "all":
1013 self.module.fail_json(msg="Objectname specified as 'all' which is invalid for the gather_subset [%s]" % subset)
1014
1015 @property
1016 def cloudbackupgeneration(self):
1017 return self.restapi.svc_obj_info(
1018 cmd='lsvolumebackupgeneration',
1019 cmdopts={'volume': self.objectname},
1020 cmdargs=None
1021 )
1022
1023 @property
1024 def enclosurestatshistory(self):
1025 return self.restapi.svc_obj_info(
1026 cmd='lsenclosurestats',
1027 cmdopts={'history': 'power_w:temp_c:temp_f'},
1028 cmdargs=[self.objectname]
1029 )
1030
1031 def filter_value_out(self, cmd, cmdargs):
1032 op_key = self.restapi.svc_obj_info(
1033 cmd=cmd,
1034 cmdopts={'filtervalue': self.filtervalue},
1035 cmdargs=cmdargs
1036 )
1037 return op_key
1038
1039 def get_list(self, subset, op_key, cmd, validate):
1040 try:
1041 svc_obj_out = None
1042 output = {}
1043 if validate is True:
1044 self.validate(subset)
1045 elif validate == "check":
1046 svc_obj_out = self.restapi.svc_obj_info(cmd=cmd,
1047 cmdopts=None,
1048 cmdargs=None)
1049 if not svc_obj_out:
1050 output[op_key] = None
1051 return output
1052 if "CMMVC5707E" in str(svc_obj_out):
1053 self.module.fail_json(msg="CMMVC5707E Required parameters for command [%s] are missing or "
1054 "specified parameters are invalid" % cmd)
1055 elif "CMMVC5767E" in str(svc_obj_out):
1056 self.module.fail_json(msg="CMMVC5767E One or more of the parameters specified are invalid or "
1057 "a parameter is missing for commamd [%s]." % cmd)
1058 elif svc_obj_out == 404 or "CMMVC7205E" in str(svc_obj_out):
1059 self.module.fail_json(msg="Command [%s] not found or "
1060 "CMMVC7205E command [%s] is not supported on current svc version." % cmd)
1061 '''
1062 Handle these errors internally
1063 error-codes:
1064 CMMVC5707E - Required parameters are missing.
1065 CMMVC5767E - One or more of the parameters specified are invalid or a parameter is missing.
1066 CMMVC7205E - The command failed because it is not supported.
1067 '''
1068 exceptions = {'cloudbackupgeneration', 'enclosurestatshistory'}
1069 if subset in exceptions:
1070 output[op_key] = getattr(self, subset)
1071 else:
1072 cmdargs = None
1073 op_key_list = []
1074 if self.objectname:
1075 if self.filtervalue:
1076 output[op_key] = self.filter_value_out(cmd, [self.objectname])
1077 return output
1078 if self.objectname == "all":
1079 if cmd == "lsdumps":
1080 all_node_info = self.restapi.svc_obj_info(cmd="lsnodecanister",
1081 cmdopts=None,
1082 cmdargs=None)
1083 for node in all_node_info:
1084 op_key_list.append(self.restapi.svc_obj_info(cmd=cmd,
1085 cmdopts=None,
1086 cmdargs=[node["id"]]))
1087 output[op_key] = op_key_list
1088 return output
1089 elif cmd == "lscurrentuser":
1090 output[op_key] = svc_obj_out
1091 return output
1092 else:
1093 if svc_obj_out:
1094 get_all_objects = svc_obj_out
1095 else:
1096 get_all_objects = self.restapi.svc_obj_info(cmd=cmd,
1097 cmdopts=None,
1098 cmdargs=None)
1099 try:
1100 id_name = str(list(get_all_objects[0])[0])
1101 '''
1102 To get name of 1st column of svc_obj_info output which contain objectname i.e. id/name,
1103 generally 1st column is id
1104 '''
1105 except Exception as e:
1106 id_name = None
1107 if id_name:
1108 list_object = [] # Getting all ID's in list_object
1109 for obj in get_all_objects:
1110 list_object.append(obj[id_name])
1111 if len(list_object) == len(set(list_object)): # Those commands in which all ids are unique (ex. lsmdisk, lsvdisk etc)
1112 cnt = 0
1113 for object_id in list_object:
1114 op_key_list.append(self.restapi.svc_obj_info(cmd=cmd,
1115 cmdopts=None,
1116 cmdargs=[object_id]))
1117 if cnt == 0:
1118 cnt += 1
1119 '''
1120 Checking in first iteration only,
1121 whether id can be specifed with command or not (lscommand <id>)
1122 '''
1123 first_object = op_key_list[0]
1124 if not first_object:
1125 output[op_key] = get_all_objects
1126 '''
1127 If output is None (i.e. lscommand <id> is invalid), return concise output,
1128 No need to iterate over loop (ex. lscompatibilitymode, lscopystatus,
1129 lsfcmapcandidate, lsfcportcandidate, lsfeature, lsiogrpcandidate,
1130 lsrcrelationshipcandidate, lssite, lssystemlimits, lstimezones,
1131 lsvdiskanalysisprogress etc.)
1132 '''
1133 return output
1134 elif len(get_all_objects[0]) == len(first_object):
1135 output[op_key] = get_all_objects
1136 '''
1137 If output is equal to concise output, then break the loop and return concise output,
1138 further iteration not required (ex. lsfcportsetmember, lsportset,
1139 lsprovisioningpolicy, lsquorum, lssystemsupportcenter, lstargetportfc,
1140 lstruststore, lsusergrp, lsvolumegrouppopulation, lsvolumegroupsnapshotpolicy,
1141 lsvolumegroupsnapshotschedule etc.)
1142 '''
1143 return output
1144
1145 output[op_key] = op_key_list
1146 else:
1147 output[op_key] = get_all_objects
1148 '''
1149 When multiple objects have same id, return concise output.
1150 (ex. lsarraymember, lsarraymembergoals, lsenclosurecanister, lsenclosurefanmodule,
1151 lsenclosurepsu, lsenclosureslot, lsenclosurestats, lsfabric, lsnodestats, lsportethernet,
1152 lsportip, lssnapshotschedule, lsvdiskaccess, lsvolumesnapshot etc.)
1153 '''
1154 return output
1155 else:
1156 output[op_key] = get_all_objects
1157 '''
1158 In few cases id is not mentioned or id is invalid with command lscommand <id>.
1159 (ex. lsauthmultifactorduo, lsauthmultifactorverify, lsauthsinglesignon, lscloudcallhome,
1160 lsencryption, lskeyserverisklm, lsldap, lslicense, lsnodestatus, lsproxy, lssecurity, lssra,
1161 lssystem, lssystemcert, lssystemethernet, lsgrid, lsgridmembers etc.)
1162 '''
1163 return output
1164 else:
1165 output[op_key] = self.restapi.svc_obj_info(cmd=cmd,
1166 cmdopts=None,
1167 cmdargs=[self.objectname])
1168 return output
1169 else:
1170 if self.filtervalue:
1171 output[op_key] = self.filter_value_out(cmd, None)
1172 return output
1173 output[op_key] = self.restapi.svc_obj_info(cmd=cmd,
1174 cmdopts=None,
1175 cmdargs=cmdargs)
1176 return output
1177 self.log.info('Successfully listed %d %s info '
1178 'from cluster %s', len(subset), subset,
1179 self.module.params['clustername'])
1180 return output
1181 except Exception as e:
1182 msg = 'Getting %s info from cluster %s failed with error %s ' % \
1183 (subset, self.module.params['clustername'], str(e))
1184 self.log.error(msg)
1185 self.module.fail_json(msg=msg)
1186
1187 def apply(self):
1188 subset = self.subset
1189 command_list = self.command_list
1190 if command_list:
1191 if subset:
1192 subset += command_list
1193 else:
1194 subset = command_list
1195 if not subset:
1196 subset = ['all']
1197 if len(subset) == 0 or 'all' in subset:
1198 self.log.info("The default value for gather_subset is all")
1199
1200 result = {
1201 'Volume': [],
1202 'Pool': [],
1203 'Node': [],
1204 'IOGroup': [],
1205 'Host': [],
1206 'HostVdiskMap': [],
1207 'VdiskHostMap': [],
1208 'HostCluster': [],
1209 'FCConnectivity': [],
1210 'FCConsistgrp': [],
1211 'RCConsistgrp': [],
1212 'VdiskCopy': [],
1213 'FCPort': [],
1214 'FabricPort': [],
1215 'TargetPortFC': [],
1216 'iSCSIPort': [],
1217 'FCMap': [],
1218 'RemoteCopy': [],
1219 'Array': [],
1220 'System': [],
1221 'CloudAccount': [],
1222 'CloudAccountUsage': [],
1223 'CloudImportCandidate': [],
1224 'LdapServer': [],
1225 'Drive': [],
1226 'User': [],
1227 'Partnership': [],
1228 'ReplicationPolicy': [],
1229 'SnapshotPolicy': [],
1230 'VolumeGroup': [],
1231 'VolumePopulation': [],
1232 'VolumeGroupPopulation': [],
1233 'SnapshotSchedule': [],
1234 'VolumeGroupSnapshotPolicy': [],
1235 'VolumeSnapshot': [],
1236 'DnsServer': [],
1237 'SystemCert': [],
1238 'TrustStore': [],
1239 'Sra': [],
1240 'SysLogServer': [],
1241 'UserGrp': [],
1242 'EmailServer': [],
1243 'EmailUser': [],
1244 'CloudBackup': [],
1245 'CloudBackupGeneration': [],
1246 'ProvisioningPolicy': [],
1247 'VolumeGroupSnapshot': [],
1248 'CallHome': [],
1249 'IP': [],
1250 'Ownershipgroup': [],
1251 'Portset': [],
1252 'SafeguardedPolicy': [],
1253 'Mdisk': [],
1254 'SafeguardedSchedule': [],
1255 'EventLog': [],
1256 'DriveClass': [],
1257 'Security': [],
1258 'Partition': [],
1259 'Plugin': [],
1260 'Volumegroupreplication': [],
1261 'Quorum': [],
1262 'Enclosure': [],
1263 'Snmpserver': [],
1264 'Testldapserver': [],
1265 'Availablepatch': [],
1266 'Patch': [],
1267 'FlashsystemGrid': [],
1268 'FlashsystemGridMembers': [],
1269 'FlashsystemGridSystem': [],
1270 'FlashsystemGridPartition': [],
1271 'Systempatches': []
1272 }
1273
1274 cmd_mappings = {
1275 'vol': ('Volume', 'lsvdisk', False, None),
1276 'pool': ('Pool', 'lsmdiskgrp', False, None),
1277 'node': ('Node', 'lsnode', False, None),
1278 'iog': ('IOGroup', 'lsiogrp', False, None),
1279 'host': ('Host', 'lshost', False, None),
1280 'hostvdiskmap': ('HostVdiskMap', 'lshostvdiskmap', False, None),
1281 'vdiskhostmap': ('VdiskHostMap', 'lsvdiskhostmap', True, None),
1282 'hc': ('HostCluster', 'lshostcluster', False, '7.7.1.0'),
1283 'fc': ('FCConnectivity', 'lsfabric', False, None),
1284 'fcport': ('FCPort', 'lsportfc', False, None),
1285 'fabricport': ('FabricPort', 'lsfabricport', False, '8.6.0.0'),
1286 'iscsiport': ('iSCSIPort', 'lsportip', False, None),
1287 'fcmap': ('FCMap', 'lsfcmap', False, None),
1288 'rcrelationship': ('RemoteCopy', 'lsrcrelationship', False, None),
1289 'fcconsistgrp': ('FCConsistgrp', 'lsfcconsistgrp', False, None),
1290 'rcconsistgrp': ('RCConsistgrp', 'lsrcconsistgrp', False, None),
1291 'vdiskcopy': ('VdiskCopy', 'lsvdiskcopy', False, None),
1292 'targetportfc': ('TargetPortFC', 'lstargetportfc', False, '7.7.0.0'),
1293 'array': ('Array', 'lsarray', False, None),
1294 'system': ('System', 'lssystem', False, '6.3.0.0'),
1295 'cloudaccount': ('CloudAccount', 'lscloudaccount', False, '7.8.0.0'),
1296 'cloudaccountusage': ('CloudAccountUsage', 'lscloudaccountusage', False, '7.8.0.0'),
1297 'cloudimportcandidate': ('CloudImportCandidate', 'lscloudaccountimportcandidate', False, '7.8.0.0'),
1298 'ldapserver': ('LdapServer', 'lsldapserver', False, '6.3.0.0'),
1299 'drive': ('Drive', 'lsdrive', False, None),
1300 'user': ('User', 'lsuser', False, None),
1301 'usergroup': ('UserGrp', 'lsusergrp', False, None),
1302 'ownershipgroup': ('Ownershipgroup', 'lsownershipgroup', False, '8.3.0.0'),
1303 'partnership': ('Partnership', 'lspartnership', False, '6.3.0.0'),
1304 'replicationpolicy': ('ReplicationPolicy', 'lsreplicationpolicy', False, '8.5.2.0'),
1305 'cloudbackup': ('CloudBackup', 'lsvolumebackup', False, '7.8.0.0'),
1306 'cloudbackupgeneration': ('CloudBackupGeneration', 'lsvolumebackupgeneration', True, '7.8.0.0'),
1307 'snapshotpolicy': ('SnapshotPolicy', 'lssnapshotpolicy', False, '8.5.1.0'),
1308 'snapshotpolicyschedule': ('SnapshotSchedule', 'lssnapshotschedule', False, '8.5.1.0'),
1309 'volumegroup': ('VolumeGroup', 'lsvolumegroup', False, '7.8.0.0'),
1310 'volumepopulation': ('VolumePopulation', 'lsvolumepopulation', False, '8.5.1.0'),
1311 'volumegrouppopulation': ('VolumeGroupPopulation', 'lsvolumegrouppopulation', False, '8.5.1.0'),
1312 'volumegroupsnapshotpolicy': ('VolumeGroupSnapshotPolicy', 'lsvolumegroupsnapshotpolicy', False, '8.5.1.0'),
1313 'volumesnapshot': ('VolumeSnapshot', 'lsvolumesnapshot', False, '8.5.1.0'),
1314 'dnsserver': ('DnsServer', 'lsdnsserver', False, '7.8.0.0'),
1315 'systemcertificate': ('SystemCert', 'lssystemcert', False, '7.6.0.0'),
1316 'truststore': ('TrustStore', 'lstruststore', False, '8.5.1.0'),
1317 'sra': ('Sra', 'lssra', False, '7.7.0.0'),
1318 'syslogserver': ('SysLogServer', 'lssyslogserver', False, None),
1319 'emailserver': ('EmailServer', 'lsemailserver', False, None),
1320 'emailuser': ('EmailUser', 'lsemailuser', False, None),
1321 'provisioningpolicy': ('ProvisioningPolicy', 'lsprovisioningpolicy', False, '8.4.1.0'),
1322 'volumegroupsnapshot': ('VolumeGroupSnapshot', 'lsvolumegroupsnapshot', False, '8.5.1.0'),
1323 'callhome': ('CallHome', 'lscloudcallhome', False, '8.2.1.0'),
1324 'ip': ('IP', 'lsip', False, '8.4.2.0'),
1325 'portset': ('Portset', 'lsportset', False, '8.4.2.0'),
1326 'safeguardedpolicy': ('SafeguardedPolicy', 'lssafeguardedpolicy', False, '8.4.2.0'),
1327 'mdisk': ('Mdisk', 'lsmdisk', False, None),
1328 'safeguardedpolicyschedule': ('SafeguardedSchedule', 'lssafeguardedschedule', False, '8.4.2.0'),
1329 'eventlog': ('EventLog', 'lseventlog', False, None),
1330 'enclosurestats': ('EnclosureStats', 'lsenclosurestats', False, None),
1331 'enclosurestatshistory': ('EnclosureStatsHistory', 'lsenclosurestats -history power_w:temp_c:temp_f', True, None),
1332 'driveclass': ('DriveClass', 'lsdriveclass', False, '7.6.0.0'),
1333 'security': ('Security', 'lssecurity', False, '7.4.0.0'),
1334 'partition': ('Partition', 'lspartition', False, '8.6.1.0'),
1335 'plugin': ('Plugin', 'lsplugin', False, '8.6.0.0'),
1336 'volumegroupreplication': ('Volumegroupreplication', 'lsvolumegroupreplication', False, '8.5.2.0'),
1337 'quorum': ('Quorum', 'lsquorum', False, None),
1338 'enclosure': ('Enclosure', 'lsenclosure', False, None),
1339 'snmpserver': ('Snmpserver', 'lssnmpserver', False, None),
1340 'testldapserver': ('Testldapserver', 'testldapserver', False, '6.3.0.0'),
1341 'availablepatch': ('Availablepatch', 'lsavailablepatch', False, '8.7.0.0'),
1342 'patch': ('Patch', 'lspatch', False, '8.5.4.0'),
1343 'systempatches': ('Systempatches', 'lssystempatches', False, '8.5.4.0'),
1344 'grid': ('FlashsystemGrid', 'lsgrid', False, '8.7.1.0'),
1345 'gridmembers': ('FlashsystemGridMembers', 'lsgridmembers', False, '8.7.2.0'),
1346 'gridsystem': ('FlashsystemGridSystem', 'lsgridsystem', False, '8.7.3.0'),
1347 'gridpartition': ('FlashsystemGridPartition', 'lsgridpartition', False, '8.7.2.0')
1348 }
1349 if command_list:
1350 for cmd in command_list:
1351 if cmd[:2] == "ls":
1352 op_key = cmd[2:].capitalize()
1353 else:
1354 op_key = cmd.capitalize()
1355 cmd_mappings[cmd] = (op_key, cmd, "check")
1356
1357 if subset == ['all']:
1358 current_set = cmd_mappings.keys()
1359 else:
1360 current_set = subset
1361 build_version = ''
1362 for key in current_set:
1363 value_tuple = cmd_mappings[key]
1364 if subset == ['all']:
1365 version = value_tuple[3]
1366 if value_tuple[2]:
1367 continue
1368 elif not version:
1369 pass
1370 else:
1371 if build_version == '':
1372 system_info = self.restapi.svc_obj_info(cmd='lssystem', cmdargs=[], cmdopts=None)
1373 build_version = (system_info['code_level'].split(" ")[0]).split(".")
1374 version = value_tuple[3].split('.')
1375 flag = True
1376 for idx in range(4):
1377 if int(version[idx]) > int(build_version[idx]):
1378 flag = False
1379 elif int(version[idx]) < int(build_version[idx]):
1380 break
1381 if not flag:
1382 continue
1383 op = self.get_list(key, *value_tuple[:3])
1384 result.update(op)
1385
1386 self.module.exit_json(**result)
1387
1388
1389 def main():
1390 v = IBMSVCGatherInfo()
1391 try:
1392 v.apply()
1393 except Exception as e:
1394 v.log.debug("Exception in apply(): \n%s", format_exc())
1395 v.module.fail_json(msg="Module failed. Error [%s]." % to_native(e))
1396
1397
1398 if __name__ == '__main__':
1399 main()