nova 运维命令

简介: OpenStack的Nova服务是核心组件,负责管理云环境中的计算资源。它通过不同虚拟化驱动与Hypervisor交互,调度实例的生命周期。Nova依赖于keystone、glance、neutron、cinder和swift等服务,以实现加密磁盘和裸金属实例等功能。示例命令展示了如何列出实例类型、创建自定义规格、显示规格详情、创建和管理云主机以及操作云硬盘。

Nova计算服务
计算服务是openstack最核心的服务之一,负责维护和管理云环境的计算资源,它在openstack项目中代号是nova。
Nova自身并没有提供任何虚拟化能力,它提供计算服务,使用不同的虚拟化驱动来与底层支持==Hypervisor(虚拟机管理器)==进行交互。所有的计算实例(虚拟服务器)由Nova进行生命周期的调度管理(启动、挂起、停止、删除等)
Nova需要keystone、glance、neutron、cinder和swift等其他服务的支持,能与这些服务集成,实现如加密磁盘、裸金属计算实例等

步骤:

列出云初级实例类型

[root@admin ~(keystone_admin)]# nova flavor-list
+----+-----------+------------+------+-----------+------+-------+-------------+-----------+-------------+
| ID | Name      | Memory_MiB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | Description |
+----+-----------+------------+------+-----------+------+-------+-------------+-----------+-------------+
| 1  | m1.tiny   | 512        | 1    | 0         | 0    | 1     | 1.0         | True      | -           |
| 2  | m1.small  | 2048       | 20   | 0         | 0    | 1     | 1.0         | True      | -           |
| 3  | m1.medium | 4096       | 40   | 0         | 0    | 2     | 1.0         | True      | -           |
| 4  | m1.large  | 8192       | 80   | 0         | 0    | 4     | 1.0         | True      | -           |
| 5  | m1.xlarge | 16384      | 160  | 0         | 0    | 8     | 1.0         | True      | -           |
+----+-----------+------------+------+-----------+------+-------+-------------+-----------+-------------+
[root@admin ~(keystone_admin)]#

创建一个名为test,ID为6,内存为2048MB,磁盘为20GB,vCPU数量为2的云主机规格

[root@admin ~(keystone_admin)]# nova flavor-create test 6 2048 20 2
+----+------+------------+------+-----------+------+-------+-------------+-----------+-------------+
| ID | Name | Memory_MiB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | Description |
+----+------+------------+------+-----------+------+-------+-------------+-----------+-------------+
| 6  | test | 2048       | 20   | 0         | 0    | 2     | 1.0         | True      | -           |
+----+------+------------+------+-----------+------+-------+-------------+-----------+-------------+
[root@admin ~(keystone_admin)]#

查看test云主机类型的详细信息

[root@admin ~(keystone_admin)]# nova flavor-show test
+----------------------------+-------+
| Property                   | Value |
+----------------------------+-------+
| OS-FLV-DISABLED:disabled   | False |
| OS-FLV-EXT-DATA:ephemeral  | 0     |
| description                | -     |
| disk                       | 20    |
| extra_specs                | {}    |
| id                         | 6     |
| name                       | test  |
| os-flavor-access:is_public | True  |
| ram                        | 2048  |
| rxtx_factor                | 1.0   |
| swap                       | 0     |
| vcpus                      | 2     |
+----------------------------+-------+
[root@admin ~(keystone_admin)]#

openstack 命令创建一个云主机规格

[root@admin ~(keystone_admin)]# openstack flavor create myy --id 7 --ram 2048 --disk 20 --vcpu 2
+----------------------------+-------+
| Field                      | Value |
+----------------------------+-------+
| OS-FLV-DISABLED:disabled   | False |
| OS-FLV-EXT-DATA:ephemeral  | 0     |
| disk                       | 20    |
| id                         | 7     |
| name                       | myy   |
| os-flavor-access:is_public | True  |
| properties                 |       |
| ram                        | 2048  |
| rxtx_factor                | 1.0   |
| swap                       |       |
| vcpus                      | 2     |
+----------------------------+-------+
[root@admin ~(keystone_admin)]# openstack flavor list
+----+-----------+-------+------+-----------+-------+-----------+
| ID | Name      |   RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+-----------+-------+------+-----------+-------+-----------+
| 1  | m1.tiny   |   512 |    1 |         0 |     1 | True      |
| 2  | m1.small  |  2048 |   20 |         0 |     1 | True      |
| 3  | m1.medium |  4096 |   40 |         0 |     2 | True      |
| 4  | m1.large  |  8192 |   80 |         0 |     4 | True      |
| 5  | m1.xlarge | 16384 |  160 |         0 |     8 | True      |
| 6  | test      |  2048 |   20 |         0 |     2 | True      |
| 7  | myy       |  2048 |   20 |         0 |     2 | True      |
+----+-----------+-------+------+-----------+-------+-----------+
[root@admin ~(keystone_admin)]#

