def create_stack(self, name, run):
        if not self.template:
            raise ProviderException("Template not set for provider %s." %
                                    self.name)

        try:
            self.logger.info('Creating OpenStack Heat stack [%s]' % name)
            res = self.heat_c.stacks.create(
                stack_name=name,
                template=self.template,
                environment=self.environment,
                parameters={'run': run}
            )
        except (HTTPException, HttpError) as e:
            raise ProviderException(e)

        stack_id = res['stack']['id']

        # Sleep to avoid throttling.
        self.sleep()

        try:
            heat_stack = self.heat_c.stacks.get(stack_id=stack_id)
        except (HTTPException, HttpError) as e:
            raise ProviderException(e)

        status = heat_stack.stack_status

        # Wait for stack creation
        while IN_PROGRESS in status:
            self.sleep()

            try:
                heat_stack = self.heat_c.stacks.get(stack_id=heat_stack.id)
            except HTTPNotFound:
                raise ProviderException("OpenStack Heat stack "
                                        "disappeared during creation.")
            except (HTTPException, HttpError) as e:
                raise ProviderException(e)

            status = heat_stack.stack_status

        if FAILED in status:
            raise ProviderException("Failure creating OpenStack Heat stack.")

        return {"status": status,
                "outputs": self._get_stack_outputs(heat_stack)}