Openstack Mitaka在图形化界面的时候出现以下报错:

[root@linux-node1 ~]# openstack server create --flavor m1.tiny --p_w_picpath cirros --nic net-id=2d79dc77-be66-4850-af01-8e6946f16035 --security-group default --key-name mykey provider-instance
Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
 (HTTP 500) (Request-ID: req-1d4cf44f-8b06-43e0-8392-25296b29eecb)

查了下网上资料,各种奇葩版本都有,但是对我的这个问题没有任何效果,核查下配置文件:

[root@linux-node1 ~]# . demo-openrc 
[root@linux-node1 ~]# openstack keypair list
+-------+-------------------------------------------------+
| Name  | Fingerprint                                     |
+-------+-------------------------------------------------+
| mykey | 1f:48:e1:77:bb:ea:ea:c8:7b:08:39:b1:96:8d:48:28 |
+-------+-------------------------------------------------+
[root@linux-node1 ~]# 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      |
+----+-----------+-------+------+-----------+-------+-----------+
[root@linux-node1 ~]# openstack p_w_picpath list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| e2a8ac12-1a02-4f5b-bb7d-83064926ccbc | cirros | active |
+--------------------------------------+--------+--------+
You have new mail in /var/spool/mail/root
[root@linux-node1 ~]# openstack network list
+--------------------------------------+----------+--------------------------------------+
| ID                                   | Name     | Subnets                              |
+--------------------------------------+----------+--------------------------------------+
| 2d79dc77-be66-4850-af01-8e6946f16035 | provider | 270b8cca-c8bc-4413-a035-8ed9b77230b6 |
+--------------------------------------+----------+--------------------------------------+
[root@linux-node1 ~]#  openstack security group list
+--------------------------------------+---------+------------------------+-----------------------------
| ID                                   | Name    | Description            | Project                          |
+--------------------------------------+---------+------------------------+----------------------------------+
| eb33483e-827d-480c-8b08-776f1e3a1223 | default | Default security group | cb870d39c2f54546a3de1b64c758bb16 |
+--------------------------------------+---------+------------------------+----------------------------

查看错误日志信息:

[root@linux-node1 nova]# grep ERROR nova-api.log |tail -30
2017-03-14 12:52:38.675 5035 ERROR nova.api.openstack.extensions Unauthorized: Unknown auth type: None
2017-03-14 12:52:38.675 5035 ERROR nova.api.openstack.extensions 
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions [req-1d4cf44f-8b06-43e0-8392-25296b29eecb d02c78a51a72449589c8b63b51fb1c0d cb870d39c2f54546a3de1b64c758bb16 - - -] Unexpected exception in API method
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions Traceback (most recent call last):
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/api/openstack/extensions.py", line 478, in wrapped
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions     return f(*args, **kwargs)
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/api/validation/__init__.py", line 73, in wrapper
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions     return func(*args, **kwargs)
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/api/validation/__init__.py", line 73, in wrapper
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions     return func(*args, **kwargs)
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/api/validation/__init__.py", line 73, in wrapper
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions     return func(*args, **kwargs)
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/servers.py", line 629, in create
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions     **create_kwargs)
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/hooks.py", line 154, in inner
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions     rv = f(*args, **kwargs)
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1563, in create
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions     check_server_group_quota=check_server_group_quota)
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 1146, in _create_instance
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions     reservation_id, max_count)
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/compute/api.py", line 873, in _validate_and_build_base_options
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions     pci_request_info, requested_networks)
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/network/neutronv2/api.py", line 1081, in create_pci_requests_for_sriov_ports
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions     neutron = get_client(context, admin=True)
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/network/neutronv2/api.py", line 141, in get_client
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions     _ADMIN_AUTH = _load_auth_plugin(CONF)
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/network/neutronv2/api.py", line 122, in _load_auth_plugin
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions     raise neutron_client_exc.Unauthorized(message=err_msg)
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions Unauthorized: Unknown auth type: None
2017-03-14 12:58:11.089 5035 ERROR nova.api.openstack.extensions

按照报错提示,检查我的nova配置,检查控制节点和计算节点,也没发现有啥异常