openstack查看规格信息

[root@admin ~(keystone_admin)]# openstack flavor show myy
+----------------------------+-------+
| Field                      | Value |
+----------------------------+-------+
| OS-FLV-DISABLED:disabled   | False |
| OS-FLV-EXT-DATA:ephemeral  | 0     |
| access_project_ids         | None  |
| disk                       | 20    |
| id                         | 7     |
| name                       | myy   |
| os-flavor-access:is_public | True  |
| properties                 |       |
| ram                        | 2048  |
| rxtx_factor                | 1.0   |
| swap                       |       |
| vcpus                      | 2     |
+----------------------------+-------+

创建云主机 用的网络ID号 (--flavor 7使用的是第七个规格、centos 镜像)

[root@admin ~(keystone_admin)]# openstack network list
+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| 346d8774-1c11-4e0d-97ee-48e81f572235 | public  | 5c0eaeae-22de-4897-b092-7a023d67b941 |
| 67e80067-d5d4-46e1-8be4-4a3cc2c0c1b8 | private | b0af7bd2-ee35-442d-821e-82a3527f0c6c |
| 8d9475f4-360c-4e41-8159-5346497f66c4 | private | 360437f5-6d99-4ec5-9cc9-15454879be3b |
+--------------------------------------+---------+--------------------------------------+
[root@admin ~(keystone_admin)]# openstack server create --flavor 7 --image centos --network 67e80067-d5d4-46e1-8be4-4a3cc2c0c1b8   myyyyyy
+-------------------------------------+-----------------------------------------------+
| Field                               | Value                                         |
+-------------------------------------+-----------------------------------------------+
| OS-DCF:diskConfig                   | MANUAL                                        |
| OS-EXT-AZ:availability_zone         |                                               |
| OS-EXT-SRV-ATTR:host                | None                                          |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None                                          |
| OS-EXT-SRV-ATTR:instance_name       |                                               |
| OS-EXT-STS:power_state              | NOSTATE                                       |
| OS-EXT-STS:task_state               | scheduling                                    |
| OS-EXT-STS:vm_state                 | building                                      |
| OS-SRV-USG:launched_at              | None                                          |
| OS-SRV-USG:terminated_at            | None                                          |
| accessIPv4                          |                                               |
| accessIPv6                          |                                               |
| addresses                           |                                               |
| adminPass                           | 48Zh9E6wEoiN                                  |
| config_drive                        |                                               |
| created                             | 2024-03-26T03:53:39Z                          |
| flavor                              | myy (7)                                       |
| hostId                              |                                               |
| id                                  | eac19e5d-3965-4888-bd7b-dad5fd6db330          |
| image                               | centos (07e9b45f-2cc9-4db8-854c-2ab78e8d330d) |
| key_name                            | None                                          |
| name                                | myyyyyy                                       |
| progress                            | 0                                             |
| project_id                          | 009a94428fb84a0db16aa4a1adab9a35              |
| properties                          |                                               |
| security_groups                     | name='default'                                |
| status                              | BUILD                                         |
| updated                             | 2024-03-26T03:53:40Z                          |
| user_id                             | 8dbf97f777ee4846878acb44e55f6cdf              |
| volumes_attached                    |                                               |
+-------------------------------------+-----------------------------------------------+
[root@admin ~(keystone_admin)]#

删除创建的云主机

[root@admin ~(keystone_admin)]# openstack server delete    myyyyyy
[root@admin ~(keystone_admin)]# openstack server list
+--------------------------------------+---------+--------+---------------------------------------+-------+----------+
| ID                                   | Name    | Status | Networks                              | Image | Flavor   |
+--------------------------------------+---------+--------+---------------------------------------+-------+----------+
| 7a105fa6-782e-4d45-966f-e17acd9d39e4 | centos7 | ACTIVE | private=192.168.100.186, 172.24.4.157 |       | m1.small |
+--------------------------------------+---------+--------+---------------------------------------+-------+----------+
[root@admin ~(keystone_admin)]#

