how to develop openstack

33
OPENSTACK DEVELOPMENT HOW TO DEVELOP OPENSTACK by Mehdi AliSoltani 1 [email protected] www.linkedin.com/in/mehdi-ali-soltani-315453b7

Upload: mehdi-ali-soltani

Post on 12-Apr-2017

63 views

Category:

Software


1 download

TRANSCRIPT

Page 1: How to Develop OpenStack

OPENSTACK DEVELOPMENT

HOW TO DEVELOP OPENSTACK

by

Mehdi AliSoltani

1

[email protected]

www.linkedin.com/in/mehdi-ali-soltani-315453b7

Page 2: How to Develop OpenStack

2OPENSTACK DEVELOPMENT

Agenda

• OpenStack Services• OpenStack Architecture• Nova Architecture• Start on Codes• Messaging in OpenStack• OpenStack Libraries• Request Flow in OpenStack• OpenStack Clients

Page 3: How to Develop OpenStack

3

OpenStack is a cloud operating system that controls large pools of compute, storage, and networking resources throughout a datacenter.

OPENSTACK DEVELOPMENT

What is OpenStack

Page 4: How to Develop OpenStack

4OPENSTACK DEVELOPMENT

OpenStack Services

DashboardHorizon• web-based portal to

interact with underlying OpenStack services

NOVA COMPUTE LAYER• Manages the compute

instances in an OpenStack environment. Responsibilities include creating , scheduling and decommissioning of virtual machines on demand.

KEYSTONEIDENTITY• authentication and

authorization service for other OpenStack services

Page 5: How to Develop OpenStack

5OPENSTACK DEVELOPMENT

OpenStack Services

CINDERBLOCK STORAGE• Provides persistent

block storage to running instances

SWIFT OBJECT STORAGE• Stores and retrieves

arbitrary unstructured data objects via a RESTful, HTTP based API

GLANCEIMAGE MANAGEMENT• Stores and retrieves

virtual machine disk images

Page 6: How to Develop OpenStack

6OPENSTACK DEVELOPMENT

OpenStack Services

NEUTRONNETWORKING• Enables Network-

Connectivity-as-a-Service for other OpenStack services, such as OpenStack Compute

HEAT ORCHESTRATION

CEILOMETERTROVESAHARA

Page 7: How to Develop OpenStack

7OPENSTACK DEVELOPMENT

OpenStack Architecture

Page 8: How to Develop OpenStack

8OPENSTACK DEVELOPMENT

Why Develop OpenStack

OpenStack Hypervisor Support Matrix

Page 9: How to Develop OpenStack

9OPENSTACK DEVELOPMENT

First Step

You should understand the codes

Page 10: How to Develop OpenStack

10OPENSTACK DEVELOPMENT

OpenStack Code Architecture

Page 11: How to Develop OpenStack

11OPENSTACK DEVELOPMENT

Many Teams and Many Projects

Page 12: How to Develop OpenStack

12

NOVA

OPENSTACK DEVELOPMENT

NOVA

QUEUENOVA API

Page 13: How to Develop OpenStack

13OPENSTACK DEVELOPMENT

Nova Architecture

Page 14: How to Develop OpenStack

14OPENSTACK DEVELOPMENT

Nova Components

Nova-apisupports OpenStack Compute API, Amazon's EC2 APIcommunicated over HTTP, converts the requests to components via message queue

Nova-conductorprovides coordinationand database query support for Nova

Nova-computeA worker daemon which takes orders from its message queue and perform virtualmachine create/delete tasks using Hypervisor's API.

Page 15: How to Develop OpenStack

15OPENSTACK DEVELOPMENT

Nova Components

Nova-schedulerdecides which Nova Compute Host to allot for virtual machine request

Nova-networktakes network related tasks from its message queue and performing those. OpenStack's neutron component can be opted instead of nova-network.

Message queueAll components of Nova communicate with each other in a non-blocking callback-oriented manner using AMQP protocol

Page 16: How to Develop OpenStack

16

Clone a repository from: • https://git.openstack.org/openstack/<projectname>• https://github.com/openstack/<projectname>

For nova :• https://github.com/openstack/nova• https://git.openstack.org/openstack/nova

OPENSTACK DEVELOPMENT

