一、Nova组件概述

计算节点通过Nova Computer进行虚拟机创建,通过libvirt调用kvm创建虚拟机,nova之间通信通过rabbitMQ队列进行通信。

Nova位于Openstack架构的中心,其他服务或者组件(比如Glance、Cinder、Neutron等)对它提供支持,另外它本身的架构也比较复杂。

作用:

  • Nova是OpenStack最核心的服务模块,负责管理和维护云计算环境的计算资源,负责整个云环境虚拟机生命周期的管理。
  • Nova是OpenStack的计算服务,负责维护和管理的网络和存储,提供计算服务。

二、Nova组建操作

1、安全组相关操作

nova
​ secgroup-add-default-rule Add a rule to the set of rules that will be
​ added to the 'default' security group for new
​ tenants (nova-network only).
​ secgroup-add-group-rule Add a source group rule to a security group.
​ secgroup-add-rule Add a rule to a security group.
​ secgroup-create Create a security group.
​ secgroup-delete Delete a security group.
​ secgroup-delete-default-rule
​ Delete a rule from the set of rules that will
​ be added to the 'default' security group for
​ new tenants (nova-network only).
​ secgroup-delete-group-rule Delete a source group rule from a security
​ group.
​ secgroup-delete-rule Delete a rule from a security group.
​ secgroup-list List security groups for the current tenant.
​ secgroup-list-default-rules
​ List rules that will be added to the 'default'
​ security group for new tenants.
​ secgroup-list-rules List rules for a security group.
​ secgroup-update Update a security group. # 安全组查看:
[root@controller ~]# nova secgroup-list
+--------------------------------------+---------+------------------------+
| Id | Name | Description |
+--------------------------------------+---------+------------------------+
| 486eaa38-8e3d-4214-96bc-e6fee9b81be6 | default | Default security group |
+--------------------------------------+---------+------------------------+ # 安全组创建
[root@controller ~]# nova secgroup-create zzz 'Most great security group'
+--------------------------------------+------+---------------------------+
| Id | Name | Description |
+--------------------------------------+------+---------------------------+
| 1f2e9304-2fa0-45ac-a407-9816c72a1190 | zzz | Most great security group |
+--------------------------------------+------+---------------------------+ # 安全组更新
[root@controller ~]# nova secgroup-update 218faa36-c250-40d5-9775-534049e5771a zzz111 'One of the most great security group '
+--------------------------------------+--------+---------------------------------------+
| Id | Name | Description |
+--------------------------------------+--------+---------------------------------------+
| 218faa36-c250-40d5-9775-534049e5771a | zzz111 | One of the most great security group |
+--------------------------------------+--------+---------------------------------------+ # 安全组删除
[root@controller ~]# nova secgroup-delete zzz111 # 安全组规则查看
[root@controller ~]# nova secgroup-list-rules zzz
+-------------+-----------+---------+----------+--------------+
| IP Protocol | From Port | To Port | IP Range | Source Group |
+-------------+-----------+---------+----------+--------------+
+-------------+-----------+---------+----------+--------------+
[root@controller ~]# nova secgroup-list-rules default
+-------------+-----------+---------+-----------+--------------+
| IP Protocol | From Port | To Port | IP Range | Source Group |
+-------------+-----------+---------+-----------+--------------+
| tcp | 1 | 65535 | 0.0.0.0/0 | |
| udp | 1 | 65535 | 0.0.0.0/0 | |
| icmp | -1 | -1 | 0.0.0.0/0 | |
| | | | | default |
| | | | | default |
+-------------+-----------+---------+-----------+--------------+ # 安全组规则添加
[root@controller ~]# nova secgroup-add-rule zzz icmp -1 -1 0.0.0.0/0
+-------------+-----------+---------+-----------+--------------+
| IP Protocol | From Port | To Port | IP Range | Source Group |
+-------------+-----------+---------+-----------+--------------+
| icmp | -1 | -1 | 0.0.0.0/0 | |
+-------------+-----------+---------+-----------+--------------+
[root@controller ~]# nova secgroup-add-rule zzz udp 1 65535 0.0.0.0/0
+-------------+-----------+---------+-----------+--------------+
| IP Protocol | From Port | To Port | IP Range | Source Group |
+-------------+-----------+---------+-----------+--------------+
| udp | 1 | 65535 | 0.0.0.0/0 | |
+-------------+-----------+---------+-----------+--------------+
[root@controller ~]# nova secgroup-add-rule zzz tcp 1 65535 0.0.0.0/0
+-------------+-----------+---------+-----------+--------------+
| IP Protocol | From Port | To Port | IP Range | Source Group |
+-------------+-----------+---------+-----------+--------------+
| tcp | 1 | 65535 | 0.0.0.0/0 | |
+-------------+-----------+---------+-----------+--------------+ # 安全组规则删除
[root@controller ~]# nova secgroup-delete-rule zzz icmp -1 -1 0.0.0.0/0
+-------------+-----------+---------+-----------+--------------+
| IP Protocol | From Port | To Port | IP Range | Source Group |
+-------------+-----------+---------+-----------+--------------+
| icmp | -1 | -1 | 0.0.0.0/0 | |
+-------------+-----------+---------+-----------+--------------+
[root@controller ~]# nova secgroup-list-rules zzz
+-------------+-----------+---------+-----------+--------------+
| IP Protocol | From Port | To Port | IP Range | Source Group |
+-------------+-----------+---------+-----------+--------------+
| udp | 1 | 65535 | 0.0.0.0/0 | |
| tcp | 1 | 65535 | 0.0.0.0/0 | |
+-------------+-----------+---------+-----------+--------------+

