SlideShare a Scribd company logo
1 of 21
Download to read offline
OpenStack API's and WSGI


                 http://github.com/lhrc-mikeyp/Presentations




Mike Pittaro
La Honda Research Center
mikeyp@LaHondaResearch.org
@pmikeyp
     This work is licensed under the Creative Commons Attribution-
     NonCommercial-ShareAlike 3.0 Unported License.
Introduction
●
    Taking a peek under the hood of OpenStack
    ●
        From the API inwards
●
    Prerequisites
    ●
        A basic understanding of Web, REST, and HTTP
    ●
        Some knowledge of Python
●
    Why learn this ?
    ●
        Understand OpenStack's API implementation
    ●
        Easier to understand and troubleshoot
    ●
        First step to modifying OpenStack
    ●
        First step to extending API's
How Deep is a 'peek' ?
●
    Everything should be made as simple as
    possible, but not simpler.
         ●
             Albert Enistein



●
    Simple is Better than Complex
●
    Complex is better than Complicated
         ●
             PEP 20
What is OpenStack ?
●   OpenStack is a global collaboration of developers
    and cloud computing technologists producing
    the ubiquitous open source cloud computing
    platform for public and private clouds.
●   The project aims to deliver solutions for all types
    of clouds by being simple to implement,
    massively scalable, and feature rich.
●   The technology consists of a series of
    interrelated projects delivering various
    components for a cloud infrastructure solution.
How is OpenStack Implemented?
●
    OpenStack is a collection of services
    ●
        Compute (Nova)             ●
                                       Identity (Keystone)
    ●
        Object Storage (Swift)     ●
                                       Dashboard (Horizon)
    ●
        Image Service (Glance)


●
    Each service is a 'WebApp'
    ●
        REST API server ('frontend')
    ●
        One or more backend servers
    ●
        Messaging interface between them
OpenStack API's
●
    All Interaction with OpenStack is via API's
    ●
        http://docs.openstack.org/api/
    ●
        http://api.openstack.org/
●
    API QuickStart
    ●
        http://docs.openstack.org/api/quick-start/content/
●
    The API's use HTTP + json (or xml)
    ●
        Use curl or wget or browser plugins
    ●
        Use any programming language via HTTP libraries
    ●
        Use the Python novaclient library
OpenStack In Action
   ●
       OpenStack includes a nova command
        ●
            It's built using the novaclient library
mikeyp@blade1:devstack$ nova --username admin --password devstack image-list
+--------------------------------------+--------------------------------------------+--------+--------+
|                  ID                  |                    Name                    | Status | Server |
+--------------------------------------+--------------------------------------------+--------+--------+
| 43bafe10-700c-45af-90a8-b5d794812e62 | cirros-0.3.0-x86_64-blank-ramdisk          | ACTIVE |        |
| 45ad4046-9780-4968-83c6-460f168321c7 | cirros-0.3.0-x86_64-blank-kernel           | ACTIVE |        |
| 6216fc7c-7f87-45e0-be0f-eefef2d5be33 | ttylinux-uec-amd64-11.2_2.6.35-15_1        | ACTIVE |        |
| 92a1e0bd-c4a5-4f3f-a66f-1f8b990f2b0e | ttylinux-uec-amd64-11.2_2.6.35-15_1-kernel | ACTIVE |        |
| 95d8db11-b175-43d2-b3de-d7b806e54dde | cirros-0.3.0-x86_64-blank                  | ACTIVE |        |
| e543bb77-5a7d-4ef0-9a7a-92ca6c8a0b35 | cirros-0.3.0-x86_64-rootfs                 | ACTIVE |        |
+--------------------------------------+--------------------------------------------+--------+--------+

mikeyp@blade1:devstack$ nova flavor-list
+----+-----------+-----------+------+-----------+------+-------+-------------+
| ID |    Name   | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor |
+----+-----------+-----------+------+-----------+------+-------+-------------+
| 1 | m1.tiny    | 512       | 0    | 0         |      | 1     | 1.0         |
| 2 | m1.small | 2048        | 10   | 20        |      | 1     | 1.0         |
| 3 | m1.medium | 4096       | 10   | 40        |      | 2     | 1.0         |
| 4 | m1.large | 8192        | 10   | 80        |      | 4     | 1.0         |
| 5 | m1.xlarge | 16384      | 10   | 160       |      | 8     | 1.0         |
+----+-----------+-----------+------+-----------+------+-------+-------------+
Using novaclient
#!/usr/bin/env python

import logging

import novaclient
from novaclient.v1_1 import client

# enable debug logging
logger = logging.getLogger('novaclient.client')
logger.setLevel(logging.DEBUG)
debug_stream = logging.StreamHandler()
logger.addHandler(debug_stream)

auth_url = 'http://10.100.20.22:5000/v2.0'
user = 'admin'
password = 'devstack'
project = 'demo'
region = 'RegionOne'
service = 'compute'

nova = client.Client(user, password, project, auth_url,
                     region_name=region, service_type=service)

results = nova.images.list(detailed=True)
for image in results:
    print image.id, image.name, image.status

