OpenStack Nova常用命令

Posted by fishcried on July 30, 2014

1. 浮动ip管理

1 查看浮动ip池

root@ncloud-keystone-1:~# nova floating-ip-pool-list
+-----------+
| name      |
+-----------+
| Ext-Net-2 |
| Ext-Net-1 |
+-----------+

当前有两两个浮动ip池,有几个外网就有几个浮动ip池。我们使用的是Ext-Net-1.

2 查看当前的浮动ip分配

root@ncloud-keystone-1:~# nova floating-ip-list
+----+-----------+----------+------+
| Ip | Server Id | Fixed Ip | Pool |
+----+-----------+----------+------+
+----+-----------+----------+------+

当前没有浮动ip可以用于分配。

3 创建浮动ip

  • nova floating-ip-create
  • nova floating-ip-delte

    root@ncloud-keystone-1:~# nova floating-ip-create Ext-Net-1 +—————–+———–+———-+———–+ | Ip | Server Id | Fixed Ip | Pool | +—————–+———–+———-+———–+ | 192.168.252.102 | | - | Ext-Net-1 | +—————–+———–+———-+———–+

    root@ncloud-keystone-1:~# nova floating-ip-list +—————–+———–+———-+———–+ | Ip | Server Id | Fixed Ip | Pool | +—————–+———–+———-+———–+ | 192.168.252.102 | | - | Ext-Net-1 | +—————–+———–+———-+———–+

nova floating-ip-delete用来删除浮动ip。

4 绑定浮动ip

  • nova floating-ip-associate
  • nova floating-ip-disassociate

有一台23的虚拟机,想将192.168.252.102分配个他

root@ncloud-keystone-1:~# nova list
+--------------------------------------+------+---------+------------+-------------+----------------------+
| ID                                   | Name | Status  | Task State | Power State | Networks             |
+--------------------------------------+------+---------+------------+-------------+----------------------+
| aaf02735-17f7-460c-9fb5-b8135b389e24 | 23   | ACTIVE  | -          | Running     | 200.0.0.1=200.0.0.97 |
+--------------------------------------+------+---------+------------+-------------+----------------------+

nova floating-ip-associate
root@ncloud-keystone-1:~# nova floating-ip-associate 23 192.168.252.102

root@ncloud-keystone-1:~# nova list
+--------------------------------------+------+---------+------------+-------------+---------------------------------------+
| ID                                   | Name | Status  | Task State | Power State | Networks                              |
+--------------------------------------+------+---------+------------+-------------+---------------------------------------+
| aaf02735-17f7-460c-9fb5-b8135b389e24 | 23   | ACTIVE  | -          | Running     | 200.0.0.1=200.0.0.97, 192.168.252.102 |
+--------------------------------------+------+---------+------------+-------------+---------------------------------------+

nova floating-ip-disassociate可以浮动ip绑定

2. flavor管理

root@ncloud-keystone-1:~# nova help | grep flavor
	flavor-access-add   Add flavor access for the given tenant.
	flavor-access-list  Print access information about the given flavor.
	flavor-access-remove
						Remove flavor access for the given tenant.
	flavor-create       Create a new flavor
	flavor-delete       Delete a specific flavor
	flavor-key          Set or unset extra_spec for a flavor.
	flavor-list         Print a list of available 'flavors' (sizes of
	flavor-show         Show details about the given flavor.

3. 安全组管理

4. 镜像管理

root@ncloud-keystone-1:~# nova help | grep image
	image-create        Create a new image by taking a snapshot of a running
	image-delete        Delete specified image(s).
	image-list          Print a list of available images to boot from.
	image-meta          Set or Delete metadata on an image.
	image-show          Show details about the given image.

5. 配额

absolute-limits

6. 物理机器管理

root@ncloud-keystone-1:~# nova help | grep hypervisor
	hypervisor-list     List hypervisors.
	hypervisor-servers  List servers belonging to specific hypervisors.
	hypervisor-show     Display the details of the specified hypervisor.
	hypervisor-stats    Get hypervisor statistics over all compute nodes.
	hypervisor-uptime   Display the uptime of the specified hypervisor.

7. 主机聚合

  • aggregate-list
  • aggregate-create
  • aggregate-delete
  • aggregate-details
  • aggregate-add-host
  • aggregate-remove-host
  • aggregate-set-metadata <key=value [<key=value>...]
  • aggregate-update []

  • host-list
  • host-update

8. 虚拟机管理

  • boot
  • delete
  • pause
  • unpause
  • resume
  • reboot
  • rename
  • start
  • stop
  • suspend

    usage: nova boot [–flavor ] [--image ] [--image-with <key=value>] [--boot-volume ] [--snapshot ] [--num-instances ] [--meta <key=value>] [--file <dst-path=src-path>] [--key-name ] [--user-data ] [--availability-zone ] [--security-groups ] [--block-device-mapping <dev-name=mapping>] [--block-device key1=value1[,key2=value2...]] [--swap ] [--ephemeral size=[,format=]] [--hint <key=value>] [--nic <net-id=net-uuid,v4-fixed-ip=ip-addr,port-id=port-uuid>] [--config-drive ] [--poll]

9. nova-compute

  • logs
    • errors
    • syslog
  • db
    • archive_deleted_rows
    • sync
  • vm
    • list
  • agent
    • create
    • delete
    • list
    • modify
  • host
    • list
  • flavor
    • create
    • delete
    • list
    • set_key
    • unset_key
  • vpn
    • change
  • floating
    • address_to_hosts
    • create
    • delete
    • list
  • network
    • list
    • create
    • delete
    • modify
  • service
    • disable
    • enable
    • list
  • cell
  • fixed

变更记录

Why Who When
Create fishcired 2014-07-30
添加nova-manage命令 fishcired 2014-08-04