Showing posts with label openstack. Show all posts
Showing posts with label openstack. Show all posts

Monday, January 25, 2016

Debugging openstack ....logs , services e.t.c

Something is broken ...
lets say heat is not starting up ..
what do we do ?

calm down!
check logs ( /var/log/heat-api.log,  /var/log/heat-api-cfn.log, /var/log/heat-engine.log)

Do you see any errors there ?? ( most of the times this should be sufficient)

but what if there is not error in the logs.. since the service is not even starting ?
try restarting the service(systemctl comes to rescue)

systemctl list-units |grep heat
systemctl status openstack-heat-api.service
systemctl status openstack-heat-api-cfn.service
systemctl status openstack-heat-engine.service


Just getting a failed status but no details ?try debugging
journalctl -u openstack-heat-api-cfn.service


here are few links which will help

https://access.redhat.com/articles/systemd-cheat-sheet

https://cdn.rawgit.com/ruzickap/linux.xvx.cz/gh-pages/files/systemd_cheatsheet/systemd_cheatsheet.pdf


Wednesday, December 16, 2015

Beginners guide to cloud and openstack

Disclaimer :-- all the content is sourced from various pages on openstack .. I am just putting together that information in a crash course :)

 

What is Cloud?

Let's quickly review just what exactly we mean by cloud technologies?
 Cloud technologies are built on existing technologies such as virtualization and clustering to virtualize hardware, software, storage, and networking resources into flexible units that are quickly allocated to meet demand. So rather than the old static model of dedicated hardware servers for various tasks, and static network and storage configurations, all of those formerly specialized devices are assimilated into a common resource pool. It's a more efficient use of hardware, and very fast to scale up or down according to demand. You can even configure self-service for users so they can grab whatever they need when they need it.
Types of cloud ?
  • Private
  • Public
  • Hybrid

  •  
     
All computing resources are shareable in a cloud, and there are three basic service models:
  • SaaS, software as a service
  • PaaS, platform as a service
  • IaaS, infrastructure as a service


What is Openstack? 
Open Source Cloud Computing platform (short answer).
OpenStack is a cloud operating system that controls large pools of compute, storage, and networking resources throughout a datacenter, all managed through a dashboard that gives administrators control while empowering their users to provision resources through a web interface.
https://en.wikipedia.org/wiki/OpenStack (long answer)





What are  Openstack components? 




core projects (short answer):
  • Identity (Keystone)
  • Dashboard (Horizon)
  • Orchestration (Heat)
  • Metering (Celiometer)
  • Object stroage (Swift)
  • Image service (Glance)
  • Networking (Quantum now Neutron)
  • Compute (Nova)
https://en.wikipedia.org/wiki/OpenStack (not so long answer)
https://www.openstack.org/software/ (long answer)




How do these Openstack Components talk to each other?
  1. Messaging Queues: AMQP is the messaging technology chosen by the OpenStack cloud.The OpenStack components such as Nova , Cinder , Quantum communicates internally via AMQP(Advanced Message Queue Protocol) and through eachother using REST-call. The AMQP broker, RabbitMQ , sits between any two internal Openstack components and allows them to communicate in a loosely coupled fashion i.e its components has, or makes use of, little or no knowledge of the definitions of other separate components. More precisely, Nova components (nova-api, nova-scheduler , nova-compute) use Remote Procedure Calls (RPC) to communicate to one another.
    In OpenStack the Nova ,Cinder and Quantum implements RPC (both request+response, and one-way, respectively nicknamed ‘rpc.call’ and ‘rpc.cast’) over AMQP by providing an adapter class which take cares of marshaling and unmarshaling of messages into function calls. Each Nova components (for example api ,compute, Scheduler, etc.) , Cinder components ( for example volume, Scheduler) , Quantum Components( for example quantum-server , agents ,plugins )  create two queues at the initialization time, one which accepts messages with routing keys ‘NODE-TYPE.NODE-ID’ (for example compute.hostname) and another, which accepts messages with routing keys as generic ‘NODE-TYPE’ (for example compute) .
  2.  