2、云主机类型操作

nova
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
servers).
flavor-show Show details about the given flavor. # 云主机类型列表查看
[root@controller ~]# nova flavor-list
+--------------------------------------+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+--------------------------------------+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1 | m1.tiny | 512 | 1 | 0 | | 1 | 1.0 | True |
| 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True |
| 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True |
| 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True |
| 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True |
| 7645393e-4f46-473a-85bf-6ea69669dac2 | m1-zzz | 512 | 10 | 0 | | 1 | 1.0 | True |
+--------------------------------------+-----------+-----------+------+-----------+------+-------+-------------+-----------+ # 云主机类型添加
[root@controller ~]# nova flavor-create m1.zzz 6 1024 10 1
+----+--------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+--------+-----------+------+-----------+------+-------+-------------+-----------+
| 6 | m1.zzz | 1024 | 10 | 0 | | 1 | 1.0 | True |
+----+--------+-----------+------+-----------+------+-------+-------------+-----------+ # 云主机类型详情查看
[root@controller ~]# nova flavor-show m1.zzz
+----------------------------+--------+
| Property | Value |
+----------------------------+--------+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| disk | 10 |
| extra_specs | {} |
| id | 6 |
| name | m1.zzz |
| os-flavor-access:is_public | True |
| ram | 1024 |
| rxtx_factor | 1.0 |
| swap | |
| vcpus | 1 |
+----------------------------+--------+ # 云主机类型删除
[root@controller ~]# nova flavor-delete m1-zzz

3、云主机实例操作

