Пример #1
0
    def batch_add_instances(self, group, instances):
        """Batch add instances for auto scaling group

        :param group: The group which instances will be added to,
                The value can be the ID of a group or a
                :class:`~openstack.auto_scaling.v2.group.Group` instance.
        :param list instances: The list item value can be ID of an instance
            or a :class:`~openstack.auto_scaling.v2.instance.Instance` instance
        """
        group = self._get_resource(_group.Group, group)
        instance = _instance.Instance(scaling_group_id=group.id)
        return instance.batch_add(self._session, instances)
Пример #2
0
    def batch_remove_instances(self, group, instances, delete_instance=False):
        """Batch remove instances of auto scaling group

         precondition:
        * the instance must in ``INSERVICE`` status
        * after batch remove the current instance number of auto scaling group
            should not be less than min instance number
        * The own auto scaling group should not in scaling status
        :param group: The group of instances that to be removed, The value can
                be the ID of a group or a
                :class:`~openstack.auto_scaling.v2.group.Group` instance.
        :param list instances: The list item value can be ID of an instance
            or a :class:`~openstack.auto_scaling.v2.instance.Instance` instance
        :param bool delete_instance: When set to ``True``, instance will be
                deleted after removed
        """
        group = self._get_resource(_group.Group, group)
        instance = _instance.Instance(scaling_group_id=group.id)
        return instance.batch_remove(self._session,
                                     instances,
                                     delete_instance=delete_instance)