Tuesday, December 15, 2015

Beginner's links to find out about openstack

playing with openstack HEAT : beginners introduction

  • Install heat
  • Heat templates reside here
  1.  https://github.com/openstack/heat-templates
  2. which can be seen on the vm its in /vagrant/heat_templates
  3. there are test templates in root dir as well ex:- /root/heat_test_template.yml
  • on the controller vm this is how to use heat to spin up nodes
    1. heat stack-create -f heat_templates/test.yml test
    2. once its created you should be able to see it using CLI like this :-
      [root@controller-01 vagrant(keystone_admin)]$ heat stack-list

       +--------------------------------------+------------+---------------+----------------------+
      | id                                   | stack_name | stack_status  | creation_time        |
      +--------------------------------------+------------+---------------+----------------------+
      | xxxx-xxxxx | test       | CREATE_FAILED | 2015-11-16T20:59:49Z |
      +--------------------------------------+------------+---------------+----------------------+
    3. on horizon you can see it here 


          7.  If you click the "stack name" link you can get into more details of your stack.
          8. There are Actions like "resume stack, suspect stack , delete stack" e.t.c that you can perform
         9.  You can get different details on the stack on horizonw including the template itself and you can change the template
     
  • General Heat Resources :-

Tuesday, April 7, 2015

Install barbican

Barbican is a ReST API designed for the secure storage, provisioning and management of secrets. It is aimed at being useful for all environments, including large ephemeral Clouds. All documentation and work can be found on either Launchpad or Github at the following locations:

Step-by-step guide for ubuntu