mikeyp@blade1:api_examples$ python image_list.py
e543bb77-5a7d-4ef0-9a7a-92ca6c8a0b35 cirros-0.3.0-x86_64-rootfs ACTIVE
95d8db11-b175-43d2-b3de-d7b806e54dde cirros-0.3.0-x86_64-blank ACTIVE
45ad4046-9780-4968-83c6-460f168321c7 cirros-0.3.0-x86_64-blank-kernel ACTIVE
43bafe10-700c-45af-90a8-b5d794812e62 cirros-0.3.0-x86_64-blank-ramdisk ACTIVE
92a1e0bd-c4a5-4f3f-a66f-1f8b990f2b0e ttylinux-uec-amd64-11.2_2.6.35-15_1-kernel ACTIVE
6216fc7c-7f87-45e0-be0f-eefef2d5be33 ttylinux-uec-amd64-11.2_2.6.35-15_1 ACTIVE
Keystone API using urllib2
def get_keystone_token():
    """authenticate against keystone identity service
    returns an auth token, and the service url

   """
   user = 'admin'
   password = 'devstack'
   project = 'demo'
   auth_url = 'http://10.100.20.22:5000/v2.0/tokens'

   auth_request = urllib2.Request(auth_url)
   auth_request.add_header('Content-Type', 'application/json;charset=utf8')
   auth_request.add_header('Accept', 'application/json')
   auth_request.add_header('User-Agent', 'python-mikeyp')

   auth_data = {"auth":
       {"tenantName": project,
        "passwordCredentials": {
           "username": user,
           "password": password}
       }
   }
   auth_request.add_data(json.dumps(auth_data))
   auth_response = urllib2.urlopen(auth_request)
   response_data = json.loads(auth_response.read())

   token = response_data['access']['token']['id']

   service_list = response_data['access']['serviceCatalog']
   for s in service_list:
       if s['type'] == 'compute' and s['name'] == "'Compute Service'":
           break
   nova_url = s['endpoints'][0]['publicURL']
   return (token, nova_url)
Images API using urllib2
#!/usr/bin/env python

import urllib2
import json

# def get_keystone_token():
   # see previous page

token, service_url   = get_keystone_token()

image_api = service_url + '/images/detail'

images_request = urllib2.Request(image_api)
images_request.add_header('Content-Type', 'application/json;charset=utf8')
images_request.add_header('Accept', 'application/json')
images_request.add_header('User-Agent', 'python-mikeyp')
images_request.add_header('X-Auth-Token', token)
images_request.add_header('X-Auth-Project-Id', 'demo')

image_response = urllib2.urlopen(images_request)
image_data = json.loads(image_response.read())
print json.dumps(image_data, indent=4)
What's been happening ?
OpenStack 'Web Stack'
●
    Paste HTTP Server
    ●
        HTTP protocol + networking
●   WebOb requests and responses
    ●
        Wrappers for HTTP Requests and Responses
●   OpenStack code
    ●
        Nova, glance, keystone, etc
●
    Web Service Gateway Interface (WSGI)
    ●
        The specification for web servers and applications
    ●
        WSGI is not code – no import
WSGI In a Nutshell
●   WSGI Application
    ●   A Python callable passed two arguments:
        –   WSGI Environment
        –   A start_response function
    ●   Application calls start_response, and returns response
●   WSGI Server
    ●   The Server calls the application
●   WSGI Middleware
    ●   Both a server and application
    ●   Use to 'wrap' or 'pipeline' requests
Simple WSGI Application
"""Hello World using Paste + WSGI """

from paste import httpserver

def application(environ, start_response):
    start_response('200 OK', [('Content-type', 'text/html')])
    return ['Hello World']

httpserver.serve(application, host='127.0.0.1', port=8080)
WSGI With WebOb + Paste
wsgi_webob.py
"""Hello World using WebOb, Paste + WSGI """

from webob import Response
from webob.dec import wsgify

from paste import httpserver
from paste.deploy import loadapp

INI_PATH = '/home/mikeyp/Documents/Projects/OpenStack/presentations/api_examples/wsgi_webob.ini'

@wsgify
def application(request):

   return Response('Hello, World of WebOb !')


def app_factory(global_config, **local_config):
    return application

wsgi_app = loadapp('config:' + INI_PATH)

httpserver.serve(wsgi_app, host='127.0.0.1', port=8080)

wsgi_webob_ini.py

[app:main]
paste.app_factory = wsgi_webob:app_factory
WSGI middleware
"""Hello World (authorized version) using WebOb, Paste + WSGI """

from webob import Response
from webob.dec import wsgify
from webob import exc

from paste import httpserver
from paste.deploy import loadapp

INI_PATH = '/home/mikeyp/Documents/Projects/OpenStack/presentations/api_examples/wsgi_webob_mid.ini'

@wsgify
def application(request):

   return Response('Hello, Secret World of WebOb !')

@wsgify.middleware
def auth_filter(request, app):

   if request.headers.get('X-Auth-Token') != 'open-sesame':
       return exc.HTTPForbidden()
   return app(request)

def app_factory(global_config, **local_config):
    return application

def filter_factory(global_config, **local_config):
    return auth_filter

wsgi_app = loadapp('config:' + INI_PATH)

httpserver.serve(wsgi_app, host='127.0.0.1', port=8080)
Paste Middleware Config
[pipeline:main]
pipeline = auth hello

[app:hello]
paste.app_factory = wsgi_webob_mid:app_factory