用NOVA创建云主机 网络名称用ID号

[root@admin ~(keystone_admin)]# openstack network list
+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| 346d8774-1c11-4e0d-97ee-48e81f572235 | public  | 5c0eaeae-22de-4897-b092-7a023d67b941 |
| 67e80067-d5d4-46e1-8be4-4a3cc2c0c1b8 | private | b0af7bd2-ee35-442d-821e-82a3527f0c6c |
| 8d9475f4-360c-4e41-8159-5346497f66c4 | private | 360437f5-6d99-4ec5-9cc9-15454879be3b |
+--------------------------------------+---------+--------------------------------------+
[root@admin ~(keystone_admin)]# nova boot --image centos --flavor 7  --nic net-id=8d9475f4-360c-4e41-8159-5346497f66c4  my123
+--------------------------------------+-----------------------------------------------+
| Property                             | Value                                         |
+--------------------------------------+-----------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                        |
| OS-EXT-AZ:availability_zone          |                                               |
| OS-EXT-SRV-ATTR:host                 | -                                             |
| OS-EXT-SRV-ATTR:hostname             | my123                                         |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | -                                             |
| OS-EXT-SRV-ATTR:instance_name        |                                               |
| OS-EXT-SRV-ATTR:kernel_id            |                                               |
| OS-EXT-SRV-ATTR:launch_index         | 0                                             |
| OS-EXT-SRV-ATTR:ramdisk_id           |                                               |
| OS-EXT-SRV-ATTR:reservation_id       | r-ojkb2w4c                                    |
| OS-EXT-SRV-ATTR:root_device_name     | -                                             |
| OS-EXT-SRV-ATTR:user_data            | -                                             |
| OS-EXT-STS:power_state               | 0                                             |
| OS-EXT-STS:task_state                | scheduling                                    |
| OS-EXT-STS:vm_state                  | building                                      |
| OS-SRV-USG:launched_at               | -                                             |
| OS-SRV-USG:terminated_at             | -                                             |
| accessIPv4                           |                                               |
| accessIPv6                           |                                               |
| adminPass                            | eJo3wPCGdqA2                                  |
| config_drive                         |                                               |
| created                              | 2024-03-26T04:00:12Z                          |
| description                          | -                                             |
| flavor:disk                          | 20                                            |
| flavor:ephemeral                     | 0                                             |
| flavor:extra_specs                   | {}                                            |
| flavor:original_name                 | myy                                           |
| flavor:ram                           | 2048                                          |
| flavor:swap                          | 0                                             |
| flavor:vcpus                         | 2                                             |
| hostId                               |                                               |
| host_status                          |                                               |
| id                                   | c266f6b9-59d8-4fc7-93a4-fa8de30eff07          |
| image                                | centos (07e9b45f-2cc9-4db8-854c-2ab78e8d330d) |
| key_name                             | -                                             |
| locked                               | False                                         |
| locked_reason                        | -                                             |
| metadata                             | {}                                            |
| name                                 | my123                                         |
| os-extended-volumes:volumes_attached | []                                            |
| progress                             | 0                                             |
| security_groups                      | default                                       |
| server_groups                        | []                                            |
| status                               | BUILD                                         |
| tags                                 | []                                            |
| tenant_id                            | 009a94428fb84a0db16aa4a1adab9a35              |
| trusted_image_certificates           | -                                             |
| updated                              | 2024-03-26T04:00:13Z                          |
| user_id                              | 8dbf97f777ee4846878acb44e55f6cdf              |
+--------------------------------------+-----------------------------------------------+
[root@admin ~(keystone_admin)]#

列出当前系统存在的云主机(实例)

[root@admin ~(keystone_admin)]# nova list
+--------------------------------------+---------+--------+------------+-------------+---------------------------------------+
| ID                                   | Name    | Status | Task State | Power State | Networks                              |
+--------------------------------------+---------+--------+------------+-------------+---------------------------------------+
| 7a105fa6-782e-4d45-966f-e17acd9d39e4 | centos7 | ACTIVE | -          | Running     | private=192.168.100.186, 172.24.4.157 |
| c266f6b9-59d8-4fc7-93a4-fa8de30eff07 | my123   | ACTIVE | -          | Running     | private=192.168.100.199               |
+--------------------------------------+---------+--------+------------+-------------+---------------------------------------+
[root@admin ~(keystone_admin)]#

列出云主机部分信息