# 实例列表查看
nova list # 实例详情查看
nova show <server> # 实例创建
nova boot <实例名称>
# 可选参数:
--flavor <flavor> 虚拟机类型
--image <image> 可选用的镜像
--image-with <key=value> 镜像的元数据属性
--boot-volume <volume_id> 启动逻辑卷的ID
--snapshot <snapshot_id> 快照.
--min-count <number> Boot at least <number> servers (limited by
quota).
--max-count <number> Boot up to <number> servers (limited by
quota).
--meta <key=value> 元数据Record arbitrary key/value metadata to
/meta_data.json on the metadata server. Can be
specified multiple times.
--file <dst-path=src-path> 文件Store arbitrary files from <src-path> locally
to <dst-path> on the new server. Limited by
the injected_files quota value.
--key-name <key-name> 密钥名称Key name of keypair that should be created
earlier with the command keypair-add.
--user-data <user-data> 注入的用户数据user data file to pass to be exposed by the
metadata server.
--availability-zone <availability-zone>
可用域The availability zone for server placement.
--security-groups <security-groups>
安全组Comma separated list of security group names.
--block-device-mapping <dev-name=mapping>
块存储格式化Block device mapping in the format <dev-
name>=<id>:<type>:<size(GB)>:<delete-on-
terminate>.
--block-device key1=value1[,key2=value2...] 块设备参数
--swap <swap_size> 交换空间大小Create and attach a local swap block device of
<swap_size> MB.
--ephemeral size=<size>[,format=<format>]
连接块存储的大小Create and attach a local ephemeral block
device of <size> GB and format it to <format>.
--hint <key=value> 自定义数据Send arbitrary key/value pairs to the
scheduler for custom use.
--nic <net-id=net-uuid,net-name=network-name,v4-fixed-ip=ip-addr,v6-fixed-ip=ip-addr,port-id=port-uuid>
配置网络Create a NIC on the server. Specify option
multiple times to create multiple NICs. net-
id: attach NIC to network with this UUID net-
name: attach NIC to network with this name
(either port-id or net-id or net-name must be
provided), v4-fixed-ip: IPv4 fixed address for
NIC (optional), v6-fixed-ip: IPv6 fixed
address for NIC (optional), port-id: attach
NIC to port with this UUID (either port-id or
net-id must be provided).
--config-drive <value> 驱动配置Enable config drive.
--poll 显示创建进度Report the new server boot progress until it
completes.
--admin-pass <value> Admin password for the instance.
--access-ip-v4 <value> Alternative access IPv4 of the instance.
--access-ip-v6 <value> Alternative access IPv6 of the instance.
--description <description> Description for the server. (Supported by API
versions '2.19' - '2.latest') # 1、查看镜像
glance image-list
# 2、查看规格
nova flavor-list
# 3、查看安全组
nova secgroup-list
# 4、查看可用的网络
neutron net-list nova boot \
--image centos7.2 \
--availability-zone nova \
--flavor m1.zzz \
--security-groups zzz \
--nic net-id=64306052-bcec-4209-ac4c-45b9d2de4dde \
caocao-server1 # 5、实例创建
[root@controller images]# nova boot test-server --image centos7.2 --flavor m1.lxh --availability-zone nova --security-groups zzz --nic net-id=451fd2af-e1eb-4437-bf71-53b5f91c10b5
+--------------------------------------+--------------------------------------------------+
| Property | Value |
+--------------------------------------+--------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | - |
| OS-EXT-SRV-ATTR:hostname | test-server |
| OS-EXT-SRV-ATTR:hypervisor_hostname | - |
| OS-EXT-SRV-ATTR:instance_name | instance-0000000d |
| 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-zoria5fn |
| 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 | ejFD96k8DUkW |
| config_drive | |
| created | 2021-10-19T02:09:45Z |
| description | - |
| flavor | m1.lxh (111) |
| hostId | |
| host_status | |
| id | 22d0a54b-2a6f-4ea8-8729-dc07055c19e5 |
| image | centos7.2 (8aec8782-c6af-41d8-a225-ada5a2af13dc) |
| key_name | - |
| locked | False |
| metadata | {} |
| name | test-server |
| os-extended-volumes:volumes_attached | [] |
| progress | 0 |
| security_groups | zzz |
| status | BUILD |
| tenant_id | 386dbfcf77e444c7872e4e23d5829fcc |
| updated | 2021-10-19T02:09:55Z |
| user_id | 0f217182b5af448c988f5464c706a337 |
+--------------------------------------+--------------------------------------------------+ # 实例停止
[root@controller ~]# nova stop zzz_server
Request to stop server zzz_server has been accepted. # 实例启动
[root@controller ~]# nova start zzz_server
Request to start server zzz_server has been accepted. # 实例重启
[root@controller ~]# nova reboot zzz_server
Request to reboot server <Server: zzz_server> has been accepted.
[root@controller ~]# nova list
+--------------------------------------+------------+---------+----------------+-------------+----------------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+------------+---------+----------------+-------------+----------------------------------+
| b51590fc-33cc-4d54-8e54-c0530e912d2b | zzz_server | REBOOT | reboot_started | Running | int-gre=172.25.2.8 |
| c6cabeed-1176-4634-b493-b6be7c351a03 | test | SHUTOFF | - | Shutdown | int-gre=172.25.2.3, 192.168.20.4 |
+--------------------------------------+------------+---------+----------------+-------------+----------------------------------+ # 实例挂起
[root@controller ~]# nova pause test
[root@controller ~]# nova list
+--------------------------------------+------------+--------+----------------+-------------+----------------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+------------+--------+----------------+-------------+----------------------------------+
| b51590fc-33cc-4d54-8e54-c0530e912d2b | zzz_server | REBOOT | reboot_started | Running | int-gre=172.25.2.8 |
| c6cabeed-1176-4634-b493-b6be7c351a03 | test | PAUSED | - | Paused | int-gre=172.25.2.3, 192.168.20.4 |
+--------------------------------------+------------+--------+----------------+-------------+----------------------------------+ # 实例删除
[root@controller ~]# nova delete zzz_server
Request to delete server zzz_server has been accepted.
[root@controller ~]# nova list
+--------------------------------------+------+--------+------------+-------------+----------------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+------+--------+------------+-------------+----------------------------------+
| c6cabeed-1176-4634-b493-b6be7c351a03 | test | PAUSED | - | Paused | int-gre=172.25.2.3, 192.168.20.4 |
+--------------------------------------+------+--------+------------+-------------+----------------------------------+