[filter:auth]
paste.filter_factory = wsgi_webob_mid:filter_factory
Glance API Server – the code
●
    Paste Config file
    ●
        etc/glance-api-config.py
●
    Glance API server startup
    ●
        glance/common/wsgi.py
    ●
        glance/api/v1/router.py
●
    Main glance api files
    ●
        glance/api/v1/images.py
Keystone middleware
●
    Authentication Token Verification
    ●
        keystone/middleware/auth_token.py
    ●
        WSGI middleware
    ●
        Contains filter factory
Details and Complexity
●
    Lots more to learn – but not tonight
    ●
        Pluggable OpenStack API Extensions
    ●
        Front ends and load balancing
    ●
        Threading and concurrency
    ●
        URL mapping and dispatch
References
●   OpenStack
    ●   http://www.openstack.org
●   WSGI
    ●   http://www.wsgi.org
●   Paste Web Server
    ●   http://pythonpaste.org/
●   WebOb
    ●   http://www.webob.org/
●   P3333 (WSGI)
    ●   http://www.python.org/dev/peps/pep-3333/
●   HTTP RFC 2616
    ●   http://www.ietf.org/rfc/rfc2616.txt
●   RESTful Web Services (Book)
    ●   http://shop.oreilly.com/product/9780596529260.do

More Related Content

What's hot

OpenStack超入門シリーズ いまさら聞けないNeutronの使い方
OpenStack超入門シリーズ いまさら聞けないNeutronの使い方OpenStack超入門シリーズ いまさら聞けないNeutronの使い方
OpenStack超入門シリーズ いまさら聞けないNeutronの使い方Toru Makabe
 
OpenStackで始めるクラウド環境構築入門(Horizon 基礎編)
OpenStackで始めるクラウド環境構築入門(Horizon 基礎編)OpenStackで始めるクラウド環境構築入門(Horizon 基礎編)
OpenStackで始めるクラウド環境構築入門(Horizon 基礎編)VirtualTech Japan Inc.
 
Packet flow on openstack
Packet flow on openstackPacket flow on openstack
Packet flow on openstackAchhar Kalia
 
Openstack Trunk Port
Openstack Trunk PortOpenstack Trunk Port
Openstack Trunk Portbenceromsics
 
L’ Administration des Réseaux en Pratique
L’ Administration des Réseaux en PratiqueL’ Administration des Réseaux en Pratique
L’ Administration des Réseaux en PratiqueAmadou Dia
 
Troubleshooting common oslo.messaging and RabbitMQ issues
Troubleshooting common oslo.messaging and RabbitMQ issuesTroubleshooting common oslo.messaging and RabbitMQ issues
Troubleshooting common oslo.messaging and RabbitMQ issuesMichael Klishin
 
Red Hat OpenStack 17 저자직강+스터디그룹_1주차
Red Hat OpenStack 17 저자직강+스터디그룹_1주차Red Hat OpenStack 17 저자직강+스터디그룹_1주차
Red Hat OpenStack 17 저자직강+스터디그룹_1주차Nalee Jang
 
OpenStackでも重要な役割を果たすPacemakerを知ろう!
OpenStackでも重要な役割を果たすPacemakerを知ろう!OpenStackでも重要な役割を果たすPacemakerを知ろう!
OpenStackでも重要な役割を果たすPacemakerを知ろう!ksk_ha
 
Cobbler - Fast and reliable multi-OS provisioning
Cobbler - Fast and reliable multi-OS provisioningCobbler - Fast and reliable multi-OS provisioning
Cobbler - Fast and reliable multi-OS provisioningRUDDER
 
Docker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutesDocker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutesLuciano Fiandesio
 
SSHパケットの復号ツールを作ろう_v1(Decrypt SSH .pcap File)
SSHパケットの復号ツールを作ろう_v1(Decrypt SSH .pcap File)SSHパケットの復号ツールを作ろう_v1(Decrypt SSH .pcap File)
SSHパケットの復号ツールを作ろう_v1(Decrypt SSH .pcap File)Tetsuya Hasegawa
 
Building Multi-Site and Multi-OpenStack Cloud with OpenStack Cascading
Building Multi-Site and Multi-OpenStack Cloud with OpenStack CascadingBuilding Multi-Site and Multi-OpenStack Cloud with OpenStack Cascading
Building Multi-Site and Multi-OpenStack Cloud with OpenStack CascadingJoe Huang
 
OpenStack超入門シリーズ Novaのディスク周りあれこれ
OpenStack超入門シリーズ Novaのディスク周りあれこれOpenStack超入門シリーズ Novaのディスク周りあれこれ
OpenStack超入門シリーズ Novaのディスク周りあれこれToru Makabe
 
Docker入門: コンテナ型仮想化技術の仕組みと使い方
Docker入門: コンテナ型仮想化技術の仕組みと使い方Docker入門: コンテナ型仮想化技術の仕組みと使い方
Docker入門: コンテナ型仮想化技術の仕組みと使い方Yuichi Ito
 
Installation et Configuration de Pfsense
Installation et Configuration de PfsenseInstallation et Configuration de Pfsense
Installation et Configuration de PfsenseIsmail Rachdaoui
 
LinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughLinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughThomas Graf
 
