Posts

Showing posts from February, 2018

Setting up OpenStack dev environment the hard way

As you may already know, OpenStack is a big software project that running on stacks of servers so you cannot just folk it to your computer and run. Fortunately, the OpenStack community had built a minimal version of the OpenStack called devstack that help you have a developing environment without using a lot of resources. But, devstack still eats lots of CPU and memory of your computer so in my opinion, it's better to have a dedicated machine for running devstack (mine is a computer with 16GB). So the last things you need to do to start working on your patches are: 1. SSH to the devstack server 2. Make sure that the service outputs logs to some files (such as /opt/stack/logs/tacker.log) For Tacker or services that have settings file under /etc/<service name>/<service name>.conf, you can change the parameter to output logs to file 3. Using tmux or byobu to have multiple ssh console screens that you can easily switch to and for 4. Use VI or NANO to make changes

How to dev and test python libs on your OpenStack's devstack

In OpenStack Devstack, the python packages/libs such as python-tackerclient, tacker-horizon are not easy to dev because normally they will be installed under python's site-packages. So, to make it easier for us to developing these libs, follow the instructions below: 1. Clone the python packages that you want, for example: tacker-horizon: cd /opt/stack/ git clone git://git.openstack.org/openstack/tacker-horizon 2. Go inside the cloned directory and install it using pip : cd tacker-horizon sudo pip install -U -e . 3. Make the changes and enjoy Note:  if you work with tacker-horizon, you may have to restart apache2 server: sudo systemctl restart apache2

How to fix "F821 undefined name 'unicode'" error when running tox

If you get this following error when running "tox -e pep8": ... # F821 undefined name 'unicode' if isinstance(config, str) or isinstance(config, unicode): ... Modify the tox.ini as following to fix it: [flake8] builtins = unicode

How to fix "db type could not be determined" when running tox

If you get this error when running "tox -e py35": "db type could not be determined"  do this trick to get rid of it: rm .testrepository/times.dbm Life is good now.

Quote of the day

Image
"The man who moves a mountain begins by carrying away small stones" ~Phil Knight

Install a python package from a local directory with pip

Normally you will use pip to install a python package from pypi. But, actually you can do it from a local directory using the "-e" parameter: pip install -e /local/directory

Reinstall docker-ce after a purge and config dir deleted.

I purged the docker-ce package and deleted the /etc/docker directory and It brings me trouble... I cannot reinstall it. Every time I try to reinstall with the following command: sudo apt install --reinstall docker-ce ... Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for detail s. invoke-rc.d: initscript docker, action "start" failed. ● docker.service - Docker Application Container Engine    Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)   Drop-In: /etc/systemd/system/docker.service.d            └─docker.conf    Active: activating (auto-restart) (Result: exit-code) since 토 2018-02-17 22:54:41 KST; 5ms ago      Docs: https://docs.docker.com   Process: 28307 ExecStart=/usr/bin/dockerd --config-file=/etc/docker/daemon.json (code=exited, status=1/FAILURE)  Main PID: 28307 (code=exited, status=1/FAILURE)  2ì›” 17 22

Deploy OpenWRT as QoS VNF on OpenStack Tacker

So I just updated the OpenWRT VNFM management driver of OpenStack Tacker to support more services like DHCP, DNS, and QoS ( the code is under review now ). But, if you are so eager to try, here is how: 1. Download the custom image of OpenWRT from here  (because the default OpenWRT image doesn't have qos-scripts installed). 2. Upload that image to your OpenStack instance: openstack image create OpenWRT --disk-format qcow2 \                                --container-format bare \                                --file /path_to_image/openwrt.img \                                --public 3. Use this VNFD template to generate VNF: Note : Use this at your own risk. References: [0] https://wiki.openwrt.org/doc/howto/obtain.firmware.generate [1] https://wiki.openwrt.org/doc/uci/qos [2] https://hoverbear.org/2014/12/06/openwrt-qos/ [3] https://docs.openstack.org/tacker/latest/install/deploy_openwrt.html

Deploy OpenWRT as DHCP and DNS VNF on OpenStack Tacker

The OpenWRT management driver of Tacker VNFM currently only supports the firewall and network service. That raises a need to update that driver so that we can deploy more network services as VNF using OpenWRT. So to achieve the goal of this blog post, I have to do as follow: 1. Update the OpenWRT VNFM management driver . I just submitted a blueprint on launchpad to work on it. Hopefully, it will be approved soon: Blueprint:  https://blueprints.launchpad.net/tacker/+spec/advanced-openwrt-driver Code review: https://review.openstack.org/#/c/540310/2 Here is a quick change: modify this file  /opt/stack/tacker/tacker/vnfm/mgmt_drivers/openwrt/openwrt.py at line 94                 KNOWN_SERVICES = ('firewall', 'network')  to                 KNOWN_SERVICES = ('firewall', 'network', 'dnsmasq')  2. Use this VNFD template to deploy the DHCP and DNS services on Tacker Notice: I do not test this yet, use it at your own risk. References:

Deploy OpenWRT as NAT VNF on OpenStack Tacker

The opensource project for router OpenWRT is quite powerful which can be used to deploy as VNF in OpenStack Tacker. Here is a sample of VNF template (VNFD) which will be used to deploy NAT service in Tacker using OpenWRT. Basically, the VNF will apply 2 NAT rules: 1. Redirect all requests to port 80 of any clients on the 'wan' interface of the OpenWRT to port 80 of the client with IP address 192.168.16.235 which is linked to the 'lan' interface. 2. Redirect all requests to port 22001 of any client on the wan interface to port 22 of  any clients on the 'lan' interface of the VNF. Note: Please read the official OpenStack documentation on how to deploy the VNF. Referecences: [0] https://docs.openstack.org/tacker/latest/install/deploy_openwrt.html [1] https://wiki.openwrt.org/doc/uci/firewall