예제 #1
0
    def resize(self, new_capacity):
        """
        Resize the instance group to the new capacity.

        When shrinking, the newest instances will be removed.
        """
        new_template = self._create_template(new_capacity)
        result = self.update_with_template(new_template, {})
        for resource in self.nested():
            if resource.state == ('CREATE', 'FAILED'):
                resource.destroy()
        self._lb_reload()
        return result
예제 #2
0
파일: autoscaling.py 프로젝트: jirwin/heat
    def resize(self, new_capacity):
        """
        Resize the instance group to the new capacity.

        When shrinking, the newest instances will be removed.
        """
        new_template = self._create_template(new_capacity)
        result = self.update_with_template(new_template, {})
        for resource in self.nested():
            if resource.state == ('CREATE', 'FAILED'):
                resource.destroy()
        self._lb_reload()
        return result
예제 #3
0
파일: autoscaling.py 프로젝트: jirwin/heat
    def check_create_complete(self, task):
        """
        When stack creation is done, update the load balancer.

        If any instances failed to be created, delete them.
        """
        try:
            done = super(InstanceGroup, self).check_create_complete(task)
        except exception.Error as exc:
            for resource in self.nested():
                if resource.state == ('CREATE', 'FAILED'):
                    resource.destroy()
            raise
        if done and len(self.get_instances()):
            self._lb_reload()
        return done
예제 #4
0
    def check_create_complete(self, task):
        """
        When stack creation is done, update the load balancer.

        If any instances failed to be created, delete them.
        """
        try:
            done = super(InstanceGroup, self).check_create_complete(task)
        except exception.Error as exc:
            for resource in self.nested():
                if resource.state == ('CREATE', 'FAILED'):
                    resource.destroy()
            raise
        if done and len(self.get_instances()):
            self._lb_reload()
        return done