def __init__(self):

        self.argument_spec = netapp_utils.ontap_sf_host_argument_spec()
        self.argument_spec.update(
            dict(
                state=dict(required=True, choices=['present', 'absent']),
                name=dict(required=True, type='str'),
                time_interval_days=dict(required=False, type='int', default=1),
                time_interval_hours=dict(required=False, type='int',
                                         default=0),
                time_interval_minutes=dict(required=False,
                                           type='int',
                                           default=0),
                paused=dict(required=False, type='bool'),
                recurring=dict(required=False, type='bool'),
                starting_date=dict(type='str'),
                snapshot_name=dict(required=False, type='str'),
                volumes=dict(required=False, type='list'),
                retention=dict(required=False, type='str'),
                schedule_id=dict(type='int'),
            ))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    required_if=[('state', 'present',
                                                  ['starting_date',
                                                   'volumes'])],
                                    supports_check_mode=True)

        p = self.module.params

        # set up state variables
        self.state = p['state']
        self.name = p['name']

        # self.interval = p['interval']

        self.time_interval_days = p['time_interval_days']
        self.time_interval_hours = p['time_interval_hours']
        self.time_interval_minutes = p['time_interval_minutes']

        self.paused = p['paused']
        self.recurring = p['recurring']

        self.starting_date = p['starting_date']
        if self.starting_date is not None:
            self.starting_date = self.starting_date.replace("--", "-")

        self.snapshot_name = p['snapshot_name']
        self.volumes = p['volumes']
        self.retention = p['retention']

        self.schedule_id = p['schedule_id']

        self.create_schedule_result = None

        if HAS_SF_SDK is False:
            self.module.fail_json(
                msg="Unable to import the SolidFire Python SDK")
        else:
            self.sfe = netapp_utils.create_sf_connection(module=self.module)
Esempio n. 2
0
    def __init__(self):
        self.argument_spec = netapp_utils.ontap_sf_host_argument_spec()
        self.argument_spec.update(
            dict(
                state=dict(required=True, choices=['present', 'absent']),
                name=dict(required=True, type='str'),
                account_id=dict(required=False, type='int', default=None),
                new_name=dict(required=False, type='str', default=None),
                initiator_secret=dict(required=False, type='str'),
                target_secret=dict(required=False, type='str'),
                attributes=dict(required=False, type='dict'),
                status=dict(required=False, type='str'),
            ))

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

        p = self.module.params

        # set up state variables
        self.state = p['state']
        self.name = p['name']
        self.account_id = p['account_id']

        self.new_name = p['new_name']
        self.initiator_secret = p['initiator_secret']
        self.target_secret = p['target_secret']
        self.attributes = p['attributes']
        self.status = p['status']

        if HAS_SF_SDK is False:
            self.module.fail_json(
                msg="Unable to import the SolidFire Python SDK")
        else:
            self.sfe = netapp_utils.create_sf_connection(module=self.module)
Esempio n. 3
0
    def __init__(self):

        self._size_unit_map = netapp_utils.SF_BYTE_MAP

        self.argument_spec = netapp_utils.ontap_sf_host_argument_spec()
        self.argument_spec.update(
            dict(
                state=dict(required=True, choices=['present', 'absent']),
                name=dict(required=True, type='str'),
                account_id=dict(required=True, type='int'),
                enable512e=dict(type='bool', aliases=['512emulation']),
                qos=dict(required=False, type='dict', default=None),
                attributes=dict(required=False, type='dict', default=None),
                volume_id=dict(type='int', default=None),
                size=dict(type='int'),
                size_unit=dict(default='gb',
                               choices=[
                                   'bytes', 'b', 'kb', 'mb', 'gb', 'tb', 'pb',
                                   'eb', 'zb', 'yb'
                               ],
                               type='str'),
                access=dict(required=False,
                            type='str',
                            default=None,
                            choices=[
                                'readOnly', 'readWrite', 'locked',
                                'replicationTarget'
                            ]),
            ))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    required_if=[('state', 'present',
                                                  ['size', 'enable512e'])],
                                    supports_check_mode=True)

        p = self.module.params

        # set up state variables
        self.state = p['state']
        self.name = p['name']
        self.account_id = p['account_id']
        self.enable512e = p['enable512e']
        self.qos = p['qos']
        self.attributes = p['attributes']

        self.volume_id = p['volume_id']
        self.size_unit = p['size_unit']
        if p['size'] is not None:
            self.size = p['size'] * self._size_unit_map[self.size_unit]
        else:
            self.size = None
        self.access = p['access']
        if HAS_SF_SDK is False:
            self.module.fail_json(
                msg="Unable to import the SolidFire Python SDK")
        else:
            self.sfe = netapp_utils.create_sf_connection(module=self.module)
    def __init__(self):

        self.argument_spec = netapp_utils.ontap_sf_host_argument_spec()
        self.argument_spec.update(
            dict(
                state=dict(required=True, choices=['present', 'absent']),
                name=dict(required=True, type='str'),
                volume_access_group_id=dict(required=False,
                                            type='int',
                                            default=None),
                initiators=dict(required=False, type='list', default=None),
                volumes=dict(required=False, type='list', default=None),
                virtual_network_id=dict(required=False,
                                        type='list',
                                        default=None),
                virtual_network_tags=dict(required=False,
                                          type='list',
                                          default=None),
                attributes=dict(required=False, type='dict', default=None),
            ))

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

        p = self.module.params

        # set up state variables
        self.state = p['state']
        self.name = p['name']
        self.volume_access_group_id = p['volume_access_group_id']

        self.initiators = p['initiators']
        self.volumes = p['volumes']
        self.virtual_network_id = p['virtual_network_id']
        self.virtual_network_tags = p['virtual_network_tags']
        self.attributes = p['attributes']

        if HAS_SF_SDK is False:
            self.module.fail_json(
                msg="Unable to import the SolidFire Python SDK")
        else:
            self.sfe = netapp_utils.create_sf_connection(module=self.module)