Nova baremetal实战

本文内容基于OpenStack的Icehouse版本,在CentOS上实现。实战中需要两台物理机器,AIO和baremetal节点。其中,AIO采用双网卡,分别接入Management Network和Data Network。


1. 网络布局

采用provider network,简易图如下:


Switch Port的部分设置:

AIO/eth1:

 switchport trunk allowed vlan xxx

 switchport mode trunk

Baremetal Node/eth0:

 switchport access vlan xxx

 switchport mode access


2. 配置

配置只涉及AIO中baremetal相关的部分。

2.1 安装包

dnsmasq(>=2.6.6)

ipmitool

iscsi-initiator-utils

syslinux(extract pxelinux.0)


2.2 tftp & pxe

#yum -y install syslinux tftp-server
#sudo mkdir -p /tftpboot/pxelinux.cfg
#cp /usr/share/syslinux/pxelinux.0 /tftpboot/ 
#sudo chown -R nova:nova /tftpboot/


tftp的配置,感谢Matt的帮忙,找到了相对路径和绝对路径的解决方案:

https://review.openstack.org/#/c/53398/3/elements/nova-baremetal/install.d/80-pxelinux

#cat /etc/xinetd.d/tftp
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = --map-file /tftpboot/map-file /tftpboot
        disable                 = no 
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
#cat /tftpboot/map-file
r ^([^/]) /tftpboot/\1

#service xinetd restart

#netstat -nlp | grep 69
#tftp $TFPT_SERVER_IP
tftp>get pxelinux.0
tftp>get /tftpboot/pxelinux.0
tftp>q

2.3 Image

2.3.1 创建和上传Image

#git clone https://github.com/openstack/diskimage-builder.git
#cd diskimage-builder
#bin/disk-image-create base ubuntu baremetal -o my-image 
#bin/ramdisk-image-create ubuntu deploy -o my-deploy


#qemu-img check -f qcow2 my-image.qcow2
#glance image-create --name my-vmlinuz --public --disk-format aki  < my-image.vmlinuz
#glance image-create --name my-initrd --public --disk-format ari  < my-image.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.qcow2
 
#glance image-create --name deploy-vmlinuz --public --disk-format aki --container-format=aki < my-deploy.kernel
#glance image-create --name deploy-initrd --public --disk-format ari --container-format=ari < my-deploy.initramfs

2.3.2 创建baremetal flavor

#nova flavor-create --swap $VM_SPECS_SWAP baremetal auto $VM_SPECS_RAM $VM_SPECS_DISK $VM_SPECS_CPU
#nova flavor-key baremetal set "cpu_arch"="{i386|x86_64}" "baremetal:deploy_kernel_id"="$DEPLOY_KERNEL_ID" "baremetal:deploy_ramdisk_id"="$DEPLOY_RAMDISK_ID"


2.4 Nova配置/etc/nova/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]
sql_connection = mysql://bm:BM_DBPASSWORD@x.x.x.x/nova_bm
net_config_template = $pybasedir/nova/virt/baremetal/net-dhcp.ubuntu.template
tftp_root = /tftpboot
power_manager = nova.virt.baremetal.ipmi.IPMI
driver = nova.virt.baremetal.pxe.PXE
#instance_type_extra_specs 
flavor_extra_specs= cpu_arch:{i386|x86_64}
pxe_deploy_timeout=600


配置后需要restart如下服务:

service openstack-nova-scheduler restart

serviceopenstack-nova-compute restart


2.5 DB

#mysql -u root
CREATE DATABASE nova_bm;
GRANT ALL PRIVILEGES ON nova_bm.* TO 'bm'@'localhost' IDENTIFIED BY 'BM_DBPASSWORD';
GRANT ALL PRIVILEGES ON nova_bm.* TO 'bm'@'%' IDENTIFIED BY 'BM_DBPASSWORD';
# nova-baremetal-manage db sync
#make sure baremetal_nova.sqlite does not exist
#rm -f /var/lib/nova/baremetal_nova.sqlite


2.6 nova-baremetal-deploy-helper

Manually, Launch nova-baremetal-deploy-helper:
nova-baremetal-deploy-helper > /dev/null 2>&1 &

2.7 添加baremental节点信息

# create a "node" for each machine
# extract the "id" from the result and use that in the next step
#nova baremetal-node-create --pm_address= --pm_user= --pm_password= $COMPUTE-HOST-NAME $CPU $RAM $DISK $FIRST-MAC

# for each NIC on the node, including $FIRST-MAC, also create an interface, but $FIRST-MAC will be added automatically by baremetal-node-create
#nova baremetal-interface-add $ID $MAC

3. 参考

https://wiki.openstack.org/wiki/Baremetal

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值