示例#1
0
    def __init__(self):
        """ Define all the parameters required by this module"""
        self.module_params = utils.get_powermax_management_host_parameters()
        self.module_params.update(get_port_parameters())
        # initialize the ansible module
        self.module = AnsibleModule(argument_spec=self.module_params,
                                    supports_check_mode=False)
        # result is a dictionary that contains changed status and port details
        self.result = {"changed": False, "port_details": {}}
        if HAS_PYU4V is False:
            self.show_error_exit(msg="Ansible modules for PowerMax require "
                                 "the PyU4V python library to be "
                                 "installed. Please install the library "
                                 "before using these modules.")

        if PYU4V_VERSION_CHECK is not None:
            self.show_error_exit(msg=PYU4V_VERSION_CHECK)

        if self.module.params['universion'] is not None:
            universion_details = utils.universion_check(
                self.module.params['universion'])
            LOG.info("universion_details: %s", universion_details)

            if not universion_details['is_valid_universion']:
                self.show_error_exit(msg=universion_details['user_message'])

        # Getting PyU4V instance for provisioning on to VMAX
        try:
            self.u4v_conn = utils.get_U4V_connection(
                self.module.params, application_type=APPLICATION_TYPE)
        except Exception as e:
            self.show_error_exit(msg=str(e))
        self.provisioning = self.u4v_conn.provisioning
        LOG.info("Got PyU4V instance for provisioning on to VMAX")
示例#2
0
    def __init__(self):
        """Define all the parameters required by this module"""

        self.module_params = utils.get_powermax_management_host_parameters()
        self.module_params.update(get_rdf_group_parameters())
        self.module = AnsibleModule(argument_spec=self.module_params,
                                    supports_check_mode=False)

        if HAS_PYU4V is False:
            self.show_error_exit(msg="Ansible modules for PowerMax require "
                                 "the PyU4V python library to be "
                                 "installed. Please install the library "
                                 "before using these modules.")

        if PYU4V_VERSION_CHECK is not None:
            self.show_error_exit(msg=PYU4V_VERSION_CHECK)

        if self.module.params['universion'] is not None:
            universion_details = utils.universion_check(
                self.module.params['universion'])
            LOG.info("universion_details: %s", universion_details)

            if not universion_details['is_valid_universion']:
                self.show_error_exit(msg=universion_details['user_message'])

        try:
            self.u4v_conn = utils.get_U4V_connection(
                self.module.params, application_type=APPLICATION_TYPE)
        except Exception as e:
            self.show_error_exit(msg=str(e))
        self.replication = self.u4v_conn.replication
        LOG.info('Got PyU4V instance for replication on to PowerMax ')
示例#3
0
    def __init__(self):
        ''' Define all parameters required by this module'''
        self.module_params = utils.get_powermax_management_host_parameters()
        self.module_params.update(self.get_srdf_pair_parameters())
        # initialize the ansible module
        self.module = AnsibleModule(argument_spec=self.module_params,
                                    supports_check_mode=True)
        # result is a dictionary that contains changed status, srdf_link
        # and job details
        self.result = {
            "changed": False,
            "SRDF_link_details": {},
            "Job_details": {}
        }
        if HAS_PYU4V is False:
            self.show_error_exit(msg="Ansible modules for PowerMax require "
                                 "the PyU4V python library to be "
                                 "installed. Please install the library "
                                 "before using these modules.")

        if PYU4V_VERSION_CHECK is not None:
            self.show_error_exit(msg=PYU4V_VERSION_CHECK)

        if self.module.params['universion'] is not None:
            universion_details = utils.universion_check(
                self.module.params['universion'])
            LOG.info("universion_details: %s", universion_details)

            if not universion_details['is_valid_universion']:
                self.show_error_exit(msg=universion_details['user_message'])

        try:
            self.u4v_conn = utils.get_U4V_connection(
                self.module.params, application_type=APPLICATION_TYPE)
        except Exception as e:
            self.show_error_exit(msg=str(e))
        self.replication = self.u4v_conn.replication
        LOG.info('Check Mode flag is %s', self.module.check_mode)
        LOG.info('Got PyU4V instance for replication on PowerMax ')
        self.idempotency_dict = {
            'Synchronized': ['Establish', 'Resume'],
            'Consistent': ['Establish', 'Resume'],
            'Suspended': ['Suspend'],
            'Failed Over': ['Failover'],
            'SyncInProg': ['Establish', 'Resume'],
        }

        self.idempotency_dict_metro = {
            'Suspended': ['Suspend'],
            'SyncInProg': ['Establish'],
            'ActiveActive': ['Establish'],
            'ActiveBias': ['Establish']
        }

        self.current_rdfg_no = None
