Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Use OpenStack with Zend Framework 2

Use OpenStack with Zend Framework 2

OpenStack is becoming the open source standard for cloud computing. Most of the cloud vendors use OpenStack and the community of users is growing every day. In this talk we will give a brief introduction to OpenStack and we will present the new library service for Zend Framework 2 that supports the last version of the OpenStack API. You will see how is easy to use the OpenStack API with ZF2 thanks to a friendly object oriented interface.
This talk has been presented at ZendCon 2013 in Santa Clara (California).

Enrico Zimuel

October 09, 2013

More Decks by Enrico Zimuel

Other Decks in Programming


  1. Use OpenStack with
    Zend Framework 2
    Enrico Zimuel
    Zend Framework Team
    Zend Technologies Inc.

    View Slide

  2. 2
    About me
    • Enrico Zimuel (@ezimuel)
    • Software Engineer since 1996
    • PHP Engineer at Zend Technologies in
    the Zend Framework and Apigility Team
    • International speaker, author of books and
    technical articles
    • I was a Researcher programmer at
    Informatics Institute of University of
    • Co-founder of PUG Torino (Italy)

    View Slide

  3. View Slide

  4. OpenStack

    OpenStack is an open
    source cloud computing
    platform for public and
    private clouds

    The goal is to enable any organization to
    create and offer cloud computing services
    running on standard hardware

    Founded by Rackspace Hosting and NASA


    View Slide

  5. 5
    OpenStack architecture
    Image source: http://www.openstack.org/software/

    View Slide

  6. OpenStack dashboard (Grizzly)

    View Slide

  7. OpenStack API

    Identity Service (v. 2, 3)

    Compute and Extensions (v. 2)

    Image Service (v. 1, 2)

    Block Storage Service (v. 2)

    Networking (v. 2)

    Object Storage (v. 1)

    Orchestration (v. 1)

    View Slide

  8. Some vendors using OpenStack

    View Slide

  9. Do you want to try OpenStack?


    A set up of clusters running OpenStack
    on both x86 and ARM architectures

    It's totally free for you to try & test your

    View Slide

  10. ZendService\OpenStack

    View Slide

  11. 11
    Status of the project

    ZendService\OpenStack is a PHP library to
    use the API of OpenStack in a OO fashion

    The project started in Feb 2013

    It's 100% compatible with the API
    specifications of OpenStack

    It uses the ZendService\Api component to
    interact with the HTTP API call

    View Slide

  12. 12

    Right now we support the following API:
    – BlockStorage
    – Compute
    – Identity
    – ObjectStorage

    We are going to release these others soon:
    – Networking
    – Image

    View Slide

  13. 13

    Using composer:
    "require": {
    "zendframework/zendservice­openstack": "dev­master"

    Or from github (download or fork)
    – curl ­s https://getcomposer.org/installer | php
    – php composer.phar install

    View Slide

  14. Class structure

    – AbstractOpenStack
    – Identity
    – BlockStorage
    – ObjectStorage
    – Compute
    – Networking
    – Image

    View Slide

  15. Identity API – Auth and Token

    authenticate($name, $password, $tenantName
    = null)

    autenticateByKey($name, $key)

    validateToken($token, $belongsTo = null)

    checkToken($token, $belongsTo = null)

    listEndpointsToken($token, $belongsTo = null)

    View Slide

  16. 16
    Identity API – User and Tenant


    addUser(array $user)

    updateUser(array $user)


    listGlobalRoles($id, $serviceId = null)

    addTenant(array $tenant)

    updateTenant(array $tenant)


    View Slide

  17. Example: authentication

    View Slide

  18. Example: user management

    View Slide

  19. ObjectStorage API - containers

    listContainers(array $options = array())

    createContainer($name, $metadata = array())



    setContainerMetadata($container, array

    deleteContainerMetadata($container, array

    View Slide

  20. ObjectStorage API - objects

    listObjects($container, $options= array())

    getObject($container, $object)

    setObject($container, $object, $content, $metadata
    = array(), $expire = null)

    deleteObject($container, $object)

    copyObject($containerFrom, $objectFrom,
    $containerTo, $objectTo)

    setObjectMetadata($container, $object, array

    getObjectMetadata($container, $object)

    View Slide

  21. Example – container and object

    View Slide

  22. Example – metadata

    View Slide

  23. Compute API - servers

    listServers(array $options = array(), $details =

    createServer(array $options)


    updateServer($id, array $options)



    listAddressesByNetwork($id, $network)

    View Slide

  24. Compute API – server actions

    changeAdminPass($id, $password)

    rebootServer($id, $soft = true)

    rebuildServer($id, array $options)

    resizeServer($id, $flavorRef)



    View Slide

  25. Compute API – flavor and image

    createImage($id, array $options)

    listFlavors(array $options = array(), $details = false)


    listImages(array $options = array(), $details = false)



    View Slide

  26. Compute API – metadata



    setServerMetadata($id, array $metadata)

    setImageMetadata($id, array $metadata)

    updateServerMetadata($id, array $metadata)

    updateImageMetadata($id, array $metadata)

    getServerMetadataItem($id, $key)

    getImageMetadataItem($id, $key)

    setServerMetadataItem($id, $key, $value = '')

    setImageMetadataItem($id, $key, $value = '')

    deleteServerMetadataItem($id, $key)

    deleteImageMetadataItem($id, $key)

    View Slide

  27. Example: create a server

    View Slide

  28. Example: list existing servers

    View Slide

  29. 29
    Under the hood

    We use ZendService\Api library to
    consume the OpenStack API

    Simple PHP configuration file to build
    HTTP request. For instance:

    View Slide

  30. 30
    Future works

    Complete the Networking and Image

    Support API versioning (?)

    Do you want to contribute?
    Fork the project on github
    and contact me!

    View Slide

  31. Thanks!
    Vote this talk at https://joind.in/9082
    Comments and feedbacks:
    [email protected]

    View Slide