Esempio n. 1
0
    def create_sw_upgrade_strategy(self, storage_apply_type,
                                   compute_apply_type,
                                   max_parallel_compute_hosts,
                                   alarm_restrictions, start_upgrade,
                                   complete_upgrade, callback):
        """
        Create Software Upgrade Strategy
        """
        strategy_uuid = str(uuid.uuid4())

        if self._sw_update is not None:
            # Do not schedule the callback - if creation failed because a
            # strategy already exists, the callback will attempt to operate
            # on the old strategy, which is not what we want.
            reason = "strategy already exists"
            return None, reason

        self._sw_update = objects.SwUpgrade()
        success, reason = self._sw_update.strategy_build(
            strategy_uuid, storage_apply_type, compute_apply_type,
            max_parallel_compute_hosts, alarm_restrictions, start_upgrade,
            complete_upgrade, self._ignore_alarms)

        schedule.schedule_function_call(callback, success, reason,
                                        self._sw_update.strategy)
        return strategy_uuid, ''
Esempio n. 2
0
    def create_sw_patch_strategy(self, controller_apply_type,
                                 storage_apply_type, swift_apply_type,
                                 compute_apply_type,
                                 max_parallel_compute_hosts,
                                 default_instance_action, alarm_restrictions,
                                 callback):
        """
        Create Software Patch Strategy
        """
        strategy_uuid = str(uuid.uuid4())

        if self._sw_update is not None:
            # Do not schedule the callback - if creation failed because a
            # strategy already exists, the callback will attempt to operate
            # on the old strategy, which is not what we want.
            reason = "strategy already exists"
            return None, reason

        self._sw_update = objects.SwPatch()
        success, reason = self._sw_update.strategy_build(
            strategy_uuid, controller_apply_type, storage_apply_type,
            swift_apply_type, compute_apply_type, max_parallel_compute_hosts,
            default_instance_action, alarm_restrictions, self._ignore_alarms,
            self._single_controller)

        schedule.schedule_function_call(callback, success, reason,
                                        self._sw_update.strategy)
        return strategy_uuid, ''
Esempio n. 3
0
 def abort_sw_update_strategy(self, strategy_uuid, stage_id, callback):
     """
     Abort Software Update Strategy
     """
     success, reason = self._sw_update.strategy_abort(strategy_uuid, stage_id)
     schedule.schedule_function_call(callback, success, reason,
                                     self._sw_update.strategy)
     return
Esempio n. 4
0
 def delete_sw_update_strategy(self, strategy_uuid, force, callback):
     """
     Delete Software Update Strategy
     """
     success, reason = self._sw_update.strategy_delete(strategy_uuid, force)
     if success:
         self._sw_update.remove()
         del self._sw_update
         self._sw_update = None
     schedule.schedule_function_call(callback, success, reason, strategy_uuid)
     return