初步了解了一些openstack zone的使用方法,觉得比较实用,在此分享给大家:
# nova aggregate-list
Print a list of all aggregates.
# nova aggregate-create <name> <availability-zone>
Create a new aggregate named <name> in availability zone <availability-zone>. Returns the ID of the newly created aggregate.
# nova aggregate-delete <id>
Delete an aggregate with id <id>.
# nova aggregate-details <id>
Show details of the aggregate with id <id>.
# nova aggregate-add-host <id> <host>
Add host with name <host> to aggregate with id <id>.
# nova aggregate-remove-host <id> <host>
Remove the host with name <host> from the aggregate with id <id>.
# nova aggregate-set-metadata <id> <key=value> [<key=value> ...]
Add or update metadata (key-value pairs) associated with the aggregate with id <id>.
# nova aggregate-update <id> <name> [<availability_zone>]
Update the aggregate's name and optionally availability zone.
# nova host-list
List all hosts by service.
# nova host-update --maintenance [enable | disable]
Put/resume host into/from maintenance.
http://docs.openstack.org/grizzly/openstack-compute/admin/content/host-aggregates.html
举例:
[root@openstack ~]# nova aggregate-list
+----+------+-------------------+
| Id | Name | Availability Zone |
+----+------+-------------------+
+----+------+-------------------+
[root@openstack03 ~]# nova aggregate-create clusterA cluster-12C-128G
+----+----------+-------------------+-------+--------------------------------------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+----------+-------------------+-------+--------------------------------------+
| 1 | clusterA | cluster-12C-128G | | 'availability_zone=cluster-12C-128G' |
+----+----------+-------------------+-------+--------------------------------------+
[root@openstack03 ~]# nova aggregate-create clusterB cluster-12C-48G
+----+----------+-------------------+-------+-------------------------------------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+----------+-------------------+-------+-------------------------------------+
| 2 | clusterB | cluster-12C-48G | | 'availability_zone=cluster-8C-48G' |
+----+----------+-------------------+-------+-------------------------------------+
[root@openstack03 ~]# nova aggregate-list
+----+----------+-------------------+
| Id | Name | Availability Zone |
+----+----------+-------------------+
| 1 | clusterA | cluster-12C-128G |
| 2 | clusterB | cluster-8C-48G |
+----+----------+-------------------+
[root@openstack03 ~]# nova aggregate-list
+----+----------+-------------------+
| Id | Name | Availability Zone |
+----+----------+-------------------+
| 1 | clusterA | cluster-12C-128G |
| 3 | clusterB | cluster-8C-48G |
+----+----------+-------------------+
[root@openstack03 ~]# nova aggregate-add-host 1 node01
Host node01 has been successfully added for aggregate 1
+----+----------+-------------------+----------+--------------------------------------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+----------+-------------------+----------+--------------------------------------+
| 1 | clusterA | cluster-12C-128G | 'node01' | 'availability_zone=cluster-12C-128G' |
+----+----------+-------------------+----------+--------------------------------------+
[root@openstack03 ~]# nova aggregate-add-host 2 node02
Host node02 has been successfully added for aggregate 2
+----+----------+-------------------+--------------------+--------------------------------------+
| Id | Name | Availability Zone | Hosts | Metadata |
+----+----------+-------------------+--------------------+--------------------------------------+
| 1 | clusterA | cluster-8C-48G | 'node02' | 'availability_zone=cluster-8C-48G' |
+----+----------+-------------------+--------------------+--------------------------------------