[root@admin ~(keystone_admin)]# nova list --fields "name,status" --name my123
+--------------------------------------+-------+--------+
| ID                                   | Name  | Status |
+--------------------------------------+-------+--------+
| c266f6b9-59d8-4fc7-93a4-fa8de30eff07 | my123 | ACTIVE |
+--------------------------------------+-------+--------+
[root@admin ~(keystone_admin)]#

列出实例的访问方法
此处有两种

[root@admin ~(keystone_admin)]# nova get-vnc-console my123 novnc
+-------+------------------------------------------------------------------------------------------------+
| Type  | Url                                                                                            |
+-------+------------------------------------------------------------------------------------------------+
| novnc | http://192.168.200.146:6080/vnc_auto.html?path=%3Ftoken%3De149f429-7ed5-4bab-9bb0-58726c8f6e79 |
+-------+------------------------------------------------------------------------------------------------+
[root@admin ~(keystone_admin)]# openstack console url show my123
+-------+------------------------------------------------------------------------------------------------+
| Field | Value                                                                                          |
+-------+------------------------------------------------------------------------------------------------+
| type  | novnc                                                                                          |
| url   | http://192.168.200.146:6080/vnc_auto.html?path=%3Ftoken%3D0aa31aba-c0d8-4992-9c5d-0c11baee179e |
+-------+------------------------------------------------------------------------------------------------+
[root@admin ~(keystone_admin)]#

查看云主机状态

[root@admin ~(keystone_admin)]# nova show my123
+--------------------------------------+----------------------------------------------------------+
| Property                             | Value                                                    |
+--------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                                   |
| OS-EXT-AZ:availability_zone          | nova                                                     |
| OS-EXT-SRV-ATTR:host                 | localhost.localdomain                                    |
| OS-EXT-SRV-ATTR:hostname             | my123                                                    |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | localhost.localdomain                                    |
| OS-EXT-SRV-ATTR:instance_name        | instance-00000003                                        |
| OS-EXT-SRV-ATTR:kernel_id            |                                                          |
| OS-EXT-SRV-ATTR:launch_index         | 0                                                        |
| OS-EXT-SRV-ATTR:ramdisk_id           |                                                          |
| OS-EXT-SRV-ATTR:reservation_id       | r-ojkb2w4c                                               |
| OS-EXT-SRV-ATTR:root_device_name     | /dev/vda                                                 |
| OS-EXT-SRV-ATTR:user_data            | -                                                        |
| OS-EXT-STS:power_state               | 1                                                        |
| OS-EXT-STS:task_state                | -                                                        |
| OS-EXT-STS:vm_state                  | active                                                   |
| OS-SRV-USG:launched_at               | 2024-03-26T04:00:26.000000                               |
| OS-SRV-USG:terminated_at             | -                                                        |
| accessIPv4                           |                                                          |
| accessIPv6                           |                                                          |
| config_drive                         |                                                          |
| created                              | 2024-03-26T04:00:12Z                                     |
| description                          | -                                                        |
| flavor:disk                          | 20                                                       |
| flavor:ephemeral                     | 0                                                        |
| flavor:extra_specs                   | {}                                                       |
| flavor:original_name                 | myy                                                      |
| flavor:ram                           | 2048                                                     |
| flavor:swap                          | 0                                                        |
| flavor:vcpus                         | 2                                                        |
| hostId                               | 26732ede55bb4c8c479ece42ddbc24d3ace0c9de0698eedde50fa531 |
| host_status                          | UP                                                       |
| id                                   | c266f6b9-59d8-4fc7-93a4-fa8de30eff07                     |
| image                                | centos (07e9b45f-2cc9-4db8-854c-2ab78e8d330d)            |
| key_name                             | -                                                        |
| locked                               | False                                                    |
| locked_reason                        | -                                                        |
| metadata                             | {}                                                       |
| name                                 | my123                                                    |
| os-extended-volumes:volumes_attached | []                                                       |
| private network                      | 192.168.100.199                                          |
| progress                             | 0                                                        |
| security_groups                      | default                                                  |
| server_groups                        | []                                                       |
| status                               | ACTIVE                                                   |
| tags                                 | []                                                       |
| tenant_id                            | 009a94428fb84a0db16aa4a1adab9a35                         |
| trusted_image_certificates           | -                                                        |
| updated                              | 2024-03-26T04:00:26Z                                     |
| user_id                              | 8dbf97f777ee4846878acb44e55f6cdf                         |
+--------------------------------------+----------------------------------------------------------+
[root@admin ~(keystone_admin)]#