4、浮动IP

nova
floating-ip-associate Associate a floating IP address to a server.
floating-ip-bulk-create Bulk create floating IPs
by range (nova-network only).
floating-ip-bulk-delete Bulk delete floating IPs by range (nova-
network only).
floating-ip-bulk-list List all floating IPs (nova-network only).
floating-ip-create Allocate a floating IP for the current tenant.
floating-ip-delete De-allocate a floating IP.
floating-ip-disassociate Disassociate a floating IP address from a
server.
floating-ip-list List floating IPs.
floating-ip-pool-list List all floating IP pools. # 创建浮动IP
# 语法:nova floating-ip-create <pool>
[root@controller nova]# nova floating-ip-create net-gre
+--------------------------------------+--------------+-----------+----------+---------+
| Id | IP | Server Id | Fixed IP | Pool |
+--------------------------------------+--------------+-----------+----------+---------+
| fcb2439d-ba4f-4467-ad60-34726d57aba4 | 192.168.37.5 | - | - | net-gre |
+--------------------------------------+--------------+-----------+----------+---------+ # 浮动IP的列表信息
[root@controller nova]# nova floating-ip-list
+--------------------------------------+--------------+-----------+----------+---------+
| Id | IP | Server Id | Fixed IP | Pool |
+--------------------------------------+--------------+-----------+----------+---------+
| fcb2439d-ba4f-4467-ad60-34726d57aba4 | 192.168.37.5 | - | - | net-gre |
+--------------------------------------+--------------+-----------+----------+---------+ # 浮动IP地址池信息
[root@controller nova]# nova floating-ip-pool-list
+---------+
| name |
+---------+
| net-gre |
+---------+ # 查看浮动IP详细信息
[root@controller nova]# openstack ip floating show 192.168.37.5
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| description | |
| dns_domain | |
| dns_name | |
| fixed_ip_address | None |
| floating_ip_address | 192.168.37.5 |
| floating_network_id | 847163a4-65dd-456e-a839-4f810cce80cf |
| id | fcb2439d-ba4f-4467-ad60-34726d57aba4 |
| port_id | None |
| project_id | 386dbfcf77e444c7872e4e23d5829fcc |
| router_id | None |
| status | DOWN |
+---------------------+--------------------------------------+ # 浮动ip关联给实例
# 语法:nova floating-ip-associate [--fixed-address <fixed_address>] <server> <address>
# 参数:
# <server> Name or ID of server.(nova list)
# <address> IP Address.(nova floating-ip-list)
[root@controller nova]# nova floating-ip-associate caocao-server1 192.168.37.5
[root@controller nova]# nova list
+--------------------------------------+----------------+--------+------------+-------------+---------------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+----------------+--------+------------+-------------+---------------------------------+
| e2c75e51-1a3b-4a0b-8765-d7ff6e8188e3 | caocao-server1 | ACTIVE | - | Running | int-gre=10.10.0.3, 192.168.37.5 |
+----------------------- # 浮动IP解除关联实例
# 语法:nova floating-ip-disassociate <server> <address>
[root@controller nova]# nova floating-ip-disassociate caocao-server1 192.168.37.5
[root@controller nova]# nova list
+--------------------------------------+----------------+--------+------------+-------------+-------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+----------------+--------+------------+-------------+-------------------+
| e2c75e51-1a3b-4a0b-8765-d7ff6e8188e3 | caocao-server1 | ACTIVE | - | Running | int-gre=10.10.0.3 |
+--------------------------------------+----------------+--------+------------+-------------+-------------------+ # 解除关联并删除浮动IP
[root@controller nova]# nova floating-ip-associate caocao-server1 192.168.37.5
[root@controller nova]# nova floating-ip-delete 192.168.37.5
[root@controller nova]# nova list
+--------------------------------------+----------------+--------+------------+-------------+-------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+----------------+--------+------------+-------------+-------------------+
| e2c75e51-1a3b-4a0b-8765-d7ff6e8188e3 | caocao-server1 | ACTIVE | - | Running | int-gre=10.10.0.3 |
+---------
[root@controller nova]# nova floating-ip-list
+----+----+-----------+----------+------+
| Id | IP | Server Id | Fixed IP | Pool |
+----+----+-----------+----------+------+
+----+----+-----------+----------+------+

