Posts

Showing posts from August, 2014

How to connect to OpenStack Keystone API using keystoneclient

>>> import keystoneclient >>> from keystoneclient.v2_0 import client >>> keystone = client.Client(username="admin", password="*****", tenant_name="admin", auth_url="http://192.168.56.101:5000/v2.0", debug=True) >>> print  keystone.tenants.list()  [<Tenant {u'enabled': True, u'description': None, u'name': u'admin', u'id': u'13b447285765463b8f4836f5cbb80f05'}>, <Tenant {u'enabled': True, u'description': None, u'name': u'service', u'id': u'9369242879854fa19630a7aa1a7c30d9'}>, <Tenant {u'enabled': True, u'description': None, u'name': u'invisible_to_admin', u'id': u'9b478397b98f4e8d9693128be8ddd2fb'}>, <Tenant {u'enabled': True, u'description': None, u'name': u'demo', u'id': u'aa02b89cb14748ca9eb77788b9

How to connect to OpenStack Keystone API using novaclient

>>> USER = 'admin' >>> PASS = '*****' >>> TENANT = 'admin' >>> AUTH_URL = "http://192.168.56.101:5000/v2.0" >>> >>> from novaclient.v1_1 import client >>> >>> nt = client.Client(username=USER, api_key=PASS, project_id=TENANT, auth_url=AUTH_URL, service_type='compute') >>> >>> >>> >>> >>> print nt.flavors.list() [<Flavor: m1.tiny>, <Flavor: new>, <Flavor: m1.small>, <Flavor: m1.medium>, <Flavor: m1.large>, <Flavor: m1.nano>, <Flavor: m1.heat>, <Flavor: m1.xlarge>, <Flavor: m1.micro>] >>> >>>  >>> >>>  >>> obj=nt.flavors.list() >>> obj[0] <Flavor: m1.tiny>

Vim editor Basic commands

Vim editor Basic commands    Moving through the text is usually possible with the arrow keys. h to move the cursor to the left l to move it to the right k to move up j to move down Basic operations n dd will delete n lines starting from the current cursor position. n dw will delete n words at the right side of the cursor. x will delete the character on which the cursor is positioned :n moves to line n of the file. :w will save (write) the file :q will exit the editor. :q! forces the exit when you want to quit a file containing unsaved changes. :wq will save and exit :w newfile will save the text to newfile. :wq! overrides read-only permission (if you have the permission to override permissions, for instance when you are using the root account. /string will search the string in t

How to search WORD in directory and sub-directory

This will search word in current directory and sub directory  $  grep -r " WORD " * OR $  grep -r " WORD " .

Debugging in Python

Image
$ sudo easy_install pudb To start debugging, simply insert into code from pudb import set_trace; set_trace() OR A shorter alternative to this is: import pudb; pu.db COMMANDS   Press "Enter" to goto "Edit Preferences" pop-up window. Press "Space" to select the settingsPress "Esc" to close the pop-up window Press "Ctrl" + "x" to goto Command Line. Press "Ctrl" + "x" to exit from Command Line. Press "n" to execute next line Press "s" to step into a method/function Press "c" to continue the execution select the line where you want to set the breakpoint and press "b", then you can see a red mark in that line. Then Press "c" to continue the execution and stop at breakpoint

Open the Openstack console in new window

Image
Open the Openstack console in new window  $  ssh -X username@192.168.06.01  $  sudo virsh  $  ps -aux | grep vmname | grep vnc  $  sudo apt-get install vncviewer $  vncviewer :0    

How to Creating a dashboard in Openstack

Image
Creating a dashboard mkdir openstack_dashboard/dashboards/mydashboard ./run_tests.sh -m startdash mydashboard \ --target openstack_dashboard/dashboards/mydashboard mkdir openstack_dashboard/dashboards/mydashboard/mypanel ./run_tests.sh -m startpanel mypanel \ --dashboard=openstack_dashboard.dashboards.mydashboard \ --target=openstack_dashboard/dashboards/mydashboard/mypanel       Defining a dashboard   Open the dashboard.py file.  The following code has been automatically generated: from django.utils.translation import ugettext_lazy as _ import horizon class Mydashboard ( horizon . Dashboard ): name = _ ( "Mydashboard" ) slug = "mydashboard" panels = () # Add your panels here. default_panel = '' # Specify the slug of the dashboard's default panel. horizon . register ( Mydashboard )       Creating a panel Open the panel.py f

How to login MYSQL

Image
$ mysql -uroot -p<password> mysql> show databases; +--------------------+ | Database           | +--------------------+ | information_schema | | cinder             | | glance             | | heat               | | keystone           | | mysql              | | nova               | | performance_schema | +--------------------+ 8 rows in set (0.14 sec) mysql> use keystone Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> show tables; +-----------------------+ | Tables_in_keystone    | +-----------------------+ | assignment            | | credential            | | domain                | | endpoint              | | group                 | | migrate_version       | | policy                | | project               | | region                | | role                  | | service               | | token                 | | trust                 | | trust_role 

Run Openstack in browser

got to /opt/stack/horizon then run #./run_tests.sh then you can see yes/no prompt. Type 'yes' and press enter.       that will create a hidden virtual environment named .venv. type ls -a to see that virtual enviromnet       then activate that enviromnent like #source .venv/bin/activate         then stop apache2 server #sudo service apache2 restart then run django server like #python manage.py runserver 0.0.0.0:8003         then access horizon like http://192.168.56.101:8003    

How to Restart Apache server For Ubuntu

$ sudo service apache2 restart

How to find directory with terminal In Ubuntu

$ find . -type d | grep <dir name> Output ./topy ./topy/.git ./topy/.git/refs ./topy/.git/refs/tags ./topy/.git/refs/heads ./topy/.git/refs/remotes ./topy/.git/refs/remotes/origin ./topy/.git/hooks ./topy/.git/objects ./topy/.git/objects/3c ./topy/.git/objects/a1 ./topy/.git/objects/b3 ./topy/.git/objects/79

Add review comment "recheck-vmware" to retrigger a new build.

Image
if you get this result ,the press  Add Comment and past "recheck-vmware"