示例#4
0
    def __init__(self):
        """ Define all parameters required by this module"""
        self.module_params = utils.get_powermax_management_host_parameters()
        self.module_params.update(get_volume_parameters())

        mutually_exclusive = [['vol_id', 'vol_name'], ['vol_id', 'vol_wwn'],
                              ['vol_name', 'vol_wwn']]

        required_one_of = [['vol_id', 'vol_name', 'vol_wwn']]

        # initialize the ansible module
        self.module = AnsibleModule(argument_spec=self.module_params,
                                    supports_check_mode=True,
                                    mutually_exclusive=mutually_exclusive,
                                    required_one_of=required_one_of)

        # result is a dictionary that contains changed status and
        # volume details
        self.result = {"changed": False, "volume_details": {}}
        if HAS_PYU4V is False:
            self.show_error_exit(msg="Ansible modules for PowerMax require "
                                 "the PyU4V python library to be "
                                 "installed. Please install the library "
                                 "before using these modules.")

        if PYU4V_VERSION_CHECK is not None:
            self.show_error_exit(msg=PYU4V_VERSION_CHECK)

        if self.module.params['universion'] is not None:
            universion_details = utils.universion_check(
                self.module.params['universion'])
            LOG.info("universion_details: %s", universion_details)

            if not universion_details['is_valid_universion']:
                self.show_error_exit(msg=universion_details['user_message'])

        try:
            self.u4v_conn = utils.get_U4V_connection(
                self.module.params, application_type=APPLICATION_TYPE)
        except Exception as e:
            self.show_error_exit(msg=str(e))
        LOG.info('Check Mode Flag %s', self.module.check_mode)
        LOG.info('Got PyU4V instance for provisioning on to VMAX ')
        self.provisioning = self.u4v_conn.provisioning
        self.replication = self.u4v_conn.replication
        self.common = self.u4v_conn.common
        self.foxtail_version = '5978.444.444'
示例#5
0
    def __init__(self):
        ''' Define all parameters required by this module'''
        self.module_params = utils.get_powermax_management_host_parameters()
        self.module_params.update(get_host_parameters())

        mutually_exclusive = [['host_flags', 'host_type']]
        required_together = [['initiators', 'initiator_state']]

        # initialize the ansible module
        self.module = AnsibleModule(
            argument_spec=self.module_params,
            supports_check_mode=True,
            mutually_exclusive=mutually_exclusive,
            required_together=required_together
        )
        # result is a dictionary that contains changed status and host details
        self.result = {"changed": False, "host_details": {}}
        if HAS_PYU4V is False:
            self.show_error_exit(msg="Ansible modules for PowerMax require "
                                 "the PyU4V python library to be "
                                 "installed. Please install the library "
                                 "before using these modules.")

        if PYU4V_VERSION_CHECK is not None:
            self.show_error_exit(msg=PYU4V_VERSION_CHECK)

        if self.module.params['universion'] is not None:
            universion_details = utils.universion_check(
                self.module.params['universion'])
            LOG.info("universion_details: %s", universion_details)

            if not universion_details['is_valid_universion']:
                self.show_error_exit(msg=universion_details['user_message'])

        try:
            self.u4v_conn = utils.get_U4V_connection(
                self.module.params, application_type=APPLICATION_TYPE)
        except Exception as e:
            self.show_error_exit(msg=str(e))
        self.provisioning = self.u4v_conn.provisioning
        self.host_flags_list = ['volume_set_addressing', 'environ_set',
                                'disable_q_reset_on_ua', 'openvms',
                                'avoid_reset_broadcast', 'scsi_3',
                                'spc2_protocol_version', 'scsi_support1']
        LOG.info('Check Mode Flag %s', self.module.check_mode)
        LOG.info('Got PyU4V instance for provisioning on PowerMax ')
示例#6
0
    def __init__(self):
        """ Initialises attributes required for snapshot policy operations
        """

        self.module_params = utils.get_powermax_management_host_parameters()
        self.module_params.update(get_snapshotpolicy_parameters())

        required_together = [['storage_groups', 'storage_group_state']]

        self.module = AnsibleModule(
            argument_spec=self.module_params,
            required_together=required_together,
            supports_check_mode=True)

        if HAS_PYU4V is False:
            msg = "Ansible modules for PowerMax require the PyU4V python " \
                  "library to be installed. Please install the library " \
                  "before using these modules"
            self.show_error_exit(msg, close_conn=False)

        if PYU4V_VERSION_CHECK is not None:
            self.show_error_exit(PYU4V_VERSION_CHECK, close_conn=False)

        self.pre_check_for_PyU4V_version()

        if self.module.params["universion"] is not None:
            universion_details = utils.universion_check(
                self.module.params["universion"])
            LOG.info("universion_details: %s", universion_details)

            if not universion_details["is_valid_universion"]:
                self.show_error_exit(
                    universion_details["user_message"], close_conn=False)

        try:
            self.conn = utils.get_U4V_connection(
                self.module.params, application_type=APPLICATION_TYPE)
            self.snapshot_policy = self.conn.snapshot_policy
            self.provisioning = self.conn.provisioning
            self.replication = self.conn.replication
        except Exception as e:
            self.show_error_exit(str(e))
        LOG.info("Got PyU4V instance for snapshot policy on PowerMax")
        LOG.info('Check Mode flag is %s', self.module.check_mode)