For some reason I ran into issues while installing Barbicun from these instructions(https://github.com/cloudkeep/barbican/wiki/Barbican-Quick-Start-Guide) hence I am adding here what all I did to make it work
  1. Install prereqs 
    sudo apt-get install python-dev
    sudo apt-get install libsqlite3-dev
    sudo apt-get install libxml2-dev
    sudo apt-get install libxslt1-dev
    sudo apt-get install libbz2-dev  libldap2-dev  libsasl2-dev
    sudo apt-get install libffi-dev
    sudo apt-get install libssl-dev
  2.  Install pyenv
    curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
  3.  install  pyenv-virtualenv
    git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
    echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile
    exec "$SHELL"
  4. pyenv install 2.7.5
  5. pyenv virtualenv 2.7.5 barbican27
  6. pyenv shell barbican27
  7. bin/barbican.sh install
    Note:- if you run into any "module not found" kind of error .. means its time to restart . remove virtualenv , install what is missing (in my case it was biz2 so installing libbz2-dev helped) and then redo all the steps from step 2.
  8. you can test step 7 once you see " [emperor] vassal barbican-api.ini is ready to accept requests"  by "curl -H 'X-Project-Id:12345' localhost:9311"
    response looks like {"v1": "current", "build": "2015.1.dev103"} on client
    and "[emperor] vassal barbican-api.ini is now loyal" on server side ( somebody knows what's good humour (smile)) out there


Step-by-step guide for centos

For some reason I ran into issues while installing Barbicun from these instructions(https://github.com/cloudkeep/barbican/wiki/Barbican-Quick-Start-Guide) hence I am adding here what all I did to make it work
  1. Install prereqs  
    
    sudo yum install openssl
    sudo yum install libffi-devel
    sudo yum install openssl-devel
    sudo yum install python-devel
    sudo yum install sqlite-devel 
    sudo yum install openldap-devel
  2.  Install pyenv
    curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
  3. if above does not work run this script https://gist.github.com/ysaotome/7956676 
  4.  install  pyenv-virtualenv
    git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
    echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile
    exec "$SHELL"
  5. pyenv install 2.7.6
  6. pyenv virtualenv 2.7.6 barbican27
  7. pyenv activate  barbican27
  8. pyenv shell barbican27
  9. bin/barbican.sh install
    Note:- if you run into any "module not found" kind of error .. means its time to restart . remove virtualenv (rm -rf /root/.pyenv/versions/barbican27/), install what is missing (in my case it was biz2 so installing libbz2-dev helped) and then redo all the steps from step 2.
  10. you can test step 7 once you see " [emperor] vassal barbican-api.ini is ready to accept requests"  by "curl -H 'X-Project-Id:12345' localhost:9311"
    response looks like {"v1": "current", "build": "2015.1.dev103"} on client
    and "[emperor] vassal barbican-api.ini is now loyal" on server side ( somebody knows what's good humour (smile)) out there

Wednesday, March 4, 2015

Image and openstack : how to get a centos7 image and change its credentials?

So I wanted  to create vms with centos7 on it so the steps I thought i would take was

$ nova boot --flavor FLAVOR_ID --image IMAGE_ID --key-name KEY_NAME \
  --user-data USER_DATA_FILE --security-groups SEC_GROUP_NAME --meta KEY=VALUE \
  INSTANCE_NAME

Now it seemed logical to look for IMAGE_ID in

$ nova image-list  
$glance  image-list

But the catch is centos image was not there

you can find it here :-

http://cloud.centos.org/centos/7/images/

$glance image-create imageName --location IMAGE_URL

Now go ahead get the image-id and create a vm as specified above.

Next thing you will run into is credentials. How do i log into the box ( lets say if you can not ssh for some reason into it)

Cloudinit comes to rescue a simple
mydata.file

$ nova boot --image ubuntu-cloudimage --flavor 1 --user-data mydata.file
mydata.file will look like this
#cloud-config
password: yourpwd
chpasswd: { expire: False }
ssh_pwauth: True


Now you can loginto your box with these credentials
 username:centos
 password:yourpwd










 



Wednesday, February 18, 2015

Debugging openstack .. not a cake!

So I have been playing with openstack for few days and as cool as it is ..i have to admit its a nightmare to debug.

so how do you start ?

1) find out all the major player nodes
2) go to each node and look into /var/log/
3) find out which one was written when your task failed

for examples

 I spinned up a vm and it was taking forever to come up.
 I logged into my compute node and found this

2015-02-18 10:07:26.586 3215 TRACE nova.compute.manager [instance: 0d28a0ad-93ce-43f5-b984-3c33f614861c] RemoteError: Remote error: OperationalError (OperationalError) (1048, "Column 'instance_uuid' cannot be null") 'UPDATE instance_extra SET updated_at=%s, instance_uuid=%s WHERE instance_extra.id = %s' (datetime.datetime(2015, 2, 18, 16, 7, 26, 576147), None, 152339L)


Now a friend pointed that this could be because of version mismatched.

So i logged into my controller node and checked the version

root@njain-compute:~# dpkg -l nova-compute
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===================================================-==============================-==============================-============================================================================================================
ii nova-compute 1:2014.2.1-0ubuntu1~cloud0 all OpenStack Compute - compute node base

So i logged into my controller node and checked the version

root@control-\:~# dpkg -l |grep nova 
ii  nova-api                            1:2014.2.1-0ubuntu1~cloud0            all          OpenStack Compute - API frontend
ii  nova-cert                           1:2014.2.1-0ubuntu1~cloud0            all          OpenStack Compute - certificate management
ii  nova-common                         1:2014.2.1-0ubuntu1~cloud0            all          OpenStack Compute - common files
ii  nova-conductor                      1:2014.2.1-0ubuntu1~cloud0            all          OpenStack Compute - conductor service
ii  nova-consoleauth                    1:2014.2.1-0ubuntu1~cloud0            all          OpenStack Compute - Console Authenticator
ii  nova-novncproxy                     1:2014.2.1-0ubuntu1~cloud0            all          OpenStack Compute - NoVNC proxy
ii  nova-scheduler                      1:2014.2.1-0ubuntu1~cloud0            all          OpenStack Compute - virtual machine scheduler
ii  python-nova                         1:2014.2.1-0ubuntu1~cloud0            all          OpenStack Compute Python libraries
ii  python-novaclient                   1:2.19.0-0ubuntu1~cloud0              all          client library for OpenStack Compute API

So i logged into my cinder node and checked the version

root@cinder-controller-mel01-1:~# dpkg -l|grep cinder
ii cinder-api 1:2014.2-0ubuntu1~cloud0 all Cinder storage service - API server
ii cinder-common 1:2014.2-0ubuntu1~cloud0 all Cinder storage service - common files
ii cinder-scheduler 1:2014.2-0ubuntu1~cloud0 all Cinder storage service - Scheduler server
ii python-cinder 1:2014.2-0ubuntu1~cloud0 all Cinder Python libraries
ii python-cinderclient 1:1.1.0-0ubuntu1~cloud0 all python bindings to the OpenStack Volume API


and as you can see cinder is out of sync .. and its version needs to match  1:2014.2.1


 well thats one way to debug(primarily since i was told version mismatch might be the issue)  though I wish debugging openstack was easier. 
Often people say reinstalling/rebuilding is better than debugging openstack and google is not yet abuzz with many clues .. here is to hoping!

 

Friday, May 16, 2014

Devstack installation

1) Why I need Devstack :

   Being new to openstack and wanting to contribute to one of our company openstack/opensource project Jumpgate ..lead me to conclude that to even make sense of the issues posted on Jumpgate is first need to see how openstack works .not sure if i mentioned earlier but i am a visual-kind of person ..i prefer tools with GUIs and learn by seeing and i love designing/creating/improving UIs  for the same reason.