OpenStack dans la pratique
OpenStack dans la pratiqueOpenStack dans la pratique
OpenStack dans la pratiqueOsones
 
Formation elastix
Formation elastixFormation elastix
Formation elastixbincoul
 
コンテナネットワーキング(CNI)最前線
コンテナネットワーキング(CNI)最前線コンテナネットワーキング(CNI)最前線
コンテナネットワーキング(CNI)最前線Motonori Shindo
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking ExplainedThomas Graf
 

What's hot (20)

OpenStack超入門シリーズ いまさら聞けないNeutronの使い方
OpenStack超入門シリーズ いまさら聞けないNeutronの使い方OpenStack超入門シリーズ いまさら聞けないNeutronの使い方
OpenStack超入門シリーズ いまさら聞けないNeutronの使い方
 
OpenStackで始めるクラウド環境構築入門(Horizon 基礎編)
OpenStackで始めるクラウド環境構築入門(Horizon 基礎編)OpenStackで始めるクラウド環境構築入門(Horizon 基礎編)
OpenStackで始めるクラウド環境構築入門(Horizon 基礎編)
 
Packet flow on openstack
Packet flow on openstackPacket flow on openstack
Packet flow on openstack
 
Openstack Trunk Port
Openstack Trunk PortOpenstack Trunk Port
Openstack Trunk Port
 
L’ Administration des Réseaux en Pratique
L’ Administration des Réseaux en PratiqueL’ Administration des Réseaux en Pratique
L’ Administration des Réseaux en Pratique
 
Troubleshooting common oslo.messaging and RabbitMQ issues
Troubleshooting common oslo.messaging and RabbitMQ issuesTroubleshooting common oslo.messaging and RabbitMQ issues
Troubleshooting common oslo.messaging and RabbitMQ issues
 
Red Hat OpenStack 17 저자직강+스터디그룹_1주차
Red Hat OpenStack 17 저자직강+스터디그룹_1주차Red Hat OpenStack 17 저자직강+스터디그룹_1주차
Red Hat OpenStack 17 저자직강+스터디그룹_1주차
 
OpenStackでも重要な役割を果たすPacemakerを知ろう!
OpenStackでも重要な役割を果たすPacemakerを知ろう!OpenStackでも重要な役割を果たすPacemakerを知ろう!
OpenStackでも重要な役割を果たすPacemakerを知ろう!
 
Cobbler - Fast and reliable multi-OS provisioning
Cobbler - Fast and reliable multi-OS provisioningCobbler - Fast and reliable multi-OS provisioning
Cobbler - Fast and reliable multi-OS provisioning
 
Docker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutesDocker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutes
 
SSHパケットの復号ツールを作ろう_v1(Decrypt SSH .pcap File)
SSHパケットの復号ツールを作ろう_v1(Decrypt SSH .pcap File)SSHパケットの復号ツールを作ろう_v1(Decrypt SSH .pcap File)
SSHパケットの復号ツールを作ろう_v1(Decrypt SSH .pcap File)
 
Building Multi-Site and Multi-OpenStack Cloud with OpenStack Cascading
Building Multi-Site and Multi-OpenStack Cloud with OpenStack CascadingBuilding Multi-Site and Multi-OpenStack Cloud with OpenStack Cascading
Building Multi-Site and Multi-OpenStack Cloud with OpenStack Cascading
 
OpenStack超入門シリーズ Novaのディスク周りあれこれ
OpenStack超入門シリーズ Novaのディスク周りあれこれOpenStack超入門シリーズ Novaのディスク周りあれこれ
OpenStack超入門シリーズ Novaのディスク周りあれこれ
 
Docker入門: コンテナ型仮想化技術の仕組みと使い方
Docker入門: コンテナ型仮想化技術の仕組みと使い方Docker入門: コンテナ型仮想化技術の仕組みと使い方
Docker入門: コンテナ型仮想化技術の仕組みと使い方
 
Installation et Configuration de Pfsense
Installation et Configuration de PfsenseInstallation et Configuration de Pfsense
Installation et Configuration de Pfsense
 
LinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughLinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking Walkthrough
 
OpenStack dans la pratique
OpenStack dans la pratiqueOpenStack dans la pratique
OpenStack dans la pratique
 
Formation elastix
Formation elastixFormation elastix
Formation elastix
 
コンテナネットワーキング(CNI)最前線
コンテナネットワーキング(CNI)最前線コンテナネットワーキング(CNI)最前線
コンテナネットワーキング(CNI)最前線
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking Explained
 

Viewers also liked

Inside neutron 2
Inside neutron 2Inside neutron 2
Inside neutron 2Robin Gong
 
Python WSGI introduction
Python WSGI introductionPython WSGI introduction
Python WSGI introductionAgeeleshwar K
 
Logisland "Event Mining at scale"
Logisland "Event Mining at scale"Logisland "Event Mining at scale"
Logisland "Event Mining at scale"Thomas Bailet
 
OpenStack Summit in Hong Kong 参加報告
OpenStack Summit in Hong Kong 参加報告OpenStack Summit in Hong Kong 参加報告
OpenStack Summit in Hong Kong 参加報告Akira Yoshiyama
 
