Posts

Making httplib and urlparse modules compatible with both Python 2 & 3

There are some changes in Python 3 especially some packages are renamed such as httplib -> http.client and urlparse -> urllib.parse. Below is a way to make those 2 work in both Python 2 and 3:

import sys
if sys.version_info[0] < 3:
    import httplib
    import urlparse
else:
    import http.client as httplib
    import urllib.parse as urlparse

Note: 'sys.version_info[0] < 3' is used to check the current running python version.

An overview of the Freezer-DR (Disaster Recovery) project

Image
Freezer-DR is a project that provides compute node high availability for OpenStack. The Freezer-DR comprises 4 main boxes:

Monitors: collecting data from compute nodesFencers: do fencing operationsEvacuators: to evacuate VMsNotifiers: notification
Freezer-DR is designed using an extensible architecture which allows us to plug any software solution/library into the above boxes by implementing the drivers. For example, I can use Monasca as the monitor, IPMI or libvirt as fencers, open stack nova client as evacuator, python SMTP lib as the notifier, as long as I have the drivers for those software or libraries. Right now, there is only a limited number of supported drivers for monitors, fencers, evacuators, and notifiers but you can always easily write your own drivers to use the desired libraries or software.

Below figure describes the workflow of Freezer-DR:



(1) Freezer-DR monitors all the compute nodes
(2) If it found any fail node, Freezer-DR will fence that node
(3) It will then try …

Nginx error says "upstream sent too big header while reading response header from upstream"

My PHP web server with Nginx as reverse proxy says "upstream sent too big header while reading response header from upstream"

And, here is how to fix it:

1. Edit the nginx configuration for my site, for example, /etc/nginx/sites-available/mysite

$ sudo nano /etc/nginx/sites-available/mysite

Modify these lines

...
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                fastcgi_buffer_size 128k;
                fastcgi_buffers 4 256k;
                fastcgi_busy_buffers_size 256k;
        }
...

2. Restart nginx and enjoy

$ sudo systemctl restart nginx

kolla-ansible deploy stucks at "haproxy : Waiting for virtual IP to appear"

I was trying to deploy Kolla all-in-one and stuck at

TASK [haproxy : Waiting for virtual IP to appear]

Here is how I fixed it:

1. Because, another service in the network may use the same Virtual Router ID, It is 51 by default. So, change the default "keepalived_virtual_router_id" to another value (free and in the range of 0-255)

$ sudo vi /etc/kolla/globals.yml

...
keepalived_virtual_router_id: "251"
...

2. Run kolla-genpwd to generate /etc/kolla/passwords.yml

$ sudo kolla-genpwd

3. Enjoy

Let's design an agile Monitoring Solution for the Containerized OpenStack

Image
Cloud providers are moving toward a new deployment method that is using container technology. The objective is to replace the inflexible, painful, resource-intensive deployment process of the cloud infrastructure with a flexible, painless, inexpensive deployment process. For instance, OpenStack uses the Kolla project to foster the effort and has already reached a mature level which can be used in production. The new software architecture changes how services are connected together. That exposes the cloud platform to many new challenges including resource provision, performance, failure management etc. Therefore, to guarantee the availability and stability of the containerized system, monitoring features have to be considered thoroughly. This blog post discusses many aspects of such agile, plug-and-play, and practical monitoring system.
OpenStack is an open source cloud platform with a modular architecture. Deploying OpenStack is difficult because it comprises many different components …