anyways so after reading all about openstack and its  major components I thought it might be time to  see it in action ..

If you have not yet gone through the basics ..i would reccommend you do that

there are many resources .. search online by "new to openstack" "learn openstack" e.t.c
sad thing is there are too many :)
here are some i can provide
http://en.wikipedia.org/wiki/OpenStack
http://ilearnstack.com/2013/04/23/introduction-to-openstack-2/
https://wiki.openstack.org/wiki/Main_Page



after these links i guess you might be ready to see how exactly it works ..

I started out by installing nova and jumpgate ( since this is the project i was interested in contributing to )  using these instructions :-
http://bodenr.blogspot.com/2014/03/managing-openstack-softlayer-resources.html


but Jumpgate is still in progress .. many things are not ready .. to make sense of the issues/errors thrown e.t.c i first needed to see a working model .. hence the devstack installation made sense .. since using that i will be able to see how its supposed to work !!!

for devstack installation i went with these instructions :

sudo apt-get update
sudo apt-get install git
git clone https://github.com/openstack-dev/devstack.git
cd devstack
cp samples/local.conf  local.conf
./stack.sh
 
now watch out for password prompting ( I left them all blank :)) 

I ran into several issues in these simple steps ..
1) don't run it as root ..it will create problems 
2) if you run into permissions issue :- 
 log in as the stack user and run ./stack.sh 
  To do so, I had to call
  sudo visudo
  and add
  stack ALL=(ALL) NOPASSWD: ALL
  to the file. Then rerun stack.sh as stack and its working.
3) if you get any curl problems like this Curl SSL Certification error then 
   upgrade curl 
   there are some version of curl and devstack which are not compatible with each other
    mine was curl 7.22
 
4)  then i ran into "keystone did not start"
    what solved the problem was reboot the machine and run it again
    cd devstack/ 
    ./unstack.sh
    ./clean.sh
    ./stack.sh 
 
 
 



some links i followed are:- 
http://devstack.org/
https://ask.openstack.org/en/questions/
http://sayalilunkad.github.io/posts/Devstack/
 
For using devstack from here on (after installation succeeds ..) ...look out for next post
.