Summit 16: Providing Root Cause Analysis to OPNFV Using Pinpoint -the A-CORD ...
Summit 16: Providing Root Cause Analysis to OPNFV Using Pinpoint -the A-CORD ...Summit 16: Providing Root Cause Analysis to OPNFV Using Pinpoint -the A-CORD ...
Summit 16: Providing Root Cause Analysis to OPNFV Using Pinpoint -the A-CORD ...OPNFV
 
OPNFV: Overview and Approach to Upstream Integration
OPNFV: Overview and Approach to Upstream IntegrationOPNFV: Overview and Approach to Upstream Integration
OPNFV: Overview and Approach to Upstream IntegrationOPNFV
 
How to write a Neutron Plugin - if you really need to
How to write a Neutron Plugin - if you really need toHow to write a Neutron Plugin - if you really need to
How to write a Neutron Plugin - if you really need tosalv_orlando
 
OpenStack networking - Neutron deep dive with PLUMgrid
OpenStack networking - Neutron deep dive with PLUMgridOpenStack networking - Neutron deep dive with PLUMgrid
OpenStack networking - Neutron deep dive with PLUMgridKamesh Pemmaraju
 
PNDA - Platform for Network Data Analytics
PNDA - Platform for Network Data AnalyticsPNDA - Platform for Network Data Analytics
PNDA - Platform for Network Data AnalyticsJohn Evans
 
PaNDA - a platform for Network Data Analytics: an overview
PaNDA - a platform for Network Data Analytics: an overviewPaNDA - a platform for Network Data Analytics: an overview
PaNDA - a platform for Network Data Analytics: an overviewCisco DevNet
 
OpenStack Architecture
OpenStack ArchitectureOpenStack Architecture
OpenStack ArchitectureMirantis
 

Viewers also liked (14)

OpenStack API
OpenStack APIOpenStack API
OpenStack API
 
Inside neutron 2
Inside neutron 2Inside neutron 2
Inside neutron 2
 
Python WSGI introduction
Python WSGI introductionPython WSGI introduction
Python WSGI introduction
 
Logisland "Event Mining at scale"
Logisland "Event Mining at scale"Logisland "Event Mining at scale"
Logisland "Event Mining at scale"
 
OpenStack hyeroglyphs
OpenStack hyeroglyphsOpenStack hyeroglyphs
OpenStack hyeroglyphs
 
OpenStack Summit in Hong Kong 参加報告
OpenStack Summit in Hong Kong 参加報告OpenStack Summit in Hong Kong 参加報告
OpenStack Summit in Hong Kong 参加報告
 
Summit 16: Providing Root Cause Analysis to OPNFV Using Pinpoint -the A-CORD ...
Summit 16: Providing Root Cause Analysis to OPNFV Using Pinpoint -the A-CORD ...Summit 16: Providing Root Cause Analysis to OPNFV Using Pinpoint -the A-CORD ...
Summit 16: Providing Root Cause Analysis to OPNFV Using Pinpoint -the A-CORD ...
 
OpenStack の利用
OpenStack の利用OpenStack の利用
OpenStack の利用
 
OPNFV: Overview and Approach to Upstream Integration
OPNFV: Overview and Approach to Upstream IntegrationOPNFV: Overview and Approach to Upstream Integration
OPNFV: Overview and Approach to Upstream Integration
 
How to write a Neutron Plugin - if you really need to
How to write a Neutron Plugin - if you really need toHow to write a Neutron Plugin - if you really need to
How to write a Neutron Plugin - if you really need to
 
OpenStack networking - Neutron deep dive with PLUMgrid
OpenStack networking - Neutron deep dive with PLUMgridOpenStack networking - Neutron deep dive with PLUMgrid
OpenStack networking - Neutron deep dive with PLUMgrid
 
PNDA - Platform for Network Data Analytics
PNDA - Platform for Network Data AnalyticsPNDA - Platform for Network Data Analytics
PNDA - Platform for Network Data Analytics
 
PaNDA - a platform for Network Data Analytics: an overview
PaNDA - a platform for Network Data Analytics: an overviewPaNDA - a platform for Network Data Analytics: an overview
PaNDA - a platform for Network Data Analytics: an overview
 
OpenStack Architecture
OpenStack ArchitectureOpenStack Architecture
OpenStack Architecture
 

Similar to OpenStack API's and WSGI

how to use openstack api
how to use openstack apihow to use openstack api
how to use openstack apiLiang Bo
 
NTT SIC marketplace slide deck at Tokyo Summit
NTT SIC marketplace slide deck at Tokyo SummitNTT SIC marketplace slide deck at Tokyo Summit
NTT SIC marketplace slide deck at Tokyo SummitToshikazu Ichikawa
 
Backend, app e internet das coisas com NodeJS no Google Cloud Platform
Backend, app e internet das coisas com NodeJS no Google Cloud PlatformBackend, app e internet das coisas com NodeJS no Google Cloud Platform
Backend, app e internet das coisas com NodeJS no Google Cloud PlatformDevMT
 
Backend, app e internet das coisas com NodeJS no Google Cloud Platform
Backend, app e internet das coisas com NodeJS no Google Cloud PlatformBackend, app e internet das coisas com NodeJS no Google Cloud Platform
Backend, app e internet das coisas com NodeJS no Google Cloud PlatformAlvaro Viebrantz
 
