コード例 #1
0
ファイル: direct_engine.py プロジェクト: stannie42/sahara
    def _delete_aa_server_group(self, cluster):
        if cluster.anti_affinity:
            server_group_name = g.generate_aa_group_name(cluster.name)
            client = nova.client().server_groups

            server_groups = client.findall(name=server_group_name)
            if len(server_groups) == 1:
                client.delete(server_groups[0].id)
コード例 #2
0
    def _delete_aa_server_group(self, cluster):
        if cluster.anti_affinity:
            server_group_name = g.generate_aa_group_name(cluster.name)
            client = nova.client().server_groups

            server_groups = client.findall(name=server_group_name)
            if len(server_groups) == 1:
                client.delete(server_groups[0].id)
コード例 #3
0
ファイル: engine.py プロジェクト: AlexanderYAPPO/sahara
    def _delete_aa_server_group(self, cluster):
        if cluster.anti_affinity:
            server_group_name = g.generate_aa_group_name(cluster.name)
            client = nova.client().server_groups

            server_groups = b.execute_with_retries(client.findall,
                                                   name=server_group_name)
            if len(server_groups) == 1:
                b.execute_with_retries(client.delete, server_groups[0].id)
コード例 #4
0
ファイル: engine.py プロジェクト: uladz/sahara
    def _delete_aa_server_group(self, cluster):
        if cluster.anti_affinity:
            server_group_name = g.generate_aa_group_name(cluster.name)
            client = nova.client().server_groups

            server_groups = b.execute_with_retries(client.findall,
                                                   name=server_group_name)
            if len(server_groups) == 1:
                b.execute_with_retries(client.delete, server_groups[0].id)
コード例 #5
0
    def _create_aa_server_group(self, cluster):
        server_group_name = g.generate_aa_group_name(cluster.name)
        client = nova.client().server_groups

        if client.findall(name=server_group_name):
            raise exc.InvalidDataException(
                _("Server group with name %s is already exists") %
                server_group_name)

        server_group = client.create(name=server_group_name,
                                     policies=['anti-affinity'])
        return server_group.id
コード例 #6
0
ファイル: direct_engine.py プロジェクト: stannie42/sahara
    def _create_aa_server_group(self, cluster):
        server_group_name = g.generate_aa_group_name(cluster.name)
        client = nova.client().server_groups

        if client.findall(name=server_group_name):
            raise exc.InvalidDataException(
                _("Server group with name %s is already exists")
                % server_group_name)

        server_group = client.create(name=server_group_name,
                                     policies=['anti-affinity'])
        return server_group.id
コード例 #7
0
    def _find_aa_server_group(self, cluster):
        server_group_name = g.generate_aa_group_name(cluster.name)
        server_groups = nova.client().server_groups.findall(
            name=server_group_name)

        if len(server_groups) > 1:
            raise exc.IncorrectStateError(
                _("Several server groups with name %s found") %
                server_group_name)

        if len(server_groups) == 1:
            return server_groups[0].id

        return None
コード例 #8
0
ファイル: direct_engine.py プロジェクト: stannie42/sahara
    def _find_aa_server_group(self, cluster):
        server_group_name = g.generate_aa_group_name(cluster.name)
        server_groups = nova.client().server_groups.findall(
            name=server_group_name)

        if len(server_groups) > 1:
            raise exc.IncorrectStateError(
                _("Several server groups with name %s found")
                % server_group_name)

        if len(server_groups) == 1:
            return server_groups[0].id

        return None
コード例 #9
0
    def _delete_aa_server_groups(self, cluster):
        if cluster.anti_affinity:
            for i in range(1, cluster.anti_affinity_ratio):
                server_group_name = g.generate_aa_group_name(cluster.name, i)

                client = nova.client().server_groups

                server_groups = b.execute_with_retries(client.findall,
                                                       name=server_group_name)
                if len(server_groups) == 1:
                    b.execute_with_retries(client.delete, server_groups[0].id)
                '''In case the server group is created
                using mitaka or older version'''
                old_server_group_name = server_group_name.rsplit('-', 1)[0]
                server_groups_old = b.execute_with_retries(
                    client.findall, name=old_server_group_name)
                if len(server_groups_old) == 1:
                    b.execute_with_retries(client.delete,
                                           server_groups_old[0].id)
コード例 #10
0
def _get_aa_group_name(cluster_name):
    return g.generate_aa_group_name(cluster_name)
コード例 #11
0
def _get_aa_group_name(cluster_name):
    return g.generate_aa_group_name(cluster_name)
コード例 #12
0
def _get_aa_group_name(cluster, server_group_index):
    return g.generate_aa_group_name(cluster.name, server_group_index)
コード例 #13
0
ファイル: templates.py プロジェクト: openstack/sahara
def _get_aa_group_name(cluster, server_group_index):
    return g.generate_aa_group_name(cluster.name, server_group_index)