创建一个云硬盘

oot@admin ~(keystone_admin)]# cinder create  --name imag 20
+--------------------------------+--------------------------------------+
| Property                       | Value                                |
+--------------------------------+--------------------------------------+
| attachments                    | []                                   |
| availability_zone              | nova                                 |
| bootable                       | false                                |
| consistencygroup_id            | None                                 |
| created_at                     | 2024-03-26T05:24:07.000000           |
| description                    | None                                 |
| encrypted                      | False                                |
| group_id                       | None                                 |
| id                             | bd16e14d-0d0a-4592-aa1f-3b4f9f1ffb22 |
| metadata                       | {}                                   |
| migration_status               | None                                 |
| multiattach                    | False                                |
| name                           | imag                                 |
| os-vol-host-attr:host          | None                                 |
| os-vol-mig-status-attr:migstat | None                                 |
| os-vol-mig-status-attr:name_id | None                                 |
| os-vol-tenant-attr:tenant_id   | 009a94428fb84a0db16aa4a1adab9a35     |
| provider_id                    | None                                 |
| replication_status             | None                                 |
| service_uuid                   | None                                 |
| shared_targets                 | True                                 |
| size                           | 20                                   |
| snapshot_id                    | None                                 |
| source_volid                   | None                                 |
| status                         | creating                             |
| updated_at                     | None                                 |
| user_id                        | 8dbf97f777ee4846878acb44e55f6cdf     |
| volume_type                    | iscsi                                |
+--------------------------------+--------------------------------------+
[root@admin ~(keystone_admin)]# openstack volume list
+--------------------------------------+------+-----------+------+----------------------------------+
| ID                                   | Name | Status    | Size | Attached to                      |
+--------------------------------------+------+-----------+------+----------------------------------+
| bd16e14d-0d0a-4592-aa1f-3b4f9f1ffb22 | imag | available |   20 |                                  |
| b122c843-b8e2-4020-844e-0aa7603c2702 |      | in-use    |   20 | Attached to centos7 on /dev/vda  |
+--------------------------------------+------+-----------+------+----------------------------------+
[root@admin ~(keystone_admin)]# cinder list
+--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+
| ID                                   | Status | Name | Size | Volume Type | Bootable | Attached to                          |
+--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+
| b122c843-b8e2-4020-844e-0aa7603c2702 | in-use |      | 20   | iscsi       | true     | 7a105fa6-782e-4d45-966f-e17acd9d39e4 |
| bd16e14d-0d0a-4592-aa1f-3b4f9f1ffb22 | in-use | imag | 20   | iscsi       | false    | c266f6b9-59d8-4fc7-93a4-fa8de30eff07 |
+--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+
[root@admin ~(keystone_admin)]#

挂载云硬盘
两种方法

[root@admin ~(keystone_admin)]# openstack server list
+--------------------------------------+---------+--------+---------------------------------------+--------+----------+
| ID                                   | Name    | Status | Networks                              | Image  | Flavor   |
+--------------------------------------+---------+--------+---------------------------------------+--------+----------+
| c266f6b9-59d8-4fc7-93a4-fa8de30eff07 | my123   | ACTIVE | private=192.168.100.199               | centos | myy      |
| 7a105fa6-782e-4d45-966f-e17acd9d39e4 | centos7 | ACTIVE | private=192.168.100.186, 172.24.4.157 |        | m1.small |
+--------------------------------------+---------+--------+---------------------------------------+--------+----------+
[root@admin ~(keystone_admin)]# nova volume-attach      c266f6b9-59d8-4fc7-93a4-fa8de30eff07    bd16e14d-0d0a-4592-aa1f-3b4f9f1ffb22 
+-----------------------+--------------------------------------+
| Property              | Value                                |
+-----------------------+--------------------------------------+
| delete_on_termination | False                                |
| device                | /dev/vdb                             |
| id                    | bd16e14d-0d0a-4592-aa1f-3b4f9f1ffb22 |
| serverId              | c266f6b9-59d8-4fc7-93a4-fa8de30eff07 |
| tag                   | -                                    |
| volumeId              | bd16e14d-0d0a-4592-aa1f-3b4f9f1ffb22 |
+-----------------------+--------------------------------------+
[root@admin ~(keystone_admin)]#

卸载云硬盘

