[WARNING]
at the time of this writing, lxd driver in openstack does not support multi-NIC configuration and connection to openvswitch br-int bridge, thus we moved to lxc if you want to launch container instance, refer to README.lxc
- install required packages
sudo apt-get update
sudo apt-get install nova-compute-lxd
- load nbd module and add nbd to /etc/modules for boot-up loading
sudo modprobe nbd
- check that compute_driver is configured to that of lxd container
cat /etc/nova/nova-compute.conf
[DEFAULT]
compute_driver = lxd.LXDDriver
- configure netwoking bridge for lxd
# no lxd-bridge but ovs, so answer no for the first question
# this command may generate /etc/default/lxd-bridge file
sudo dpkg-reconfigure -p medium lxd
- create a container rootfs
sudo mklxd.sh lxc.img tmp utmlxd
- copy container rootfs to an appropriate directory
sudo cp tmp/utmlxd.tar.gz /var/vnf/images/
- register the container image to glance
sudo glance --insecure image-create --name "utmlxd" --disk-format raw \
--container-format bare --visibility public \
--property hypervisor_type=lxc --progress \
--file /var/vnf/images/utmlxd.tar.gz
- restart nova compute service
sudo service nova-compute restart
- create flavor in command line, and set properties according to your needs
# you can also create flavor in openstack dashboard
# (i.e. id mem hdd cpu)
sudo nova flavor-create m1.small 6 4096 120 1
sudo openstack flavor set m1.small --property hw:mem_page_size=large
sudo openstack flavor set m1.small --property hw:cpu_policy=dedicated
sudo openstack flavor set m1.small --property hw:cpu_thread_policy=prefer
sudo openstack flavor set m1.small --property hw:cpu_sockets=1
- config container instance, for example
sudo lxc list
sudo lxc config device add instance-0000000c eth4 nic nictype=bridged \
name=eth4 ipv4.address=192.168.254.5 bridge.driver=openvswitch \
parent=br-int
sudo lxc config device add instance-0000000c eth1 nic nictype=bridged \
name=eth1 parent=br-int
sudo lxc config device add instance-0000000c eth2 nic nictype=bridged \
name=eth2 parent=br-int
sudo lxc config device add instance-0000000c eth3 nic nictype=bridged \
name=eth3 parent=br-lan-server
sudo lxc config device add instance-0000000c eth4 nic nictype=bridged \
name=eth4 parent=br-local
sudo lxc exec instance-0000000c -- ifconfig eth1 192.168.10.9
sudo lxc exec instance-0000000c -- ifconfig eth2 192.168.20.12
sudo lxc exec instance-0000000c -- ifconfig eth3 192.168.21.7
sudo lxc exec instance-0000000c -- ifconfig eth4 192.168.254.4
sudo lxc exec instance-000000c bash
sudo lxc profile show instance-0000000c
sudo lxc config device remove instance-0000000c eth0
sudo lxc delete instance-000000c
sudo lxc profile create default
sudo lxc profile show default
sudo lxc profile device add default eth1 nic nictype=bridged name=eth1 \
parent=br-int
sudo lxc profile delete instance-0000000c
sudo lxc config set instance-0000000c limits.cpu 2
sudo lxc config set instance-0000000c limits.cpu 0,1
- launch lxd instance, for example
sudo openstack server create --flavor m.small --image utmlxd \
--nic net-id=86af51d3-30ca-4dd8-869c-54de25209210 \
--nic net-id=a791946a-0cb9-407d-81da-1450fe122259 \
--nic net-id=f3eb3b1e-9424-477a-b900-c36345c3985b \
--nic net-id=1080d16b-2dbf-486a-ae2d-09a334fa1d8e \
--nic net-id=a3f547a1-937d-4a6e-9ea4-3315719e1a4b \
--security-group default \
test1