我创建了一个基于KVM的Linux主机环境。我使用virt管理器创建不同的‘m,我使用Linux桥在不同的主机上创建’m之间的连接。
现在,我希望有一个自动配置服务器,以便我的VM可以根据它们各自拥有的唯一id自动配置它们的名称、IP地址、运行一些脚本等等。是否有可能在非openstack环境中复制某种云init设置?
我尝试过以以下方式使用云init数据源NoCloud。首先,我在VM中安装了云init并配置了cloud.cfg:
datasource:
NoCloud
datasource_list: [ NoCloud ]
disable_ec2_metadata: True然后,我创建了一个具有以下内容的用户数据文件和元数据文件:
用户数据:
#cloud-config
hostname: prueba
password: passw0rd
chpasswd: { expire: False }
ssh_pwauth: True元数据:
instance-id: iid-local01
local-hostname: prueba然后,我生成了一个iso文件:
genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data最后,我将磁盘附加到VM并启动它。这是XML的相关部分:
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/opt/images/seed.iso'/>
<backingStore/>
<target dev='vdb' bus='virtio'/>
<alias name='virtio-disk1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>当VM启动时,它会说:
2015-05-12 12:12:40,394 - util.py[WARNING]: Getting data from <class 'cloudinit.sources.DataSourceNoCloud.DataSourceNoCloudNet'> failed
* Stopping Read required files in advance (for other mountpoints) [ OK ]
* Stopping Read required files in advance (for other mountpoints) [ OK ]
* Stopping Read required files in advance (for other mountpoints) [ OK ]
2015-05-12 12:12:48,808 - url_helper.py[WARNING]: Calling 'http://169.254.169.254/2009-04-04/meta-data/instance-id' failed [3/120s]: request error [HTTPConnectionPool(host='169.254.169.254', port=80): Max retries exceeded with url: /2009-04-04/meta-data/instance-id (Caused by <class 'socket.error'>: [Errno 113] No route to host)]对如何使它发挥作用有什么建议吗?
发布于 2015-05-08 13:46:52
是否有可能在非openstack环境中复制某种云init设置?
好的。
云-init不需要网络元数据服务(如EC2和OpenStack提供的服务)才能操作。它将很高兴地从本地CD设备读取配置信息;例如,请参阅本文件的“登录到您的原子机器”部分,其中描述了如何创建必要的文件系统。
这在云init文档中有文档化的这里。
https://stackoverflow.com/questions/30125093
复制相似问题