Posts

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 st...

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 pane...