Exemplo n.º 1
0
    def create_schedule(self):

        try:
            sched = netapp_utils.Schedule()
            # if self.interval == 'time_interval':
            sched.frequency = netapp_utils.TimeIntervalFrequency(
                days=self.time_interval_days,
                hours=self.time_interval_hours,
                minutes=self.time_interval_minutes)

            # Create schedule
            sched.name = self.name
            sched.schedule_info = netapp_utils.ScheduleInfo(
                volume_ids=self.volumes,
                snapshot_name=self.snapshot_name,
                retention=self.retention)
            sched.paused = self.paused
            sched.recurring = self.recurring
            sched.starting_date = self.starting_date

            self.create_schedule_result = self.sfe.create_schedule(
                schedule=sched)

        except Exception as e:
            self.module.fail_json(msg='Error creating schedule %s: %s' %
                                  (self.name, to_native(e)),
                                  exception=traceback.format_exc())
Exemplo n.º 2
0
    def create_schedule(self):
        # Create schedule
        try:
            frequency = self.get_frequency()
            if frequency is None:
                self.module.fail_json(
                    msg=
                    'Failed to create schedule frequency object - type %s parameters'
                    % self.schedule_type)

            # Create schedule
            name = self.name
            schedule_info = netapp_utils.ScheduleInfo(
                volume_ids=self.volumes,
                snapshot_name=self.snapshot_name,
                retention=self.retention)

            sched = netapp_utils.Schedule(schedule_info, name, frequency)
            sched.paused = self.paused
            sched.recurring = self.recurring
            sched.starting_date = self.starting_date

            self.create_schedule_result = self.sfe.create_schedule(sched)

        except Exception as e:
            self.module.fail_json(msg='Error creating schedule %s: %s' %
                                  (self.name, to_native(e.message)),
                                  exception=traceback.format_exc())