Ask Your Question
2

how to delete aggregates

asked 2015-08-28 04:48:37 -0500

akqzx gravatar image

updated 2015-08-28 05:21:07 -0500

Hello I use

nova service delete *id*

delete compute node,

and then I can delete an aggregates with compute node

root@controller:~# nova aggregate-list

+----+------+-------------------+

| Id | Name | Availability Zone |

+----+------+-------------------+

| 1  | ALL  | ALL               |

+----+------+-------------------+

root@controller:~# nova aggregate-details 1

+----+------+-------------------+--------------------------+-------------------------+

| Id | Name | Availability Zone | Hosts                    | Metadata                |

+----+------+-------------------+--------------------------+-------------------------+

| 1  | ALL  | ALL               | 'compute11', 'compute21' | 'availability_zone=ALL' |

+----+------+-------------------+--------------------------+-------------------------+

root@controller:~# nova aggregate-remove-host ALL compute11

ERROR (NotFound): Cannot remove host compute11 in aggregate 1 (HTTP 404) (Request-ID: req-8e19a2fb-1db3-47d4-bf9e-99c0cc86ce26)

I try to delete it in the database,

MariaDB [nova]> select * from aggregates;

+---------------------+---------------------+------------+----+------+---------+

| created_at          | updated_at          | deleted_at | id | name | deleted |

+---------------------+---------------------+------------+----+------+---------+

| 2015-07-30 02:59:58 | 2015-08-28 09:20:08 | NULL       |  1 | ALL  |       0 |

+---------------------+---------------------+------------+----+------+---------+

1 row in set (0.00 sec)


MariaDB [nova]> select * from aggregate_host;

ERROR 1146 (42S02): Table 'nova.aggregate_host' doesn't exist

MariaDB [nova]> select * from aggregate_hosts;

+---------------------+------------+------------+----+-----------+--------------+---------+

| created_at          | updated_at | deleted_at | id | host      | aggregate_id | deleted |

+---------------------+------------+------------+----+-----------+--------------+---------+

| 2015-07-30 03:00:30 | NULL       | NULL       |  1 | compute11 |            1 |       0 |

| 2015-07-30 15:00:49 | NULL       | NULL       |  2 | compute21 |            1 |       0 |

+---------------------+------------+------------+----+-----------+--------------+---------+

2 rows in set (0.00 sec)


MariaDB [nova]> delete from aggregate_host where id=1;

ERROR 1146 (42S02): Table 'nova.aggregate_host' doesn't exist

how can I delete the aggregate.

edit retag flag offensive close merge delete

3 answers

Sort by » oldest newest most voted
-1

answered 2015-08-30 10:01:40 -0500

akqzx gravatar image
MariaDB [(none)]> SET foreign_key_checks=0;
MariaDB [(none)]> truncate table aggregates;
MariaDB [(none)]> SET foreign_key_checks=1;

nova aggregate-delete "ID"
edit flag offensive delete link more
1

answered 2015-11-07 06:04:56 -0500

frz59 gravatar image

No need to access mariaDB directly to delete host aggregates. You must use nova command.

[root@n1 ~]# . keystonerc_admin
[root@n1 ~(keystone_admin)]# nova aggregate-create test-aggregate1
+----+-----------------+-------------------+-------+----------+
| Id | Name            | Availability Zone | Hosts | Metadata |
+----+-----------------+-------------------+-------+----------+
| 1  | test-aggregate1 | -                 |       |          |
+----+-----------------+-------------------+-------+----------+
[root@n1 ~(keystone_admin)]# nova aggregate-delete 1
Aggregate 1 has been successfully deleted.
[root@n1 ~(keystone_admin)]# nova aggregate-list
+----+------+-------------------+
| Id | Name | Availability Zone |
+----+------+-------------------+
+----+------+-------------------+
[root@n1 ~(keystone_admin)]#
edit flag offensive delete link more
0

answered 2015-08-29 16:13:32 -0500

sgordon gravatar image

updated 2015-08-30 09:16:51 -0500

Per your SQL queries, you are mixing your usage of aggregate_host and aggregate_hosts as the table name. In your delete query you reference the former (which per the result of the earlier select doesn't exist) instead of the latter. This would have worked:

MariaDB [nova]> delete from aggregate_hosts where id=1;

Note that this removes the host from the aggregate, to remove the aggregate entirely you would need to use nova aggregate-delete.

edit flag offensive delete link more

Comments

Hello I used this

MariaDB [(none)]> SET foreign_key_checks=0;
MariaDB [(none)]> truncate table aggregates;
akqzx gravatar imageakqzx ( 2015-08-30 09:57:06 -0500 )edit

That deletes the aggregate, which is what nova aggregate-delete does, but leaves you with the hanging references to it in aggregate_hosts. It would have been better to use the original delete query in your question with the correct table name and then use nova aggregate-delete.

sgordon gravatar imagesgordon ( 2015-09-01 09:38:13 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2015-08-28 04:48:37 -0500

Seen: 1,529 times

Last updated: Nov 07 '15