5、密钥管理

nova
keypair-add Create a new key pair for use with servers.
keypair-delete Delete keypair given by its name. (Supported
by API versions '2.0' - '2.latest') [hint: use
'--os-compute-api-version' flag to show help
message for proper version]
keypair-list Print a list of keypairs for a user (Supported
by API versions '2.0' - '2.latest') [hint: use
'--os-compute-api-version' flag to show help
message for proper version]
keypair-show Show details about the given keypair.
(Supported by API versions '2.0' - '2.latest')
[hint: use '--os-compute-api-version' flag to
show help message for proper version] # 查看密钥列表
[root@controller ~]# nova keypair-list
+------+------+-------------------------------------------------+
| Name | Type | Fingerprint |
+------+------+-------------------------------------------------+
| test | ssh | 5c:7e:d8:bd:b9:33:cb:f9:eb:b8:52:c4:04:7c:8c:1e |
+------+------+-------------------------------------------------+ # 查看密钥详情
[root@controller ~]# nova keypair-show test
+-------------+-------------------------------------------------+
| Property | Value |
+-------------+-------------------------------------------------+
| created_at | 2021-10-28T14:06:12.000000 |
| deleted | False |
| deleted_at | - |
| fingerprint | 5c:7e:d8:bd:b9:33:cb:f9:eb:b8:52:c4:04:7c:8c:1e |
| id | 1 |
| name | test |
| type | ssh |
| updated_at | - |
| user_id | 0f217182b5af448c988f5464c706a337 |
+-------------+-------------------------------------------------+
Public key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDc/qEc2ihvE7aLgSVH0lt5PDBwEYXW0CqMx8sGJPT1p3r0mxdJiti9pJxBRoX+oOhA/LFssaOGvtHDK79Njs3HynrXkxvKo6UfmBNQzt2z5C3nTP2U17JY2wrOh7YyYdhuuRirCLNHQk4hM1YY9BbPrCLjLlQ8Gms6vdgDCgT1gXuRppBTfQKrIKKRk6d5vIqBMoGM3fCaM34DiqwOS/uq8gQM8T/io9h6XrTKWznmZgzaFJ2S3XUZhAliSEgkraxZIM8L3QWumMlBVryYVUX6QEKv29hNWYZF/bxUqfQx50vBuIfHlKgkcccAVDy6OoZNmd6T1rdJXEdW+MWobHu7 Generated-by-Nova # 创建密钥
[root@controller ~]# nova keypair-add zzz --key-type ssh
-----BEGIN RSA PRIVATE KEY-----
MIIEpwIBAAKCAQEAw3YnZk1ej5j3+CjpWalgmVWxrdAVZGfpC3Qklz+0RW7p4nTn
VlkGL7mWEgx7fmRaBzZuwUuSuvFB79zWhGZqh7Dt0Zeibyy48u3AtZtDY1ZVkvss
Vq7zOdUgg+2C8Em7KTAXsuf1I7KPxgJHX7j9pluN8zBQKiYYi4K+RPCVtisw3ev0
Ey5vi7e1IuUawXpjWnGe+/yzCZWgL8X2uhyYH0cJUmO3PbFuX0aoZr/JsLbMfkeL
0hCDkpKgkx8L/VD6C8FW+Z3mfJGxJtGwakb+BGyOYZ3j/Sv7bh03QKPgViqJ9CGa
WL5/y8dYmFLYM45Gb60FLWPSHWLmH9SFnmV7UwIDAQABAoIBABkiGUDbU/xs8/2x
7Qd9cxFkZntuFUIa5ml1nrrgEyMWdvaKh7Cfs97xIy3g8wQ2jSj+Q9GRESX+nbbl
E6RksvANvRbFQ7q96m46ShxQAaNFV62VpIbk6huWnx63rK2PHYTXTUTQ9MGJVVll
s53IYL1CaodJwBUbXu6ZejPNJ8MLoyom7cH89uaP5K8Ej7pHObaxMBCkSylU0vcG
qJp0Gu1NbnQ823EYm5QeEqUfG8xLyXKOvAq3scZHg5hqdD6SDVOYm3uQM8TF8zkY
SSTYrwktj7g7vP6ZQ0zY3k/s/zxMbTIurwwNm8L93tPcgtJUMw+fPYu3OHr9nhBt
aeFJ6AkCggCBANoJLHA6j5Jgj0uLy+ur8BmU8qSCJ7Nmx3JZFj2ELoZcLzjniHqH
14QHqnBgFxaUAvmpy8wCMnIKrk83FdEkgk2vwSlsr1uEiz+MNHKqapWwiezR87HB
5XsgtHpOsBlTpzQlOL7TJX7kCtZYgyGbQJvLMeek+cqy2YsNp28AgFulAoIAgQDl
fr5dBmEMBtTVaAjZFlyhJIXpf93QeC9KTtCLJ0QXAVPpCLlnulC8W4JfuZDTFqOr
gnx1y84DfyoZ4/K6zPNfqguRRzE2sxMNDLNZeyZiA10uZwEh+AJtCf54FU2xZtVP
1eZ7I4QMR2jaDSj5nWgF90DYHoWLxOEeIVnTnFoplwKCAIANyxrGls3SYs1t6BAk
fqIX3DZldd5xGQVxFHW1upD+6wIJxYv6xHE75wg/R7TuNrrhdH5yD4mFcWuJk2CL
9JVRuNatejS1w3LTuFjxEBriEWMIWlfiXPPZkD4aprO5RnODdv9aAx2SI3cUDFFv
ZNT3hilIEEXFLv9YLqry+MMmCQKCAIBpG+OUN5e7KmXQWBW1V8iVBWVPzICLOoBu
SCq7kQBeiP0lfhlsqKjRnBfaP+NUysmrg9f9G5r/fv6JXR2O8M+GwRsLLtAbfWj8
URTTptOtkFzdI9Ag/rYdurYRybAL0E1ig1VMkLep6Ard06kwqic6lEPeuBvyJ/nz
EtNRWArzgQKCAIAQDXQbP+20nzHoWqy1sFYIpOYrC+pZGX3tZb8DfAKrhrL+FkGe
PSe6bNwgWVDEUwTyvoPUexvAVi7nZ1sqMw/Ar+KxCXcti+dzZZZa3typLQMceOr2
wFfpNMT/Kq2DTrgkXN+jpFczv/R0kNn5bOB/DIm8JUeN44k97lMzIrD7TA==
-----END RSA PRIVATE KEY----- # 删除密钥
[root@controller ~]# nova keypair-list
+------+------+-------------------------------------------------+
| Name | Type | Fingerprint |
+------+------+-------------------------------------------------+
| zzz | ssh | e2:cc:e9:8f:1d:06:45:b4:52:0b:38:68:0d:15:b8:b9 |
| test | ssh | 5c:7e:d8:bd:b9:33:cb:f9:eb:b8:52:c4:04:7c:8c:1e |
+------+------+-------------------------------------------------+
[root@controller ~]# nova keypair-delete zzz
[root@controller ~]# nova keypair-list
+------+------+-------------------------------------------------+
| Name | Type | Fingerprint |
+------+------+-------------------------------------------------+
| test | ssh | 5c:7e:d8:bd:b9:33:cb:f9:eb:b8:52:c4:04:7c:8c:1e |
+------+------+-------------------------------------------------+