[root@admin ~(keystone_admin)]# nova volume-detach      c266f6b9-59d8-4fc7-93a4-fa8de30eff07    bd16e14d-0d0a-4592-aa1f-3b4f9f1ffb22 
You have new mail in /var/spool/mail/root
[root@admin ~(keystone_admin)]# 
openstack 挂载
[root@admin ~(keystone_admin)]# openstack server add volume my123  imag
[root@admin ~(keystone_admin)]# nova show  c266f6b9-59d8-4fc7-93a4-fa8de30eff07 
+--------------------------------------+----------------------------------------------------------------------------------+
| Property                             | Value                                                                            |
+--------------------------------------+----------------------------------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                                                           |
| OS-EXT-AZ:availability_zone          | nova                                                                             |
| OS-EXT-SRV-ATTR:host                 | localhost.localdomain                                                            |
| OS-EXT-SRV-ATTR:hostname             | my123                                                                            |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | localhost.localdomain                                                            |
| OS-EXT-SRV-ATTR:instance_name        | instance-00000003                                                                |
| OS-EXT-SRV-ATTR:kernel_id            |                                                                                  |
| OS-EXT-SRV-ATTR:launch_index         | 0                                                                                |
| OS-EXT-SRV-ATTR:ramdisk_id           |                                                                                  |
| OS-EXT-SRV-ATTR:reservation_id       | r-ojkb2w4c                                                                       |
| OS-EXT-SRV-ATTR:root_device_name     | /dev/vda                                                                         |
| OS-EXT-SRV-ATTR:user_data            | -                                                                                |
| OS-EXT-STS:power_state               | 1                                                                                |
| OS-EXT-STS:task_state                | -                                                                                |
| OS-EXT-STS:vm_state                  | active                                                                           |
| OS-SRV-USG:launched_at               | 2024-03-26T04:00:26.000000                                                       |
| OS-SRV-USG:terminated_at             | -                                                                                |
| accessIPv4                           |                                                                                  |
| accessIPv6                           |                                                                                  |
| config_drive                         |                                                                                  |
| created                              | 2024-03-26T04:00:12Z                                                             |
| description                          | -                                                                                |
| flavor:disk                          | 20                                                                               |
| flavor:ephemeral                     | 0                                                                                |
| flavor:extra_specs                   | {}                                                                               |
| flavor:original_name                 | myy                                                                              |
| flavor:ram                           | 2048                                                                             |
| flavor:swap                          | 0                                                                                |
| flavor:vcpus                         | 2                                                                                |
| hostId                               | 26732ede55bb4c8c479ece42ddbc24d3ace0c9de0698eedde50fa531                         |
| host_status                          | UP                                                                               |
| id                                   | c266f6b9-59d8-4fc7-93a4-fa8de30eff07                                             |
| image                                | centos (07e9b45f-2cc9-4db8-854c-2ab78e8d330d)                                    |
| key_name                             | -                                                                                |
| locked                               | False                                                                            |
| locked_reason                        | -                                                                                |
| metadata                             | {}                                                                               |
| name                                 | my123                                                                            |
| os-extended-volumes:volumes_attached | [{"id": "bd16e14d-0d0a-4592-aa1f-3b4f9f1ffb22", "delete_on_termination": false}] |
| private network                      | 192.168.100.199                                                                  |
| progress                             | 0                                                                                |
| security_groups                      | default                                                                          |
| server_groups                        | []                                                                               |
| status                               | ACTIVE                                                                           |
| tags                                 | []                                                                               |
| tenant_id                            | 009a94428fb84a0db16aa4a1adab9a35                                                 |
| trusted_image_certificates           | -                                                                                |
| updated                              | 2024-03-26T04:00:26Z                                                             |
| user_id                              | 8dbf97f777ee4846878acb44e55f6cdf                                                 |
+--------------------------------------+----------------------------------------------------------------------------------+
[root@admin ~(keystone_admin)]# 
( os-extended-volumes:volumes_attached | [{"id": "bd16e14d-0d0a-4592-aa1f-3b4f9f1ffb22", "delete_on_termination": false}] |) 挂载信息
[root@admin ~(keystone_admin)]# openstack server remove volume my123  imag
[root@admin ~(keystone_admin)]# nova show  c266f6b9-59d8-4fc7-93a4-fa8de30eff07 
+--------------------------------------+----------------------------------------------------------+
| Property                             | Value                                                    |
+--------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                                   |
| OS-EXT-AZ:availability_zone          | nova                                                     |
| OS-EXT-SRV-ATTR:host                 | localhost.localdomain                                    |
| OS-EXT-SRV-ATTR:hostname             | my123                                                    |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | localhost.localdomain                                    |
| OS-EXT-SRV-ATTR:instance_name        | instance-00000003                                        |
| OS-EXT-SRV-ATTR:kernel_id            |                                                          |
| OS-EXT-SRV-ATTR:launch_index         | 0                                                        |
| OS-EXT-SRV-ATTR:ramdisk_id           |                                                          |
| OS-EXT-SRV-ATTR:reservation_id       | r-ojkb2w4c                                               |
| OS-EXT-SRV-ATTR:root_device_name     | /dev/vda                                                 |
| OS-EXT-SRV-ATTR:user_data            | -                                                        |
| OS-EXT-STS:power_state               | 1                                                        |
| OS-EXT-STS:task_state                | -                                                        |
| OS-EXT-STS:vm_state                  | active                                                   |
| OS-SRV-USG:launched_at               | 2024-03-26T04:00:26.000000                               |
| OS-SRV-USG:terminated_at             | -                                                        |
| accessIPv4                           |                                                          |
| accessIPv6                           |                                                          |
| config_drive                         |                                                          |
| created                              | 2024-03-26T04:00:12Z                                     |
| description                          | -                                                        |
| flavor:disk                          | 20                                                       |
| flavor:ephemeral                     | 0                                                        |
| flavor:extra_specs                   | {}                                                       |
| flavor:original_name                 | myy                                                      |
| flavor:ram                           | 2048                                                     |
| flavor:swap                          | 0                                                        |
| flavor:vcpus                         | 2                                                        |
| hostId                               | 26732ede55bb4c8c479ece42ddbc24d3ace0c9de0698eedde50fa531 |
| host_status                          | UP                                                       |
| id                                   | c266f6b9-59d8-4fc7-93a4-fa8de30eff07                     |
| image                                | centos (07e9b45f-2cc9-4db8-854c-2ab78e8d330d)            |
| key_name                             | -                                                        |
| locked                               | False                                                    |
| locked_reason                        | -                                                        |
| metadata                             | {}                                                       |
| name                                 | my123                                                    |
| os-extended-volumes:volumes_attached | []                                                       |
| private network                      | 192.168.100.199                                          |
| progress                             | 0                                                        |
| security_groups                      | default                                                  |
| server_groups                        | []                                                       |
| status                               | ACTIVE                                                   |
| tags                                 | []                                                       |
| tenant_id                            | 009a94428fb84a0db16aa4a1adab9a35                         |
| trusted_image_certificates           | -                                                        |
| updated                              | 2024-03-26T04:00:26Z                                     |
| user_id                              | 8dbf97f777ee4846878acb44e55f6cdf                         |
+--------------------------------------+----------------------------------------------------------+
[root@admin ~(keystone_admin)]#

