#rabbitmq
1、 查看rabbitmq 队列:rabbitmqctl list_queues
[root@controller openstack]# rabbitmqctl list_queues
Listing queues ...
q-reports-plugin_fanout_725aacafeb8b46efb087b4b430e3b9a0 0
q-plugin 0
q-reports-plugin_fanout_be5c8ad88fc94fe68fabdfe2d455e4d3 0
consoleauth.controller 0
q-agent-notifier-network-delete.controller 0
q-plugin.controller 0
q-plugin_fanout_f01d03e127104aa792bba5492b04d477 0
#keystone
##查询
1、查看keystone的用户:keystone user-list |K版之后使用openstack user list
[root@controller openstack]# openstack user list
+----------------------------------+---------+
| ID | Name |
+----------------------------------+---------+
| 7eb9e0334783464d8d3c1af1f645fb38 | nova |
| 8e678c2d9389412c8bb8ba9710b4b148 | demo |
| b39106bf6b8047b198569f0625dbe44d | neutron |
| cd4defe69232424e864726ebd078c010 | admin |
| dde16aefcab54766b51f4af85ec6fe54 | glance |
+----------------------------------+---------+
2、查看keystone endpoint:keystone endpoint-list | K版之后使用openstack endpoint list
[root@controller openstack]# openstack endpoint list
+----------------------------------+-----------+--------------+--------------+---------+-----------+-------------------------------------------+
| ID | Region | Service Name | Service Type | Enabled | Interface | URL |
+----------------------------------+-----------+--------------+--------------+---------+-----------+-------------------------------------------+
| 1f733ab7407c413b9e1db7dd24ef7dd6 | RegionOne | glance | image | True | public | http://controller:9292 |
| 32754c5c14664987ad0c5cf2b44b73fa | RegionOne | nova | compute | True | internal | http://controller:8774/v2.1/%(tenant_id)s |
| 52613ff5c1e641fba0f3595d09a100b3 | RegionOne | neutron | network | True | admin | http://controller:9696 |
| 84735f3105764b449ec19c173e6fc94b | RegionOne | neutron | network | True | public | http://controller:9696 |
| 8fdb4e4a1d85488ca390eac8470a7f97 | RegionOne | nova | compute | True | admin | http://controller:8774/v2.1/%(tenant_id)s |
| 9ba9b2604ad548ee97380a6b429ab867 | RegionOne | keystone | identity | True | admin | http://controller:35357/v3 |
| a5b21eb6277e47d4aa3e287ab48fe2ba | RegionOne | glance | image | True | internal | http://controller:9292 |
| aaf41938fd164ab894c1b8b39f530258 | RegionOne | glance | image | True | admin | http://controller:9292 |
| b45bfe55a6a04ba0aed3391e39a0c5ed | RegionOne | keystone | identity | True | public | http://controller:5000/v3 |
| bd9b5be37d094b7f92643d145b6302b4 | RegionOne | nova | compute | True | public | http://controller:8774/v2.1/%(tenant_id)s |
| c3fadc665a6f4c2dba119140b3221d16 | RegionOne | neutron | network | True | internal | http://controller:9696 |
| d0500b0377764db0b5e55e4fcd490a5f | RegionOne | keystone | identity | True | internal | http://controller:5000/v3 |
+----------------------------------+-----------+--------------+--------------+---------+-----------+-------------------------------------------+
3、 查看keystone的role:keystone role-list | K版之后使用openstack role list
[root@controller openstack]# openstack role list
+----------------------------------+-------+
| ID | Name |
+----------------------------------+-------+
| 990fbd626f524510a393d307e3e8a575 | user |
| e2e6dd73a55840f699d49dbe5e57f2f8 | admin |
+----------------------------------+-------+
4、查看keystone 服务:keystone service-list | K版之后使用openstack service list
[root@controller openstack]# openstack service list
+----------------------------------+----------+----------+
| ID | Name | Type |
+----------------------------------+----------+----------+
| 050e27a202f44d7cb58cec6bd51e9989 | neutron | network |
| 071c1756bb564070a4a5f6ac7fd08d71 | glance | image |
| 764ed1c44f624b30b38469d8fbe67c00 | keystone | identity |
| f1c95d1774784eedabbcf2b10b5a4acc | nova | compute |
+----------------------------------+----------+----------+
5、查看keystone租户:keystone tenant-list | K版之后使用openstack project list
[root@controller openstack]# openstack project list
+----------------------------------+---------+
| ID | Name |
+----------------------------------+---------+
| 065254fec75746419f5c73aee12a3360 | service |
| 6238626c6a6e44a7a95766eff16193c3 | demo |
| f2c087c678a446929110f5fe67b456ee | admin |
+----------------------------------+---------+
6、查看租户情况:keystone tenant-get 用户ID/用户名 | K版之后使用openstack project show 用户ID/用户名
[root@controller openstack]# openstack project show 065254fec75746419f5c73aee12a3360
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Service Project |
| domain_id | ab355ba21130434bbe54adcf0723713d |
| enabled | True |
| id | 065254fec75746419f5c73aee12a3360 |
| is_domain | False |
| name | service |
| parent_id | ab355ba21130434bbe54adcf0723713d |
+-------------+----------------------------------+
[root@controller openstack]# openstack project show service
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Service Project |
| domain_id | ab355ba21130434bbe54adcf0723713d |
| enabled | True |
| id | 065254fec75746419f5c73aee12a3360 |
| is_domain | False |
| name | service |
| parent_id | ab355ba21130434bbe54adcf0723713d |
+-------------+----------------------------------+
##增加
1、创建域 。openstack project --domain 域 --description “描述” 项目名
[root@controller openstack]# openstack domain create --description "Test Domain" test
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Test Domain |
| enabled | True |
| id | 2df857d76a6a45618fb7f44df7f4bf30 |
| name | test |
+-------------+----------------------------------+
2、创建项目(租户)。openstack project --domain 域 --description “描述” 项目名
[root@controller openstack]# openstack project create --domain test --description "Test Project" projectTest
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Test Project |
| domain_id | 2df857d76a6a45618fb7f44df7f4bf30 |
| enabled | True |
| id | e8a9be8ed46c42a5b2ec4af4e3ea84b0 |
| is_domain | False |
| name | projectTest |
| parent_id | 2df857d76a6a45618fb7f44df7f4bf30 |
+-------------+----------------------------------+
3、创建用户。openstack user create --domain 域 --password-prompt 用户名
[root@controller openstack]# openstack user create --domain test --password-prompt admin
User Password:
Repeat User Password:
+-----------+----------------------------------+
| Field | Value |
+-----------+----------------------------------+
| domain_id | 2df857d76a6a45618fb7f44df7f4bf30 |
| enabled | True |
| id | 954e3d42d4414f69875867e8cab1c0a8 |
| name | admin |
+-----------+----------------------------------+
4、创建角色。 openstack role create 角色名
[root@controller openstack]# openstack role create Admin1
+-----------+----------------------------------+
| Field | Value |
+-----------+----------------------------------+
| domain_id | None |
| id | e638fe3a771844bc9b51fd704e60ccb1 |
| name | Admin1 |
+-----------+----------------------------------+
5、为某项目中的某用户指定角色。openstack role add --project 项目 --user 角色名\用户ID 项目名\项目ID
[root@controller openstack]# openstack role add --project projectTest --user admin Admin1
##其他组件的keystone配置
1、为组件创建用户。openstack user create --domain 域 --password-prompt 组件用户名
[root@controller openstack]# openstack user create --domain test --password-prompt admin
User Password:
Repeat User Password:
+-----------+----------------------------------+
| Field | Value |
+-----------+----------------------------------+
| domain_id | 2df857d76a6a45618fb7f44df7f4bf30 |
| enabled | True |
| id | 954e3d42d4414f69875867e8cab1c0a8 |
| name | admin |
+-----------+----------------------------------+
2、 将组件用户添加到service项目的admin角色中。
openstack role add --project service --user 组件用户名 admin
3、 为组件创建服务实体。openstack service create --name 服务名 --description “服务描述” 类型
[root@controller openstack]# openstack service create --name serviceTest --description "service test" type
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | service test |
| enabled | True |
| id | 2776eda9d859402aa3e969b0b4611073 |
| name | serviceTest |
| type | type |
+-------------+----------------------------------+
4、 创建服务API
##删除
1、删除服务。 openstack service delete 服务名\服务ID
2、删除某用户的某角色 。 openstack role remove --project 项目名\ID --user 用户名\ID 角色名\ID
openstack role remove --project projectTest --user admin Admin1
3、删除某角色。 openstack role delete 角色名\ID
4、删除某用户 。openstack user delete 用户名\ID
5、删除某项目。 openstack project delete 项目名\ID
6、删除域。
[root@controller openstack]# openstack domain set --disable test
[root@controller openstack]# openstack domain delete test
[root@controller openstack]# openstack domain list
+----------------------------------+---------+---------+----------------+
| ID | Name | Enabled | Description |
+----------------------------------+---------+---------+----------------+
| ab355ba21130434bbe54adcf0723713d | default | True | Default Domain |
+----------------------------------+---------+---------+----------------+
##错误检测
1、查看keystone进程:ps -ef | grep -i keystone
2、查看日志是否有错误:grep ERROR /var/log/keystone/keystone.log
#glance
1上传镜像
openstack image create "cirros" \
--file /root/cirros-0.3.4-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--public
##查询
1、查看image:glance image-list 、openstack image list、nova image-list
[root@controller openstack]# nova image-list
+--------------------------------------+--------+--------+--------+
| ID | Name | Status | Server |
+--------------------------------------+--------+--------+--------+
| c4d5f159-e1d9-4033-9e11-f9d1b63a777a | cirros | ACTIVE | |
+--------------------------------------+--------+--------+--------+
[root@controller openstack]# glance image-list
+--------------------------------------+--------+
| ID | Name |
+--------------------------------------+--------+
| c4d5f159-e1d9-4033-9e11-f9d1b63a777a | cirros |
+--------------------------------------+--------+
[root@controller openstack]# openstack image list
+--------------------------------------+--------+--------+
| ID | Name | Status |
+--------------------------------------+--------+--------+
| c4d5f159-e1d9-4033-9e11-f9d1b63a777a | cirros | active |
+--------------------------------------+--------+--------+
2、查看image具体信息:openstack image show ID
[root@controller openstack]# openstack image show c4d5f159-e1d9-4033-9e11-f9d1b63a777a
+------------------+------------------------------------------------------+
| Field | Value |
+------------------+------------------------------------------------------+
| checksum | ee1eca47dc88f4879d8a229cc70a07c6 |
| container_format | bare |
| created_at | 2017-08-16T02:52:58Z |
| disk_format | qcow2 |
| file | /v2/images/c4d5f159-e1d9-4033-9e11-f9d1b63a777a/file |
| id | c4d5f159-e1d9-4033-9e11-f9d1b63a777a |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | f2c087c678a446929110f5fe67b456ee |
| protected | False |
| schema | /v2/schemas/image |
| size | 13287936 |
| status | active |
| tags | |
| updated_at | 2017-08-16T02:52:59Z |
| virtual_size | None |
| visibility | public |
+------------------+------------------------------------------------------+
##错误检测
1、镜像上传后存放在/var/lib/glance/images中
#nova
##查看
1、查看nova 服务:nova-manage service list、openstack compute service list
[root@controller openstack]# nova-manage service list
DEPRECATED: Use the nova service-* commands from python-novaclient instead or the os-services REST resource. The service subcommand will be removed in the 14.0 release.
Binary Host Zone Status State Updated_At
nova-scheduler controller internal enabled :-) 2017-08-25 09:13:25
nova-conductor controller internal enabled :-) 2017-08-25 09:13:24
nova-consoleauth controller internal enabled :-) 2017-08-25 09:13:25
nova-osapi_compute 0.0.0.0 internal enabled XXX None
nova-metadata 0.0.0.0 internal enabled XXX None
nova-compute compute1 nova enabled :-) 2017-08-25 09:13:22
[root@controller openstack]# openstack compute service list
+----+------------------+------------+----------+---------+-------+----------------------------+
| Id | Binary | Host | Zone | Status | State | Updated At |
+----+------------------+------------+----------+---------+-------+----------------------------+
| 1 | nova-scheduler | controller | internal | enabled | up | 2017-08-25T09:16:55.000000 |
| 2 | nova-conductor | controller | internal | enabled | up | 2017-08-25T09:16:54.000000 |
| 8 | nova-consoleauth | controller | internal | enabled | up | 2017-08-25T09:16:55.000000 |
| 18 | nova-compute | compute1 | nova | enabled | up | 2017-08-25T09:16:52.000000 |
+----+------------------+------------+----------+---------+-------+----------------------------+
2、设置安全组规则
设置默认安全组虚拟机能ssh:
设置虚拟机能ping icmp包
3、显示安全组列表nova secgroup-list、openstack security group list
[root@controller openstack]# openstack security group list
+--------------------------------------+---------+------------------------+----------------------------------+
| ID | Name | Description | Project |
+--------------------------------------+---------+------------------------+----------------------------------+
| 403d6083-a10f-469e-89ea-bf6247ebdf36 | default | Default security group | f2c087c678a446929110f5fe67b456ee |
+--------------------------------------+---------+------------------------+----------------------------------+
[root@controller openstack]# nova secgroup-list
+--------------------------------------+---------+------------------------+
| Id | Name | Description |
+--------------------------------------+---------+------------------------+
| 403d6083-a10f-469e-89ea-bf6247ebdf36 | default | Default security group |
+--------------------------------------+---------+------------------------+
4、显示安全组规则
nova secgroup-list-rules default
[root@controller openstack]# nova secgroup-list-rules default
+-------------+-----------+---------+-----------+--------------+
| IP Protocol | From Port | To Port | IP Range | Source Group |
+-------------+-----------+---------+-----------+--------------+
| | | | | default |
| tcp | 22 | 22 | 0.0.0.0/0 | |
| icmp | -1 | -1 | 0.0.0.0/0 | |
| | | | | default |
+-------------+-----------+---------+-----------+--------------+
5、查看虚拟机配置种类:nova flavor-list
[root@controller openstack]# nova flavor-list、openstack flavor list
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 0 | m1.nano | 64 | 1 | 0 | | 1 | 1.0 | True |
| 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 |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
[root@controller openstack]# openstack flavor list
+----+-----------+-------+------+-----------+-------+-----------+
| ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+-----------+-------+------+-----------+-------+-----------+
| 0 | m1.nano | 64 | 1 | 0 | 1 | True |
| 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、查看云系统中有哪些服务器 nova-manage service list |sort
[root@controller openstack]# nova-manage service list|sort
Binary Host Zone Status State Updated_At
nova-compute compute1 nova enabled :-) 2017-08-30 02:42:47
nova-conductor controller internal enabled :-) 2017-08-30 02:42:45
nova-consoleauth controller internal enabled :-) 2017-08-30 02:42:46
nova-metadata 0.0.0.0 internal enabled XXX None
nova-osapi_compute 0.0.0.0 internal enabled XXX None
nova-scheduler controller internal enabled :-) 2017-08-30 02:42:46
7、查看nova版本 nova-manage --version
nova-manage --version
13.1.4
#虚拟机控制命令
1、查看虚拟机:nova list、openstack server list
[root@controller openstack]# nova list
+--------------------------------------+-------------------+---------+------------+-------------+------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+-------------------+---------+------------+-------------+------------------------+
| 3724c84e-ef2d-48eb-a130-eb078d7622fe | provider-instance | ERROR | - | NOSTATE | provider=192.168.1.102 |
| 84cd0fc6-3704-4756-9f27-27bbe43bb980 | provider-instance | SHUTOFF | - | Shutdown | provider=192.168.1.105 |
+--------------------------------------+-------------------+---------+------------+-------------+------------------------+
[root@controller openstack]# openstack server list
+--------------------------------------+-------------------+---------+------------------------+
| ID | Name | Status | Networks |
+--------------------------------------+-------------------+---------+------------------------+
| 84cd0fc6-3704-4756-9f27-27bbe43bb980 | provider-instance | SHUTOFF | provider=192.168.1.105 |
| 3724c84e-ef2d-48eb-a130-eb078d7622fe | provider-instance | ERROR | provider=192.168.1.102 |
+--------------------------------------+-------------------+---------+------------------------+
2、删除虚拟机:nova delete ID、openstack server delete ID
+--------------------------------------+-------------------+---------+------------------------+
| ID | Name | Status | Networks |
+--------------------------------------+-------------------+---------+------------------------+
| 84cd0fc6-3704-4756-9f27-27bbe43bb980 | provider-instance | SHUTOFF | provider=192.168.1.105 |
| 3724c84e-ef2d-48eb-a130-eb078d7622fe | provider-instance | ERROR | provider=192.168.1.102 |
+--------------------------------------+-------------------+---------+------------------------+
[root@controller openstack]# openstack server delete 3724c84e-ef2d-48eb-a130-eb078d7622fe
[root@controller openstack]# openstack server list
+--------------------------------------+-------------------+---------+------------------------+
| ID | Name | Status | Networks |
+--------------------------------------+-------------------+---------+------------------------+
| 84cd0fc6-3704-4756-9f27-27bbe43bb980 | provider-instance | SHUTOFF | provider=192.168.1.105 |
+--------------------------------------+-------------------+---------+------------------------+
3、创建snapshot nova image-create 7eb1d4b3-13fa-4e39-be17-3a27eb0db218 “snapshot 1”
[root@controller openstack]# nova image-list
+--------------------------------------+-----------+--------+--------------------------------------+
| ID | Name | Status | Server |
+--------------------------------------+-----------+--------+--------------------------------------+
| c4d5f159-e1d9-4033-9e11-f9d1b63a777a | cirros | ACTIVE | |
| 4ee5c4be-3edf-431f-bc74-46d38ae7ebff | snapshot1 | ACTIVE | 84cd0fc6-3704-4756-9f27-27bbe43bb980 |
+--------------------------------------+-----------+--------+--------------------------------------+
[root@controller openstack]# openstack server list
+--------------------------------------+-------------------+---------+------------------------+
| ID | Name | Status | Networks |
+--------------------------------------+-------------------+---------+------------------------+
| 84cd0fc6-3704-4756-9f27-27bbe43bb980 | provider-instance | SHUTOFF | provider=192.168.1.105 |
+--------------------------------------+-------------------+---------+------------------------+
[root@controller openstack]# nova image-create 84cd0fc6-3704-4756-9f27-27bbe43bb980 "snapshot 2"
[root@controller openstack]# openstack image list
+--------------------------------------+------------+--------+
| ID | Name | Status |
+--------------------------------------+------------+--------+
| 6ff0c7eb-4214-43ce-a07c-b111beb6e90a | snapshot 2 | active |
| 4ee5c4be-3edf-431f-bc74-46d38ae7ebff | snapshot1 | active |
| c4d5f159-e1d9-4033-9e11-f9d1b63a777a | cirros | active |
+--------------------------------------+------------+--------+
4、虚拟机重启,停止:
nova suspend 84cd0fc6-3704-4756-9f27-27bbe43bb980
nova resume 84cd0fc6-3704-4756-9f27-27bbe43bb980
nova reboot 84cd0fc6-3704-4756-9f27-27bbe43bb980
openstack server suspend 84cd0fc6-3704-4756-9f27-27bbe43bb980
openstack server resume 84cd0fc6-3704-4756-9f27-27bbe43bb980
openstack server reboot 84cd0fc6-3704-4756-9f27-27bbe43bb980
openstack server start 84cd0fc6-3704-4756-9f27-27bbe43bb980
[root@controller openstack]# openstack server list
+--------------------------------------+-------------------+--------+------------------------+
| ID | Name | Status | Networks |
+--------------------------------------+-------------------+--------+------------------------+
| 84cd0fc6-3704-4756-9f27-27bbe43bb980 | provider-instance | ACTIVE | provider=192.168.1.105 |
+--------------------------------------+-------------------+--------+------------------------+
5、获取实例的CPU、内存、磁盘I/O等信息。 nova diagnostics serverID
nova diagnostics a55aeb82-303c-4bdc-92d2-280573a2ff8d
+---------------------------+---------------+
| Property | Value |
+---------------------------+---------------+
| cpu0_time | 5613600000000 |
| memory | 524288 |
| memory-actual | 524288 |
| memory-rss | 72672 |
| tapefb0d3f7-56_rx | 90 |
| tapefb0d3f7-56_rx_drop | 0 |
| tapefb0d3f7-56_rx_errors | 0 |
| tapefb0d3f7-56_rx_packets | 1 |
| tapefb0d3f7-56_tx | 0 |
| tapefb0d3f7-56_tx_drop | 0 |
| tapefb0d3f7-56_tx_errors | 0 |
| tapefb0d3f7-56_tx_packets | 0 |
| vda_errors | -1 |
| vda_read | 1024 |
| vda_read_req | 2 |
| vda_write | 0 |
| vda_write_req | 0 |
+---------------------------+---------------+
6、查询实例的创建信息 nova show serverID
[root@controller openstack]# nova show a55aeb82-303c-4bdc-92d2-280573a2ff8d
+--------------------------------------+----------------------------------------------------------+
| Property | Value |
+--------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | compute1 |
| OS-EXT-SRV-ATTR:hostname | provider-instance |
| OS-EXT-SRV-ATTR:hypervisor_hostname | compute1 |
| 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-b60qsvae |
| 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 | 2017-08-30T03:16:57.000000 |
| OS-SRV-USG:terminated_at | - |
| accessIPv4 | |
| accessIPv6 | |
| config_drive | |
| created | 2017-08-30T03:16:44Z |
| description | provider-instance |
| flavor | m1.tiny (1) |
| hostId | 313f16dfa039b6343dadaa99f596545021ce67260dc5b91e2fe9bcc2 |
| host_status | UP |
| id | a55aeb82-303c-4bdc-92d2-280573a2ff8d |
| image | cirros (c4d5f159-e1d9-4033-9e11-f9d1b63a777a) |
| key_name | mykey |
| locked | False |
| metadata | {} |
| name | provider-instance |
| os-extended-volumes:volumes_attached | [] |
| progress | 0 |
| provider network | 192.168.1.106 |
| security_groups | default |
| status | ACTIVE |
| tenant_id | f2c087c678a446929110f5fe67b456ee |
| updated | 2017-08-30T03:16:57Z |
| user_id | cd4defe69232424e864726ebd078c010 |
+--------------------------------------+----------------------------------------------------------+
[root@controller openstack]# openstack server show serverID
+--------------------------------------+----------------------------------------------------------+
| Field | Value |
+--------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | compute1 |
| OS-EXT-SRV-ATTR:hypervisor_hostname | compute1 |
| OS-EXT-SRV-ATTR:instance_name | instance-00000003 |
| OS-EXT-STS:power_state | 1 |
| OS-EXT-STS:task_state | None |
| OS-EXT-STS:vm_state | active |
| OS-SRV-USG:launched_at | 2017-08-30T03:16:57.000000 |
| OS-SRV-USG:terminated_at | None |
| accessIPv4 | |
| accessIPv6 | |
| addresses | provider=192.168.1.106 |
| config_drive | |
| created | 2017-08-30T03:16:44Z |
| flavor | m1.tiny (1) |
| hostId | 313f16dfa039b6343dadaa99f596545021ce67260dc5b91e2fe9bcc2 |
| id | a55aeb82-303c-4bdc-92d2-280573a2ff8d |
| image | cirros (c4d5f159-e1d9-4033-9e11-f9d1b63a777a) |
| key_name | mykey |
| name | provider-instance |
| os-extended-volumes:volumes_attached | [] |
| progress | 0 |
| project_id | f2c087c678a446929110f5fe67b456ee |
| properties | |
| security_groups | [{u'name': u'default'}] |
| status | ACTIVE |
| updated | 2017-08-30T03:16:57Z |
| user_id | cd4defe69232424e864726ebd078c010 |
+--------------------------------------+----------------------------------------------------------+
#neutron
1、列出当前租户所有的网络:neutron net-list、openstack network list
[root@controller openstack]# neutron net-list
+--------------------------------------+----------+-----------------------------------------------------+
| id | name | subnets |
+--------------------------------------+----------+-----------------------------------------------------+
| 701a839d-6a57-42cc-8278-e7dcdb7af216 | provider | e820c8ae-d020-430b-9b26-46f046e647a7 192.168.1.0/24 |
+--------------------------------------+----------+-----------------------------------------------------+
2、列出所有租户的所有网络:neutron net-list --all-tenants
[root@controller openstack]# neutron net-list --all-tenants
+--------------------------------------+----------+-----------------------------------------------------+
| id | name | subnets |
+--------------------------------------+----------+-----------------------------------------------------+
| 701a839d-6a57-42cc-8278-e7dcdb7af216 | provider | e820c8ae-d020-430b-9b26-46f046e647a7 192.168.1.0/24 |
+--------------------------------------+----------+-----------------------------------------------------+
3、创建一个网络:neutron net-create --shared(所有项目共享网络) --provider:physical_network(物理网络) public(物理网络的名称) --provider:network_type(创建的网络类型为flat,单一扁平网络)flat public-net(自定义一个名称)
$ neutron net-create --shared --provider:physical_network provider \
--provider:network_type flat provider
Created a new network:
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | True |
| id | 0e62efcd-8cee-46c7-b163-d8df05c3c5ad |
| mtu | 1500 |
| name | provider |
| port_security_enabled | True |
| provider:network_type | flat |
| provider:physical_network | provider |
| provider:segmentation_id | |
| router:external | False |
| shared | True |
| status | ACTIVE |
| subnets | |
| tenant_id | d84313397390425c8ed50b2f6e18d092 |
+---------------------------+--------------------------------------+
4、查看一个网络的详细信息:neutron net-show
[root@controller openstack]# neutron net-show provider
+-------------------------+--------------------------------------+
| Field | Value |
+-------------------------+--------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | nova |
| created_at | 2017-08-23T08:46:56 |
| description | |
| id | 701a839d-6a57-42cc-8278-e7dcdb7af216 |
| ipv4_address_scope | |
| ipv6_address_scope | |
| mtu | 1500 |
| name | provider |
| port_security_enabled | True |
| router:external | False |
| shared | True |
| status | ACTIVE |
| subnets | e820c8ae-d020-430b-9b26-46f046e647a7 |
| tags | |
| tenant_id | f2c087c678a446929110f5fe67b456ee |
| updated_at | 2017-08-23T08:46:56 |
+-------------------------+--------------------------------------+
5、删除一个网络:neutron net-delete
6、创建一个子网:neutron subnet-create --name (子网名)–allocation-pool start=开始地址 ,end=结束地址 --dns-nameserver DNS服务器 --gateway网关 网络名 子网IP
[root@controller openstack]# neutron subnet-create --name provider-subnet --allocation-pool start=192.168.1.100,end=192.168.1.200 --dns-nameserver 223.5.5.5 --gateway 192.168.1.1 provider 192.168.1.0/24
Created a new subnet:
+-------------------+----------------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------------+
| allocation_pools | {"start": "192.168.1.100", "end": "192.168.1.200"} |
| cidr | 192.168.1.0/24 |
| created_at | 2017-08-28T07:11:53 |
| description | |
| dns_nameservers | 223.5.5.5 |
| enable_dhcp | True |
| gateway_ip | 192.168.1.1 |
| host_routes | |
| id | 6360600b-9df0-4009-989d-ca1f17e17d6a |
| ip_version | 4 |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | provider-subnet |
| network_id | d687404b-4f96-46c1-9b7d-557cd5dcfd24 |
| subnetpool_id | |
| tenant_id | f2c087c678a446929110f5fe67b456ee |
| updated_at | 2017-08-28T07:11:53 |
+-------------------+----------------------------------------------------+
7、列出所有的agent 。neutron agent-list
[root@controller openstack]# neutron agent-list
+--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+
| id | agent_type | host | availability_zone | alive | admin_state_up | binary |
+--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+
| a6209814-6df3-4af2-9083-839947338347 | Linux bridge agent | controller | | :-) | True | neutron-linuxbridge-agent |
| aa5068d0-8d37-45a7-a936-97bd7c6bf1cb | DHCP agent | controller | nova | :-) | True | neutron-dhcp-agent |
| c34a7b5e-f04c-4e03-96f9-c47dd3465e21 | Metadata agent | controller | | :-) | True | neutron-metadata-agent |
| d5e0b85c-138d-4d83-a3b0-cc4c7269171b | Linux bridge agent | compute1 | | :-) | True | neutron-linuxbridge-agent |
+--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+
#cinder
##查询
1、查看服务器服务 cinder-manage host list |sort
[root@controller openstack]# cinder-manage host list|sort
block1@lvm nova
controller nova
host zone
#结合nova-manage service list|sort 就可以知道云系统中有哪些服务器和服务
#keystone