在 OpenStack 中创建实例时未设置元数据(如主机名)

在 OpenStack 中创建实例时未设置元数据(如主机名)

通过在 OpenStack 中创建实例,IP 会被注入到实例中,但不会注入主机名和密钥对等其他元数据。nova 和 neutron 日志文件中没有错误。

问题

...
checking http://169.254.169.254/2009-04-04/instance-id
failed 1/20: up 5.45. request failed
failed 2/20: up 7.47. request failed
...
failed 19/20: up 746.84. request failed
failed 20/20: up 795.86. request failed
failed to read iid from metadata. tried 20
failed to get instance-id of datasource
Top of dropbear init script
Starting dropbear sshd: failed to get instance-id of datasource
OK
...

上面的代码片段是 Cirros 实例创建日志的一部分。(创建过程的完整日志已发布这里

日志中的另一个错误是此行: acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge。这与问题有关吗?

一些配置文件:

# /etc/neutron/dhcp_agent.ini
[DEFAULT]
interface_driver = openvswitch
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true
force_metadata = true


#/etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]
type_drivers = vxlan,vlan,flat
tenant_network_types = vxlan
mechanism_drivers = openvswitch,l2population
extension_drivers = port_security
[ml2_type_flat]
flat_networks = provider
[ml2_type_vxlan]
vni_ranges = 1:1000


#/etc/neutron/plugins/ml2/openvswitch_agent.ini
[agent]
tunnel_types = vxlan
l2_population = True
[dhcp]
[network_log]
[ovs]
local_ip = 10.0.0.1
bridge_mappings = provider:br-provider
[securitygroup]
firewall_driver = iptables_hybrid

计算节点配置:https://p.teknik.io/Ck1Ae

以下是cloud-init.log实例中的错误:

cloud-init.log 文件中的错误

ip netns exec qdhcp-3b5bbc53-7638-4480-9349-407944933413 ip a

77: tap588fefad-6c: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UNKNOWN group default qlen 1000
    link/ether fa:16:3e:df:33:e1 brd ff:ff:ff:ff:ff:ff
    inet 169.254.169.254/32 brd 169.254.169.254 scope global tap588fefad-6c
       valid_lft forever preferred_lft forever
    inet 10.0.1.1/24 brd 10.0.1.255 scope global tap588fefad-6c
       valid_lft forever preferred_lft forever
    inet6 fe80::f816:3eff:fedf:33e1/64 scope link
       valid_lft forever preferred_lft forever

自实例创建以来,


+我已关注此指令通过OVS实现自助组网。

答案1

将元数据注入实例的一种方法是配置驱动器。如果使用命令行,可以将其作为选项添加到openstack server create命令中:

openstack server create --flavor [...] --config-drive true my-vm

您还可以强制 nova 始终使用配置驱动器,为此将以下行添加到/etc/nova/nova.conf

force_config_drive = true

Nova 将虚拟驱动器附加到存储元数据的实例,此驱动器由 cloud-init 安装,并应用所需的配置参数。看来您的元数据服务无法正常工作,我没有在您的输出中看到 metadata_agent.ini 部分,您是否对其进行了配置?您可以在安装指南

相关内容