示例#7
0
    def __init__(self):
        """Define all the parameters required by this module"""

        self.module_params = get_info_parameters()
        self.module = AnsibleModule(argument_spec=self.module_params,
                                    supports_check_mode=False)
        serial_no = self.module.params['serial_no']
        if HAS_PYU4V is False:
            self.show_error_exit(msg="Ansible modules for PowerMax require "
                                 "the PyU4V python library to be "
                                 "installed. Please install the library "
                                 "before using these modules.")
        if PYU4V_VERSION_CHECK is not None:
            self.show_error_exit(msg=PYU4V_VERSION_CHECK)

        if self.module.params['universion'] is not None:
            universion_details = utils.universion_check(
                self.module.params['universion'])
            LOG.info("universion_details: %s", universion_details)

            if not universion_details['is_valid_universion']:
                self.show_error_exit(msg=universion_details['user_message'])

        try:
            if serial_no == '':
                self.u4v_unisphere_con = utils.get_u4v_unisphere_connection(
                    self.module.params, APPLICATION_TYPE)
                self.common = self.u4v_unisphere_con.common
                LOG.info("Got PyU4V Unisphere instance for common lib method "
                         "access on Powermax")
            else:
                self.module_params.update(
                    utils.get_powermax_management_host_parameters())
                self.u4v_conn = utils.get_U4V_connection(
                    self.module.params, application_type=APPLICATION_TYPE)
                self.provisioning = self.u4v_conn.provisioning
                self.u4v_conn.set_array_id(serial_no)
                LOG.info('Got PyU4V instance for provisioning on to PowerMax')
                self.replication = self.u4v_conn.replication
                LOG.info('Got PyU4V instance for replication on to PowerMax')
        except Exception as e:
            self.show_error_exit(msg=str(e))
示例#8
0
    def __init__(self):
        """Define all the parameters required by this module"""
        self.module_params = utils.get_powermax_management_host_parameters()
        self.module_params.update(get_snapshot_parameters())

        # initialize the Ansible module
        mutually_exclusive = [['generation', 'snapshot_id']]
        self.module = AnsibleModule(
            argument_spec=self.module_params,
            mutually_exclusive=mutually_exclusive,
            supports_check_mode=True
        )

        if HAS_PYU4V is False:
            self.show_error_exit(
                msg="Ansible modules for PowerMax require "
                    "the PyU4V python library to be "
                    "installed. Please install the library "
                    "before using these modules.")

        if PYU4V_VERSION_CHECK is not None:
            self.show_error_exit(msg=PYU4V_VERSION_CHECK)

        if self.module.params['universion'] is not None:
            universion_details = utils.universion_check(
                self.module.params['universion'])
            LOG.info("universion_details: %s", universion_details)

            if not universion_details['is_valid_universion']:
                self.show_error_exit(msg=universion_details['user_message'])

        try:
            self.u4v_conn = utils.get_U4V_connection(
                self.module.params, application_type=APPLICATION_TYPE)
        except Exception as e:
            self.show_error_exit(msg=str(e))
        self.replication = self.u4v_conn.replication
        self.common = self.u4v_conn.common
        LOG.info('Check Mode flag is %s', self.module.check_mode)
        LOG.info('Got PyU4V instance for provisioning on PowerMax ')
示例#9
0
    def __init__(self):
        ''' Define all parameters required by this module'''
        self.module_params = utils.get_powermax_management_host_parameters()
        self.module_params.update(get_initiator_parameters())
        mutually_exclusive = [['initiator_id', 'alias']]
        required_one_of = [
            ['initiator_id', 'alias']
        ]
        # initialize the ansible module
        self.module = AnsibleModule(
            argument_spec=self.module_params,
            mutually_exclusive=mutually_exclusive,
            required_one_of=required_one_of
        )
        if HAS_PYU4V is False:
            self.show_error_exit(msg="Ansible modules for PowerMax require "
                                 "the PyU4V python library to be "
                                 "installed. Please install the library "
                                 "before using these modules.")

        if PYU4V_VERSION_CHECK is not None:
            self.show_error_exit(msg=PYU4V_VERSION_CHECK)

        if self.module.params['universion'] is not None:
            universion_details = utils.universion_check(
                self.module.params['universion'])
            LOG.info("universion_details: %s", universion_details)

            if not universion_details['is_valid_universion']:
                self.show_error_exit(msg=universion_details['user_message'])

        try:
            self.u4v_conn = utils.get_U4V_connection(
                self.module.params, application_type=APPLICATION_TYPE)
        except Exception as e:
            self.show_error_exit(msg=str(e))
        self.provisioning = self.u4v_conn.provisioning
        LOG.info('Got PyU4V instance for provisioning on PowerMax ')