三、nova和其他组件交互操作

1、云主机卷挂载操作

nova
volume-attach Attach a volume to a server. # 卷挂载到云主机
volume-attachments List all the volumes attached to a server. # 查看所有挂载到云主机上的卷
volume-detach Detach a volume from a server. # 卷从云主机上卸载
volume-update Update volume attachment. # 卷挂载状态更新 # 卷挂载到云主机
nova volume-attach <server> <volume> [<device>]
Positional arguments:
<server> Name or ID of server.
<volume> ID of the volume to attach.
<device> Name of the device e.g. /dev/vdb. Use "auto" for autoassign (if
supported). Libvirt driver will use default device name. [root@controller cinder]# nova volume-attach test111 f594e936-05e2-4a8c-b4c9-b96bbe7e2c82 /dev/vdb
+----------+--------------------------------------+
| Property | Value |
+----------+--------------------------------------+
| device | /dev/vdb |
| id | f594e936-05e2-4a8c-b4c9-b96bbe7e2c82 |
| serverId | 4b3a90f0-4177-44cc-8ef2-34a0e5d56b33 |
| volumeId | f594e936-05e2-4a8c-b4c9-b96bbe7e2c82 |
+----------+--------------------------------------+ # 查看所有挂载到云主机上的卷
[root@controller cinder]# nova volume-attachments test111
+--------------------------------------+----------+--------------------------------------+--------------------------------------+
| ID | DEVICE | SERVER ID | VOLUME ID |
+--------------------------------------+----------+--------------------------------------+--------------------------------------+
| f594e936-05e2-4a8c-b4c9-b96bbe7e2c82 | /dev/vdb | 4b3a90f0-4177-44cc-8ef2-34a0e5d56b33 | f594e936-05e2-4a8c-b4c9-b96bbe7e2c82 |
+--------------------------------------+----------+--------------------------------------+--------------------------------------+ # 卷从云主机上卸载
nova volume-detach <server> <volume>
Positional arguments:
<server> Name or ID of server.
<volume> ID of the volume to detach. [root@controller cinder]# nova volume-detach test111 f594e936-05e2-4a8c-b4c9-b96bbe7e2c82
[root@controller cinder]# nova volume-attachments test111
+----+--------+-----------+-----------+
| ID | DEVICE | SERVER ID | VOLUME ID |
+----+--------+-----------+-----------+
+----+--------+-----------+-----------+

