'Verify that a rebuilding server is rebuilt.
Raise error if it ends up in an ERROR state.'

def check_rebuild(self, server_id):

    server = self.fetch_server(server_id)
    if ((server is None) or (server.status == 'REBUILD')):
        return False
    if (server.status == 'ERROR'):
        raise exception.Error((_("Rebuilding    server    failed,    status    '%s'") % server.status))
    else:
        return True