Django deployment with PaaS
Django deployment with PaaSDjango deployment with PaaS
Django deployment with PaaSAppsembler
 
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...Puppet
 
DEVNET-1136 Cisco ONE Enterprise Cloud Suite for Infrastructure Management.
DEVNET-1136	Cisco ONE Enterprise Cloud Suite for Infrastructure Management.DEVNET-1136	Cisco ONE Enterprise Cloud Suite for Infrastructure Management.
DEVNET-1136 Cisco ONE Enterprise Cloud Suite for Infrastructure Management.Cisco DevNet
 
Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek PROIDEA
 
Docker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic StackDocker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic StackJakub Hajek
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop OverviewShubhra Kar
 
Zaragoza dev ops-activiti-khd-20181212
Zaragoza dev ops-activiti-khd-20181212Zaragoza dev ops-activiti-khd-20181212
Zaragoza dev ops-activiti-khd-20181212Angel Borroy López
 
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...NGINX, Inc.
 
Real World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationReal World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationBen Hall
 
Openstack Summit Tokyo 2015 - Building a private cloud to efficiently handle ...
Openstack Summit Tokyo 2015 - Building a private cloud to efficiently handle ...Openstack Summit Tokyo 2015 - Building a private cloud to efficiently handle ...
Openstack Summit Tokyo 2015 - Building a private cloud to efficiently handle ...Pierre GRANDIN
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCLFastly
 
使用 Prometheus 監控 Kubernetes Cluster
使用 Prometheus 監控 Kubernetes Cluster 使用 Prometheus 監控 Kubernetes Cluster
使用 Prometheus 監控 Kubernetes Cluster inwin stack
 
Bare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefBare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefMatt Ray
 