Starting Work on Code

Page 17: How to Develop OpenStack

17

OpenStack Programming Language

OPENSTACK DEVELOPMENT

You Should Know

• Python• JavaScript, JSON• Shell Script

Page 18: How to Develop OpenStack

18OPENSTACK DEVELOPMENT

Messaging in OpenStack

How messages transport in OpenStack ?

Page 19: How to Develop OpenStack

19

Two methods:

• OpenStack components such as Nova , Cinder , Neutron communicates internally via AMQP (Advanced Message Queue Protocol) using RabbitMQ or Qpid

• Through each other using REST-call.

OPENSTACK DEVELOPMENT

Messaging in OpenStack

Page 20: How to Develop OpenStack

20

The AMQP either RabbitMQ or Qpid, sits between any two Nova components and allows them to communicate using Remote Procedure Calls (RPC )

OPENSTACK DEVELOPMENT

Message Queue in Nova

Page 21: How to Develop OpenStack

21OPENSTACK DEVELOPMENT

Message Queue in Nova

• rpc.cast :don’t wait for result• rpc.call : wait for result (when

there is something to return)

Page 22: How to Develop OpenStack

22OPENSTACK DEVELOPMENT

Messaging Between OpenStack Services

Page 23: How to Develop OpenStack

23OPENSTACK DEVELOPMENT

OpenStack Libraries(oslo)

The Oslo project intends to produce a python library containing infrastructure code shared by OpenStack projects including :

oslo.config

oslo.concurrency

oslo.utils

oslo.serialization

oslo.messaging

oslo.i18n

Page 24: How to Develop OpenStack

24OPENSTACK DEVELOPMENT

OpenStack Libraries(oslo.config)

A library for parsing configuration options from the command line and configuration files.

Parse the /etc/nova/nova.conf and convert it to cfg object

Page 25: How to Develop OpenStack

25

oslo.concurrencymanaging external processes and task synchronization.

OPENSTACK DEVELOPMENT

OpenStack oslo

oslo.utilsa library that provides various low-level utility modules/code, such as fileutils, timeutils, importutils(import related utilities and helper functions)

oslo.messagingThe Oslo messaging API supports RPC

Page 26: How to Develop OpenStack

26OPENSTACK DEVELOPMENT

Request Flow for Provisioning Instance

Page 27: How to Develop OpenStack

27OPENSTACK DEVELOPMENT

OpenStack Clients

• Most OpenStack project provides a command-line client for each service including:

• python-glanceclient• python-novaclient• python-keystoneclient• …

Page 28: How to Develop OpenStack

28

• nova boot (Create new instance)• nova reboot• nova flavor-list(Print a list of available flavors (sizes of servers))• nova resize (Resize the instance to new flavor)• ….

OPENSTACK DEVELOPMENT

Nova-client

• Nova client is for the Compute service provides a nova command-line client

• Nova client is a client for the OpenStack Nova APISome of nova commands:

Page 29: How to Develop OpenStack

29OPENSTACK DEVELOPMENT

Write New API in Nova

• If you want to write new API in Nova, you should be familiar with nova client as well .

• For example nova resize , first shutdown the current instance, then change the flavor and migrate it to the new host which is selected by scheduler.

• You should know how to invoke new API by nova client

Page 30: How to Develop OpenStack

30OPENSTACK DEVELOPMENT

Resize Instance on the Same Host

• Suppose we want to have our own resize instance command which allows to resize an instance on the same host if it is possible(enough resources available)

• A solutionCheck if possible to resize on place If OK, Shutdown the instanceTake a snapshot Create a new instance with the new flavor on the same

hostBoot instance with the snapshot imageDelete the old instance

Page 31: How to Develop OpenStack

31

• Many commands in OpenStack novaclient following same process

• Suppose Libvirt is used as compute driver

OPENSTACK DEVELOPMENT

Command Flow

Page 32: How to Develop OpenStack

32

• Account Setup: You need a Launchpad account• Join OpenStack Foundation• Log Into Gerrit Review System• Install git• Clone the codes• Working on Bugs

OPENSTACK DEVELOPMENT

How to Contribute in OpenStack

Page 33: How to Develop OpenStack

33OPENSTACK DEVELOPMENT