openstack中Nova组件简解的更多相关文章

  1. openstack中Neutron组件简解

    一.Neutron概述 Neutron 的设计目标是实现"网络即服务(Networking as a Service)".为了达到这一目标,在设计上遵循了基于 SDN 实现网络虚拟 ...

  2. openstack中Keystone组件简解

    一.Keystone服务概述 在Openstack框架中,keystone(Openstack Identity Service)的功能是负责验证身份.校验服务规则和发布服务令牌的,它实现了Opens ...

  3. openstack中Glance组件简解

    一.Glance组件介绍 1.概念 Glance是OpenStack镜像服务,用来注册.登陆和检索虚拟机镜像.Glance服务提供了一个REST API,使你能够查询虚拟机镜像元数据和检索的实际镜像. ...

  4. openstack中Cinder组件简解

    一,Cinder组件介绍 概念 cinder组件作用: 块存储服务,为运行实例提供稳定的数据块存储服务 块存储服务,提供对 volume 从创建到删除整个生命周期的管理 二,常用操作 1.Volume ...

  5. OpenStack 的Nova组件详解

    Open Stack Compute Infrastructure (Nova) Nova是OpenStack云中的计算组织控制器.支持OpenStack云中实例(instances)生命周期的所有活 ...

  6. openstack中Nova组件images的全部python API 汇总

    感谢朋友支持本博客.欢迎共同探讨交流,因为能力和时间有限,错误之处在所难免.欢迎指正! 假设转载,请保留作者信息. 博客地址:http://blog.csdn.net/qq_21398167 原博文地 ...

  7. openstack中nova组件Hypervisors、Floating_ips的全部python API 汇总

    感谢朋友支持本博客,欢迎共同探讨交流,因为能力和时间有限.错误之处在所难免,欢迎指正! 假设转载.请保留作者信息. 博客地址:http://blog.csdn.net/qq_21398167 原博文地 ...

  8. openstack中Nova组件Networks的全部python API 汇总

    感谢朋友支持本博客.欢迎共同探讨交流.因为能力和时间有限.错误之处在所难免,欢迎指正! 假设转载,请保留作者信息. 博客地址:http://blog.csdn.net/qq_21398167 原博文地 ...

  9. Android中Intent组件详解

    Intent是不同组件之间相互通讯的纽带,封装了不同组件之间通讯的条件.Intent本身是定义为一个类别(Class),一个Intent对象表达一个目的(Goal)或期望(Expectation),叙 ...

