OpenStack TripleO印象( by quqi99 )
TripleO是一个用openstack来部署openstack的工程(即所谓的openstack over openstack),即先准备一个openstack控制器的镜像(https://github.com/stackforge/diskimage-builder/),然后用这个镜像通过openstack的bare-metal功能(现在改名了,叫Ironic,https://wiki.openstack.org/wiki/Baremetal)再去部署裸机,再通过heat在裸机上部署openstack。它包括下列工程:
In-instanceconfigureation management (os-apply-config + os-refresh-config,and/or Chel/Puppet)
diskimage-builder,https://github.com/stackforge/diskimage-builder
triple-image-elements,https://github.com/stackforge/tripleo-image-elements
triple-heat-templates,https://github.com/stackforge/tripleo-heat-templates
如果使用tripleo来创建第一个控制器虚机,再用控制器虚机去创建其他裸机的文档可以参见:https://github.com/openstack/tripleo-incubator/blob/master/devtest.md。不过作为一个程序员在熟悉了tripleo的使用过程之后一下子对它提不起兴趣了。因为tripleo主要是将我们手动做的一些工作用脚本自动化了而已,而且帮你隐藏了细节。我还是比较喜欢一步一步来,知道了步骤及每步为什么之后自己再写脚本串起来,因为有闲工夫来理解它这些脚本的来龙去脉还不如自己写。
如果使用baremetal功能见:https://wiki.openstack.org/wiki/Baremetal
要点如下:
1,首先要在baremetal数据库中为每一个裸机注册,注册的信息包括IPMI的管理信息(pm_address, pm_user, pm_password), 裸机的cpu、内存信息,主机名,mac地址。
nova baremetal-node-create --pm_address=... --pm_user=... --pm_password=... $COMPUTE-HOST-NAME $CPU $RAM $DISK $FIRST-MAC
如果裸机有多个网卡,那就不止一个mac地址,那么为每一个网卡也需要注册。
nova baremetal-interface-create $ID $MAC
2, 如果需要nova-schedule调度到这些物理裸机时,
nova boot --flavor my-baremetal-flavor --image my-image my-baremetal-node
3, 故要定义专用的flavor
nova flavor-create my-baremetal-flavor $FLAVOR_ID $RAM $DISK $CPU
nova flavor-key my-baremetal-flavor set cpu_arch={i386|x86_64} \
"baremetal:deploy_kernel_id"=$DEPLOY_VMLINUZ_UUID "baremetal:deploy_ramdisk_id"=$DEPLOY_INITRD_UUID
4, 添加镜像
glance image-create --name my-vmlinuz --public --disk-format aki < my-vmlinuz
glance image-create --name my-initrd --public --disk-format ari < my-initrd
glance image-create --name my-image --public --disk-format qcow2 --container-format bare \
--property kernel_id=$MY_VMLINUZ_UUID --property ramdisk_id=$MY_INITRD_UUID < my-image
5, 创建数据库
mysql> CREATE DATABASE nova_bm;
mysql> GRANT ALL ON nova_bm.* TO 'nova_user'@'some_host' IDENTIFIED BY '$password';
nova-baremetal-manage db sync
6, 支持PXE与tftp的dnsmasq
sudo dnsmasq --conf-file= --port=0 --enable-tftp --tftp-root=/tftpboot \
--dhcp-boot=pxelinux.0 --bind-interfaces --pid-file=/var/run/dnsmasq.pid \
--interface=$IFACE --dhcp-range=$RANGE
7, nova.conf
[DEFAULT]
scheduler_host_manager = nova.scheduler.baremetal_host_manager.BaremetalHostManager
firewall_driver = nova.virt.firewall.NoopFirewallDriver
compute_driver = nova.virt.baremetal.driver.BareMetalDriver
ram_allocation_ratio = 1.0
reserved_host_memory_mb = 0
[baremetal]
net_config_template = /opt/stack/nova/nova/virt/baremetal/net-static.ubuntu.template
tftp_root = /tftpboot
power_manager = nova.virt.baremetal.ipmi.IPMI
driver = nova.virt.baremetal.pxe.PXE
instance_type_extra_specs = cpu_arch:{i386|x86_64}
sql_connection = mysql://{user}:{pass}@{host}/nova_bm
Reference:
https://github.com/openstack/tripleo-incubator
https://github.com/openstack/tripleo-incubator/blob/master/devtest.md
IPMI,http://www.ibm.com/developerworks/cn/linux/l-ipmi/
https://wiki.openstack.org/wiki/Baremetal