grep 'ERROR' /var/log/nova/*
grep 'ERROR' /var/log/neutron/*
grep 'ERROR' /var/log/glance/*
grep 'ERROR' /var/log/keystone/*

后来排查发现(自己在编辑neutron的时候,忘记添加rpc_backend = rabbit):

安装openstack踩的一个坑_第1张图片

在计算节点后控制节点都添加后,重启neutron相关服务,然后再次执行创建云主机的操作

[root@linux-node1 ~]# openstack server create --flavor m1.tiny --p_w_picpath cirros --nic net-id=2d79dc77-be66-4850-af01-8e6946f16035 --security-group default --key-name mykey provider-instance
[root@linux-node1 ~]# openstack network list
+--------------------------------------+----------+--------------------------------------+
| ID                                   | Name     | Subnets                              |
+--------------------------------------+----------+--------------------------------------+
| 2d79dc77-be66-4850-af01-8e6946f16035 | provider | 270b8cca-c8bc-4413-a035-8ed9b77230b6 |
+--------------------------------------+----------+--------------------------------------+
You have new mail in /var/spool/mail/root
查看发现云主机已经生效
[root@linux-node1 ~]# openstack server list
+--------------------------------------+-------------------+--------+----------------------+
| ID                                   | Name              | Status | Networks             |
+--------------------------------------+-------------------+--------+----------------------+
| 3ffb5d28-bfee-4562-bbb2-57d3956a8f0c | provider-instance | ACTIVE | provider=10.10.10.89 |
+--------------------------------------+-------------------+--------+----------------------+

在数据库中进行核对:

[root@linux-node1 ~]# mysql -unova -p
Enter password: 
MariaDB [(none)]> use nova;
MariaDB [nova]> show tables;
+--------------------------------------------+
| Tables_in_nova                             |
+--------------------------------------------+
| agent_builds                               |
| aggregate_hosts                            |
| aggregate_metadata                         |
| aggregates                                 |
| allocations                                |
| block_device_mapping                       |
| bw_usage_cache                             |
| cells                                      |
| certificates                               |
| compute_nodes                              |
| console_pools                              |
| consoles                                   |
| dns_domains                                |
| fixed_ips                                  |
| floating_ips                               |
| instance_actions                           |
| instance_actions_events                    |
| instance_extra                             |
| instance_faults                            |
| instance_group_member                      |
| instance_group_policy                      |
| instance_groups                            |
| instance_id_mappings                       |
| instance_info_caches                       |
| instance_metadata                          |
| instance_system_metadata                   |
| instance_type_extra_specs                  |
| instance_type_projects                     |
| instance_types                             |
| instances                                  |
| inventories                                |
| key_pairs                                  |
| migrate_version                            |
| migrations                                 |
| networks                                   |
| pci_devices                                |
| project_user_quotas                        |
| provider_fw_rules                          |
| quota_classes                              |
| quota_usages                               |
| quotas                                     |
| reservations                               |
| resource_provider_aggregates               |
| resource_providers                         |
| s3_p_w_picpaths                                  |
| security_group_default_rules               |
| security_group_instance_association        |
| security_group_rules                       |
| security_groups                            |
| services                                   |
| shadow_agent_builds                        |
| shadow_aggregate_hosts                     |
| shadow_aggregate_metadata                  |
| shadow_aggregates                          |
| shadow_block_device_mapping                |
| shadow_bw_usage_cache                      |
| shadow_cells                               |
| shadow_certificates                        |
| shadow_compute_nodes                       |
| shadow_console_pools                       |
| shadow_consoles                            |
| shadow_dns_domains                         |
| shadow_fixed_ips                           |
| shadow_floating_ips                        |
| shadow_instance_actions                    |
| shadow_instance_actions_events             |
| shadow_instance_extra                      |
| shadow_instance_faults                     |
| shadow_instance_group_member               |
| shadow_instance_group_policy               |
| shadow_instance_groups                     |
| shadow_instance_id_mappings                |
| shadow_instance_info_caches                |
| shadow_instance_metadata                   |
| shadow_instance_system_metadata            |
| shadow_instance_type_extra_specs           |
| shadow_instance_type_projects              |
| shadow_instance_types                      |
| shadow_instances                           |
| shadow_key_pairs                           |
| shadow_migrate_version                     |
| shadow_migrations                          |
| shadow_networks                            |
| shadow_pci_devices                         |
| shadow_project_user_quotas                 |
| shadow_provider_fw_rules                   |
| shadow_quota_classes                       |
| shadow_quota_usages                        |
| shadow_quotas                              |
| shadow_reservations                        |
| shadow_s3_p_w_picpaths                           |
| shadow_security_group_default_rules        |
| shadow_security_group_instance_association |
| shadow_security_group_rules                |
| shadow_security_groups                     |
| shadow_services                            |
| shadow_snapshot_id_mappings                |
| shadow_snapshots                           |
| shadow_task_log                            |
| shadow_virtual_interfaces                  |
| shadow_volume_id_mappings                  |
| shadow_volume_usage_cache                  |
| snapshot_id_mappings                       |
| snapshots                                  |
| tags                                       |
| task_log                                   |
| virtual_interfaces                         |
| volume_id_mappings                         |
| volume_usage_cache                         |
+--------------------------------------------+
109 rows in set (0.02 sec)
MariaDB [nova]> select uuid from instances \G;
*************************** 1. row ***************************
uuid: 3ffb5d28-bfee-4562-bbb2-57d3956a8f0c
*************************** 2. row ***************************
uuid: 55cbd36c-0308-4d9a-b43e-978680002abf
2 rows in set (0.01 sec)
ERROR: No query specified
在计算节点上进行比对:
[root@linux-node2 nova]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 1     instance-00000001              running
 2     instance-00000002              running
[root@linux-node2 nova]# virsh domuuid instance-00000001
3ffb5d28-bfee-4562-bbb2-57d3956a8f0c
[root@linux-node2 nova]# virsh domuuid instance-00000002
55cbd36c-0308-4d9a-b43e-978680002abf

到此,问题得到解决,OpenStack的配置是个细心活,需要明白它的各个组件的关联,这样排除故障的时候会有的放矢。