查看物理主机状态

[root@admin ~(keystone_admin)]# nova hypervisor-list 
+--------------------------------------+-----------------------+-------+---------+
| ID                                   | Hypervisor hostname   | State | Status  |
+--------------------------------------+-----------------------+-------+---------+
| cbfa4f37-fb86-4356-8b5a-f7f04b0beed4 | localhost.localdomain | up    | enabled |
+--------------------------------------+-----------------------+-------+---------+
[root@admin ~(keystone_admin)]#

查看某个物理主机状态

[root@admin ~(keystone_admin)]# nova hypervisor-show  cbfa4f37-fb86-4356-8b5a-f7f04b0beed4 
+---------------------------+------------------------------------------+
| Property                  | Value                                    |
+---------------------------+------------------------------------------+
| cpu_info_arch             | x86_64                                   |
| cpu_info_features         | ["pge", "avx", "clflush", "sep",         |
|                           | "syscall", "umip", "vme", "tsc",         |
|                           | "fsgsbase", "xsave", "smap", "bmi2",     |
|                           | "xsaveopt", "cmov", "smep", "fpu",       |
|                           | "clflushopt", "pat", "arat", "lm",       |
|                           | "msr", "adx", "3dnowprefetch", "nx",     |
|                           | "fxsr", "sha-ni", "sse4.1", "pae",       |
|                           | "sse4.2", "pclmuldq", "xgetbv1",         |
|                           | "cmp_legacy", "fma", "sse4a", "mmx",     |
|                           | "osxsave", "cx8", "mce", "fxsr_opt",     |
|                           | "cr8legacy", "clwb", "pse", "lahf_lm",   |
|                           | "abm", "osvw", "rdseed", "popcnt",       |
|                           | "mca", "pdpe1gb", "ibpb", "sse", "f16c", |
|                           | "invtsc", "xsavec", "pni", "aes", "svm", |
|                           | "ht", "mmxext", "sse2", "hypervisor",    |
|                           | "topoext", "misalignsse", "bmi1",        |
|                           | "apic", "ssse3", "de", "cx16",           |
|                           | "extapic", "pse36", "mtrr", "movbe",     |
|                           | "rdrand", "avx2", "x2apic", "rdtscp",    |
|                           | "wbnoinvd", "xsaves"]                    |
| cpu_info_model            | Opteron_G2                               |
| cpu_info_topology_cells   | 1                                        |
| cpu_info_topology_cores   | 4                                        |
| cpu_info_topology_sockets | 1                                        |
| cpu_info_topology_threads | 1                                        |
| cpu_info_vendor           | AMD                                      |
| current_workload          | 0                                        |
| disk_available_least      | 257                                      |
| free_disk_gb              | 274                                      |
| free_ram_mb               | 5772                                     |
| host_ip                   | 192.168.200.146                          |
| hypervisor_hostname       | localhost.localdomain                    |
| hypervisor_type           | QEMU                                     |
| hypervisor_version        | 2012000                                  |
| id                        | cbfa4f37-fb86-4356-8b5a-f7f04b0beed4     |
| local_gb                  | 294                                      |
| local_gb_used             | 20                                       |
| memory_mb                 | 10380                                    |
| memory_mb_used            | 4608                                     |
| running_vms               | 2                                        |
| service_disabled_reason   | None                                     |
| service_host              | localhost.localdomain                    |
| service_id                | e2f90167-2bfe-4a86-927e-53d125ac2917     |
| state                     | up                                       |
| status                    | enabled                                  |
| vcpus                     | 4                                        |
| vcpus_used                | 3                                        |
+---------------------------+------------------------------------------+
[root@admin ~(keystone_admin)]#
目录
相关文章
|
19天前
|
运维 监控 网络协议
运维工程师日常工作中最常用的20个Linux命令,涵盖文件操作、目录管理、权限设置、系统监控等方面
本文介绍了运维工程师日常工作中最常用的20个Linux命令,涵盖文件操作、目录管理、权限设置、系统监控等方面,旨在帮助读者提高工作效率。从基本的文件查看与编辑,到高级的网络配置与安全管理,这些命令是运维工作中的必备工具。
59 3
|
2月前
|
运维 监控 网络协议
|
28天前
|
缓存 运维 监控
【运维必备知识】Linux系统平均负载与top、uptime命令详解
系统平均负载是衡量Linux服务器性能的关键指标之一。通过使用 `top`和 `uptime`命令,可以实时监控系统的负载情况,帮助运维人员及时发现并解决潜在问题。理解这些工具的输出和意义是确保系统稳定运行的基础。希望本文对Linux系统平均负载及相关命令的详细解析能帮助您更好地进行系统运维和性能优化。
50 3
|
4月前
|
图形学 开发者 存储
超越基础教程:深度拆解Unity地形编辑器的每一个隐藏角落,让你的游戏世界既浩瀚无垠又细节满满——从新手到高手的全面技巧升级秘籍
【8月更文挑战第31天】Unity地形编辑器是游戏开发中的重要工具,可快速创建复杂多变的游戏环境。本文通过比较不同地形编辑技术,详细介绍如何利用其功能构建广阔且精细的游戏世界,并提供具体示例代码,展示从基础地形绘制到植被与纹理添加的全过程。通过学习这些技巧,开发者能显著提升游戏画面质量和玩家体验。
169 3
|
4月前
|
SQL 运维 监控
DM日常运维高频命令总结
DM日常运维高频命令总结
106 3
|
4月前
|
运维 Oracle 前端开发
Oracle 11g RAC集群日常运维命令总结
Oracle 11g RAC集群日常运维命令总结
105 2
|
4月前
|
SQL 运维 调度
DM8日常运维命令总结(二)
DM8日常运维命令总结(二)
106 2
|
4月前
|
SQL 运维 Oracle
入门级Oracle 11g日常运维命令总结
入门级Oracle 11g日常运维命令总结
153 1
|
4月前
|
SQL 运维 数据库
DM8日常运维必须要懂的几个命令
DM8日常运维必须要懂的几个命令
78 1
|
4月前
|
移动开发 运维 网络协议
运维必备 | Linux netstat命令详解
运维必备 | Linux netstat命令详解
112 8