https://blog.csdn.net/haoge921026/article/details/54409266
OpenStack的nova服务使用
一、使用nova相关命令查询计算节点虚拟机监控器的状态
记不住的情况下可以使用–help
[root@controller ~]# nova --help | grep stats
hypervisor-stats Get hypervisor statistics over all compute
[root@controller ~]# nova hypervisor-stats
+----------------------+-------+
| Property | Value |
+----------------------+-------+
| count | 2 |
| current_workload | 0 |
| disk_available_least | 3324 |
| free_disk_gb | 3338 |
| free_ram_mb | 15309 |
| local_gb | 3538 |
| local_gb_used | 200 |
| memory_mb | 31642 |
| memory_mb_used | 21504 |
| running_vms | 3 |
| vcpus | 32 |
| vcpus_used | 10 |
+----------------------+-------+
二、使用nova相关命令查询nova服务状态列表
[root@controller ~]# nova --help | grep service
[--os-region-name <region-name>] [--service-type <service-type>]
[--service-name <service-name>]
[--volume-service-name <volume-service-name>]
authenticate services.
host-list List all hosts by service.
service-delete Delete the service.
service-disable Disable the service.
service-enable Enable the service.
service-force-down Force service to down. (Supported by API
service-list Show a list of all running services. Filter by
--service-type <service-type>
--service-name <service-name>
--volume-service-name <volume-service-name>
[root@controller ~]# nova service-list
+----+------------------+------------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+----+------------------+------------+----------+---------+-------+----------------------------+-----------------+
| 1 | nova-consoleauth | controller | internal | enabled | up | 2019-12-14T14:16:07.000000 | - |
| 2 | nova-conductor | controller | internal | enabled | up | 2019-12-14T14:16:08.000000 | - |
| 7 | nova-scheduler | controller | internal | enabled | up | 2019-12-14T14:16:07.000000 | - |
| 20 | nova-compute | compute | nova | enabled | up | 2019-12-14T14:16:11.000000 | - |
| 21 | nova-compute | controller | nova | enabled | up | 2019-12-14T14:16:11.000000 | - |
+----+------------------+------------+----------+---------+-------+----------------------------+-----------------+
三、使用nova相关命令查询网络的列表信息
[root@controller ~]# nova --help | grep network
add-fixed-ip Add new IP address on a network to server.
network only).
network only).
floating-ip-bulk-list List all floating IPs (nova-network only).
interface-attach Attach a network interface to a server.
interface-detach Detach a network interface from a server.
network-associate-host Associate host with network.
network-associate-project Associate project with network.
network-create Create a network.
network-delete Delete network by label or id.
network-disassociate Disassociate host and/or project from the
given network.
network-list Print a list of available networks.
network-show Show details about the given network.
refresh-network Refresh server network information.
reset-network Reset network of a server.
scrub Delete networks and security groups associated
tenants (nova-network only).
new tenants (nova-network only).
baremetal-interface-add Add a network interface to a baremetal node.
baremetal-interface-list List network interfaces associated with a
baremetal-interface-remove Remove a network interface from a baremetal
net DEPRECATED, use tenant-network-show instead.
net-create DEPRECATED, use tenant-network-create instead.
net-delete DEPRECATED, use tenant-network-delete instead.
net-list DEPRECATED, use tenant-network-list instead.
tenant-network-create Create a tenant network.
tenant-network-delete Delete a tenant network.
tenant-network-list List tenant networks.
tenant-network-show Show a tenant network.
[root@controller ~]# nova network-list
+--------------------------------------+----------+------+
| ID | Label | Cidr |
+--------------------------------------+----------+------+
| 33cd595e-cc06-4a28-b7ca-12cc2543c6f0 | ext-net | - |
| 706ba0d7-d01c-4121-b7aa-cbd711358631 | int-net1 | - |
| 8866f180-b5bc-4682-b75b-eb5cfa9d62de | int-net2 | - |
+--------------------------------------+----------+------+
四、使用nova相关命令查新nova资源使用的信息
[root@controller ~]# nova help | grep usage
usage: nova [--version] [--debug] [--os-cache] [--timings]
usage Show usage data for a single tenant.
usage-list List usage data for all tenants.
[root@controller ~]#
[root@controller ~]#
[root@controller ~]# nova usage ## 查看单一租户的信息
Usage from 2019-11-16 to 2019-12-15:
+---------+--------------+-----------+---------------+
| Servers | RAM MB-Hours | CPU Hours | Disk GB-Hours |
+---------+--------------+-----------+---------------+
| 3 | 1019569.47 | 497.84 | 9956.73 |
+---------+--------------+-----------+---------------+
[root@controller ~]# nova usage-list ## 查看所有租户的信息
Usage from 2019-11-16 to 2019-12-15:
+----------------------------------+---------+--------------+-----------+---------------+
| Tenant ID | Servers | RAM MB-Hours | CPU Hours | Disk GB-Hours |
+----------------------------------+---------+--------------+-----------+---------------+
| 5cb6243755824171b7e0873b18847545 | 3 | 1019644.60 | 497.87 | 9957.47 |
+----------------------------------+---------+--------------+-----------+---------------+