Friday, June 27, 2014

openstack:My first bug (nova)

choose a bug from launchpad and


  •  login as non root(njain) to your devstack vm
  •  cd /home/njain/projects/devstack 
  •  source openrc admin admin 
  • ./rejoin-stack.sh
  • Test a command ( nova aggregate-list)
  • if things don't work try ./unstack.sh ./stack.sh 
  • if you get : Policy doesn't allow  then make sure you source openrc admin admin no as demo
  • CTRL A D will exit from screen 
  • CTRL A 5 will take you to nova api server
  • work on your code test it and write text cases
  •  git config --list (git config --global --add gitreview.username "neetu")
  • git remote update
  • git chekout -b "new"
  • git review -s
  •  ./run_tests.sh
  • git commit -m ""    
  • if you want to revert ..git  checkout HEAD filename
  • if you want to go back  git rebase -i UUID
  • git commit --ammend
  • git review
  • checkout your changesin launchpad and assign  reviewers if you know any
In devstack, logs of openstack services are attached with linux screens. you can find them by running following command
screen -x stack
you can traverse forward through screens by pressing CTRL a n and backwards with CTRL a p
to restart a particular service, go to the relevant screen, press CTRL c (it will kill the process) and rerun the last command ( press up Arrow then Enter )

Tuesday, June 24, 2014

vagrant ..virtualbox and variety!

I recently got an opportunity to explore vagrant!
Its really cool .. (specially when you don't want users to know about the zillion steps+tools needed before your project is all set to run :))

check it out here :-
http://www.vagrantup.com/

For windows it was not much trouble .. just download the installation package and restart and voila!

But on Ubuntu i ran into some issues vagrant virtualbox versions e.t.c



Number of links on net did not work for me.
Finally this is what worked for me.

sudo apt-get purge --auto-remove vagrant
sudo apt-get purge --auto-remove virtulabox
sudo apt-get install dpkg-dev virtualbox-dkms
if you see
WARNING: The character device /dev/vboxdrv does not exist. then do 
sudo dpkg-reconfigure virtualbox-dkms

sudo dpkg-reconfigure virtualbox

 if needed 


dpkg -l | grep virtualbox
wget http://files.vagrantup.com/packages/a40522f5fabccb9ddabad03d836e120ff5d14093/vagrant_1.3.5_x86_64.deb

dpkg -i vagrant_1.3.5_x86_64.deb
sudo apt-get install linux-headers-$(uname -r)

 
if you already have some vagrant installed remove it as said above since it will conflict if you did remove it and you see seomthing like
-is-not-co-installable-with-errors  on-ubuntu
 is not co-installable with vagrant:i386 1.2.4
sudo dpkg -r vagrant:i386 1.2.4

dpkg -i vagrant_1.3.5_x86_64.deb
 


...hopefully now you are all set to run "vagrant up"  where your Vagrantfile is

If you face this :- 
 the machine is already locked by a session  then kill the process

ps ax | grep -i virtualbox
 
  or 
 
VBoxManage controlvm "vagrant_buzz_1403293185" poweroff
 
  
of If you have a vm that you want to start

vboxmanage startvm "vagrant_buzz_1403293185" --type headless

if not headless then :- 
vboxmanage startvm "vagrant_buzz_1403293185" 


to see what vms are present

vboxmanage list vms


If you want to see the details or vagrant up then do
VAGRANT_LOG=DEBUG vagrant up
 
If you want to seewhats going on in the vm
 vagrant ssh




BTW

Could not find Git in your PATH environment


if you see error related to not seeing git in your path then this might solve it   :-
 set PATH=%PATH%;C:\Program Files (x86)\Git\bin



to remove trace of the vm you ever setup just do
 vagrant destroy









Thursday, June 5, 2014

get git

From vcs to svn to git ..

I am thinking of blogging about my git discoveries also ..( more for my personal documentation like all my posts) :)


here is a quick cheat sheet i created for myself


svn info -> git remote show origin
svn co  -> git clone
svn commit  -> git commit ; git push
svn update . -> git pull
     
git revert 
revert changes

git remote -v
show the remote hooks ( should be a link to the global repo and then to your repo)

git pull --rebase upstream master

git me the latest code from master of the upstream(usually the link you cloned)

git fech upstream
 =>svn update from master ( provided upstream is master branch)

Once you've set an upstream, you can run
git pull upstream master
  to pull changes on SoftLayer's
 master into your local repo. Then you use
git push origin
to push them up to your GitHub fork.

https://help.github.com/articles/fork-a-repo  
 for ex:-
when you start a project this is what you do
1. fork
  654  git clone https://github.com/user/jumpgate.git
  655  cd jumpgate/
  656  git remote add upstream git@github.com:softlayer/jumpgate.git
  657  git fetch upstream
  658  history
  659  git remote -v




to go back

git rebase --soft HEAD~1
git commit -a


or
git add.
git commit --amend
 and give the chang-id as footer

Devstack running joys !!!

I have been using devstack for understanding how openstack components work.

1) it works awesome ..instead of invidual installations you have everything installed for you
2) screens lets you see what is going on  in real time
GNU Screen provides the same functions as the DEC VT100 terminal, plus other aggregates. If you have no experience with this terminal, make sure to write down the following shortcuts.
Attach to a screenscreen -r stack
Switch screensctrl+a <screen no.> (e.g. ctrl+a 1)
Scroll in a screenctrl+a esc and up/down arrows to scroll
List screensctrl+a " and select the screen with up/down arrows
Next screenctrl+a n
Detach from the screenctrl+a d

3) you can edit any code on /opt/stack 
    i just print whatever i am investigating ..and its super easy to debug that ways 

4) any command you want to test just run help!   ex nova help
    if you are looking for a specific command but do not have the complete syntax or want to see all related commands  try this :- 
 for ex i want all metadata related command in nova 
nova help|grep metadata 

njain@njain3:/opt/stack/python-novaclient$ nova help|grep metadata
    aggregate-set-metadata
                        Update the metadata associated with the aggregate.
    image-meta          Set or Delete metadata on an image.
    meta                Set or Delete metadata on a server.
    host-meta           Set or Delete metadata on all instances of a host.

5) want to contribute check out 
https://wiki.openstack.org/wiki/How_To_Contribute 

6) I will soon get a bug from launchpad and try to contribute as a developer!!