Harmonia open iris_basic_v0.1
Harmonia open iris_basic_v0.1Harmonia open iris_basic_v0.1
Harmonia open iris_basic_v0.1Yongyoon Shin
 
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교  및 구축 방법[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교  및 구축 방법
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법Open Source Consulting
 

Similar to OpenStack API's and WSGI (20)

how to use openstack api
how to use openstack apihow to use openstack api
how to use openstack api
 
NTT SIC marketplace slide deck at Tokyo Summit
NTT SIC marketplace slide deck at Tokyo SummitNTT SIC marketplace slide deck at Tokyo Summit
NTT SIC marketplace slide deck at Tokyo Summit
 
Backend, app e internet das coisas com NodeJS no Google Cloud Platform
Backend, app e internet das coisas com NodeJS no Google Cloud PlatformBackend, app e internet das coisas com NodeJS no Google Cloud Platform
Backend, app e internet das coisas com NodeJS no Google Cloud Platform
 
Backend, app e internet das coisas com NodeJS no Google Cloud Platform
Backend, app e internet das coisas com NodeJS no Google Cloud PlatformBackend, app e internet das coisas com NodeJS no Google Cloud Platform
Backend, app e internet das coisas com NodeJS no Google Cloud Platform
 
Django deployment with PaaS
Django deployment with PaaSDjango deployment with PaaS
Django deployment with PaaS
 
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
 
DEVNET-1136 Cisco ONE Enterprise Cloud Suite for Infrastructure Management.
DEVNET-1136	Cisco ONE Enterprise Cloud Suite for Infrastructure Management.DEVNET-1136	Cisco ONE Enterprise Cloud Suite for Infrastructure Management.
DEVNET-1136 Cisco ONE Enterprise Cloud Suite for Infrastructure Management.
 
Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek
 
Docker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic StackDocker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic Stack
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop Overview
 
Zaragoza dev ops-activiti-khd-20181212
Zaragoza dev ops-activiti-khd-20181212Zaragoza dev ops-activiti-khd-20181212
Zaragoza dev ops-activiti-khd-20181212
 
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
 
Real World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationReal World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS Application
 
Openstack Summit Tokyo 2015 - Building a private cloud to efficiently handle ...
Openstack Summit Tokyo 2015 - Building a private cloud to efficiently handle ...Openstack Summit Tokyo 2015 - Building a private cloud to efficiently handle ...
Openstack Summit Tokyo 2015 - Building a private cloud to efficiently handle ...
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCL
 
Angular2 inter3
Angular2 inter3Angular2 inter3
Angular2 inter3
 
使用 Prometheus 監控 Kubernetes Cluster
使用 Prometheus 監控 Kubernetes Cluster 使用 Prometheus 監控 Kubernetes Cluster
使用 Prometheus 監控 Kubernetes Cluster
 
Bare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefBare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and Chef
 
Harmonia open iris_basic_v0.1
Harmonia open iris_basic_v0.1Harmonia open iris_basic_v0.1
Harmonia open iris_basic_v0.1
 
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교  및 구축 방법[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교  및 구축 방법
[오픈소스컨설팅] 쿠버네티스와 쿠버네티스 on 오픈스택 비교 및 구축 방법
 

Recently uploaded

Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

OpenStack API's and WSGI

  • 1. OpenStack API's and WSGI http://github.com/lhrc-mikeyp/Presentations Mike Pittaro La Honda Research Center mikeyp@LaHondaResearch.org @pmikeyp This work is licensed under the Creative Commons Attribution- NonCommercial-ShareAlike 3.0 Unported License.
  • 2. Introduction ● Taking a peek under the hood of OpenStack ● From the API inwards ● Prerequisites ● A basic understanding of Web, REST, and HTTP ● Some knowledge of Python ● Why learn this ? ● Understand OpenStack's API implementation ● Easier to understand and troubleshoot ● First step to modifying OpenStack ● First step to extending API's
  • 3. How Deep is a 'peek' ? ● Everything should be made as simple as possible, but not simpler. ● Albert Enistein ● Simple is Better than Complex ● Complex is better than Complicated ● PEP 20
  • 4. What is OpenStack ? ● OpenStack is a global collaboration of developers and cloud computing technologists producing the ubiquitous open source cloud computing platform for public and private clouds. ● The project aims to deliver solutions for all types of clouds by being simple to implement, massively scalable, and feature rich. ● The technology consists of a series of interrelated projects delivering various components for a cloud infrastructure solution.
  • 5. How is OpenStack Implemented? ● OpenStack is a collection of services ● Compute (Nova) ● Identity (Keystone) ● Object Storage (Swift) ● Dashboard (Horizon) ● Image Service (Glance) ● Each service is a 'WebApp' ● REST API server ('frontend') ● One or more backend servers ● Messaging interface between them
  • 6. OpenStack API's ● All Interaction with OpenStack is via API's ● http://docs.openstack.org/api/ ● http://api.openstack.org/ ● API QuickStart ● http://docs.openstack.org/api/quick-start/content/ ● The API's use HTTP + json (or xml) ● Use curl or wget or browser plugins ● Use any programming language via HTTP libraries ● Use the Python novaclient library
  • 7. OpenStack In Action ● OpenStack includes a nova command ● It's built using the novaclient library mikeyp@blade1:devstack$ nova --username admin --password devstack image-list +--------------------------------------+--------------------------------------------+--------+--------+ | ID | Name | Status | Server | +--------------------------------------+--------------------------------------------+--------+--------+ | 43bafe10-700c-45af-90a8-b5d794812e62 | cirros-0.3.0-x86_64-blank-ramdisk | ACTIVE | | | 45ad4046-9780-4968-83c6-460f168321c7 | cirros-0.3.0-x86_64-blank-kernel | ACTIVE | | | 6216fc7c-7f87-45e0-be0f-eefef2d5be33 | ttylinux-uec-amd64-11.2_2.6.35-15_1 | ACTIVE | | | 92a1e0bd-c4a5-4f3f-a66f-1f8b990f2b0e | ttylinux-uec-amd64-11.2_2.6.35-15_1-kernel | ACTIVE | | | 95d8db11-b175-43d2-b3de-d7b806e54dde | cirros-0.3.0-x86_64-blank | ACTIVE | | | e543bb77-5a7d-4ef0-9a7a-92ca6c8a0b35 | cirros-0.3.0-x86_64-rootfs | ACTIVE | | +--------------------------------------+--------------------------------------------+--------+--------+ mikeyp@blade1:devstack$ nova flavor-list +----+-----------+-----------+------+-----------+------+-------+-------------+ | ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | +----+-----------+-----------+------+-----------+------+-------+-------------+ | 1 | m1.tiny | 512 | 0 | 0 | | 1 | 1.0 | | 2 | m1.small | 2048 | 10 | 20 | | 1 | 1.0 | | 3 | m1.medium | 4096 | 10 | 40 | | 2 | 1.0 | | 4 | m1.large | 8192 | 10 | 80 | | 4 | 1.0 | | 5 | m1.xlarge | 16384 | 10 | 160 | | 8 | 1.0 | +----+-----------+-----------+------+-----------+------+-------+-------------+
  • 8. Using novaclient #!/usr/bin/env python import logging import novaclient from novaclient.v1_1 import client # enable debug logging logger = logging.getLogger('novaclient.client') logger.setLevel(logging.DEBUG) debug_stream = logging.StreamHandler() logger.addHandler(debug_stream) auth_url = 'http://10.100.20.22:5000/v2.0' user = 'admin' password = 'devstack' project = 'demo' region = 'RegionOne' service = 'compute' nova = client.Client(user, password, project, auth_url, region_name=region, service_type=service) results = nova.images.list(detailed=True) for image in results: print image.id, image.name, image.status mikeyp@blade1:api_examples$ python image_list.py e543bb77-5a7d-4ef0-9a7a-92ca6c8a0b35 cirros-0.3.0-x86_64-rootfs ACTIVE 95d8db11-b175-43d2-b3de-d7b806e54dde cirros-0.3.0-x86_64-blank ACTIVE 45ad4046-9780-4968-83c6-460f168321c7 cirros-0.3.0-x86_64-blank-kernel ACTIVE 43bafe10-700c-45af-90a8-b5d794812e62 cirros-0.3.0-x86_64-blank-ramdisk ACTIVE 92a1e0bd-c4a5-4f3f-a66f-1f8b990f2b0e ttylinux-uec-amd64-11.2_2.6.35-15_1-kernel ACTIVE 6216fc7c-7f87-45e0-be0f-eefef2d5be33 ttylinux-uec-amd64-11.2_2.6.35-15_1 ACTIVE
  • 9. Keystone API using urllib2 def get_keystone_token(): """authenticate against keystone identity service returns an auth token, and the service url """ user = 'admin' password = 'devstack' project = 'demo' auth_url = 'http://10.100.20.22:5000/v2.0/tokens' auth_request = urllib2.Request(auth_url) auth_request.add_header('Content-Type', 'application/json;charset=utf8') auth_request.add_header('Accept', 'application/json') auth_request.add_header('User-Agent', 'python-mikeyp') auth_data = {"auth": {"tenantName": project, "passwordCredentials": { "username": user, "password": password} } } auth_request.add_data(json.dumps(auth_data)) auth_response = urllib2.urlopen(auth_request) response_data = json.loads(auth_response.read()) token = response_data['access']['token']['id'] service_list = response_data['access']['serviceCatalog'] for s in service_list: if s['type'] == 'compute' and s['name'] == "'Compute Service'": break nova_url = s['endpoints'][0]['publicURL'] return (token, nova_url)
  • 10. Images API using urllib2 #!/usr/bin/env python import urllib2 import json # def get_keystone_token(): # see previous page token, service_url = get_keystone_token() image_api = service_url + '/images/detail' images_request = urllib2.Request(image_api) images_request.add_header('Content-Type', 'application/json;charset=utf8') images_request.add_header('Accept', 'application/json') images_request.add_header('User-Agent', 'python-mikeyp') images_request.add_header('X-Auth-Token', token) images_request.add_header('X-Auth-Project-Id', 'demo') image_response = urllib2.urlopen(images_request) image_data = json.loads(image_response.read()) print json.dumps(image_data, indent=4)
  • 12. OpenStack 'Web Stack' ● Paste HTTP Server ● HTTP protocol + networking ● WebOb requests and responses ● Wrappers for HTTP Requests and Responses ● OpenStack code ● Nova, glance, keystone, etc ● Web Service Gateway Interface (WSGI) ● The specification for web servers and applications ● WSGI is not code – no import
  • 13. WSGI In a Nutshell ● WSGI Application ● A Python callable passed two arguments: – WSGI Environment – A start_response function ● Application calls start_response, and returns response ● WSGI Server ● The Server calls the application ● WSGI Middleware ● Both a server and application ● Use to 'wrap' or 'pipeline' requests
  • 14. Simple WSGI Application """Hello World using Paste + WSGI """ from paste import httpserver def application(environ, start_response): start_response('200 OK', [('Content-type', 'text/html')]) return ['Hello World'] httpserver.serve(application, host='127.0.0.1', port=8080)
  • 15. WSGI With WebOb + Paste wsgi_webob.py """Hello World using WebOb, Paste + WSGI """ from webob import Response from webob.dec import wsgify from paste import httpserver from paste.deploy import loadapp INI_PATH = '/home/mikeyp/Documents/Projects/OpenStack/presentations/api_examples/wsgi_webob.ini' @wsgify def application(request): return Response('Hello, World of WebOb !') def app_factory(global_config, **local_config): return application wsgi_app = loadapp('config:' + INI_PATH) httpserver.serve(wsgi_app, host='127.0.0.1', port=8080) wsgi_webob_ini.py [app:main] paste.app_factory = wsgi_webob:app_factory
  • 16. WSGI middleware """Hello World (authorized version) using WebOb, Paste + WSGI """ from webob import Response from webob.dec import wsgify from webob import exc from paste import httpserver from paste.deploy import loadapp INI_PATH = '/home/mikeyp/Documents/Projects/OpenStack/presentations/api_examples/wsgi_webob_mid.ini' @wsgify def application(request): return Response('Hello, Secret World of WebOb !') @wsgify.middleware def auth_filter(request, app): if request.headers.get('X-Auth-Token') != 'open-sesame': return exc.HTTPForbidden() return app(request) def app_factory(global_config, **local_config): return application def filter_factory(global_config, **local_config): return auth_filter wsgi_app = loadapp('config:' + INI_PATH) httpserver.serve(wsgi_app, host='127.0.0.1', port=8080)
  • 17. Paste Middleware Config [pipeline:main] pipeline = auth hello [app:hello] paste.app_factory = wsgi_webob_mid:app_factory [filter:auth] paste.filter_factory = wsgi_webob_mid:filter_factory
  • 18. Glance API Server – the code ● Paste Config file ● etc/glance-api-config.py ● Glance API server startup ● glance/common/wsgi.py ● glance/api/v1/router.py ● Main glance api files ● glance/api/v1/images.py
  • 19. Keystone middleware ● Authentication Token Verification ● keystone/middleware/auth_token.py ● WSGI middleware ● Contains filter factory
  • 20. Details and Complexity ● Lots more to learn – but not tonight ● Pluggable OpenStack API Extensions ● Front ends and load balancing ● Threading and concurrency ● URL mapping and dispatch
  • 21. References ● OpenStack ● http://www.openstack.org ● WSGI ● http://www.wsgi.org ● Paste Web Server ● http://pythonpaste.org/ ● WebOb ● http://www.webob.org/ ● P3333 (WSGI) ● http://www.python.org/dev/peps/pep-3333/ ● HTTP RFC 2616 ● http://www.ietf.org/rfc/rfc2616.txt ● RESTful Web Services (Book) ● http://shop.oreilly.com/product/9780596529260.do