随机推荐

  1. 【小程序自动化Minium】一、框架介绍和环境搭建

    微信小程序自动化测试系列分享 一.Minium 简介 minium 是微信团队为小程序专门开发的自动化框架,我们可以用它来做小程序的UI自动化测试,但是它的能力却不仅仅在于UI自动化. 正是得益于官方 ...

  2. 深入理解springboot的自动注入

    一.开篇   在平时的开发过程中用的最多的莫属springboot了,都知道springboot中有自动注入的功能,在面试过程中也会问到自动注入,你知道自动注入是怎么回事吗,springboot是如何 ...

  3. SVN+Maven+Tomcat+Jenkins持续构建

    一.准备工作 1.1安装软件 安装JDK.SVN.Maven.Tomcat.Jenkins及必要插件. 1.2安装jenkins所需插件 最开始安装jenkins时选择安装默认的插件. 其他插件: M ...

  4. 细说GaussDB(DWS)复杂多样的资源负载管理手段

    摘要:对于如此多的管控功能,管控起来实际的效果到底如何,本篇文章就基于当前最新版本,进行效果实测,并进行一定的分析说明. 本文分享自华为云社区<GaussDB(DWS) 资源负载管理:并发管控以 ...

  5. 来用python自己做一个闹钟吧

    闹钟 是一种具有可以在预先设定的时间被激活以响铃的功能的时钟,用于唤醒打工人们. 使用Python中的DateTime模块来创建闹钟,并用Python中的playsound库来播放闹钟声音.~~~## ...

  6. 经典的损失函数:交叉熵和MSE

    经典的损失函数: ①交叉熵(分类问题):判断一个输出向量和期望向量有多接近.交叉熵刻画了两个概率分布之间的距离,他是分类问题中使用比较广泛的一种损失函数.概率分布刻画了不同事件发生的概率. 熵的定义: ...

  7. day03_2_流程控制

    # 流程控制 学习目标: ~~~txt1. idea安装与使用2. 流程控制if...else结构3. 流程控制switch结构4. 流程控制循环结构5. 流程控制关键字~~~ # 一.流程控制概述 ...

  8. 求广义表深度(严5.30)--------西工大noj

    #include <stdio.h> #include <stdlib.h> #include <string.h> typedef enum{ATOM, LIST ...

  9. 网格动物UVA1602

    题目大意 输入n,w,h(1<=n<=10,1<=w,h<=n).求能放在w*h网格里的不同的n连块的个数(平移,旋转,翻转算一种) 首先,方法上有两个,一是打表,dfs构造连 ...

  10. nginx的高级用法

    一.根据url中的参数来确定缓存的key set_by_lua_block $dataArg { local enc = ngx.req.get_uri_args()["enc"] ...