• Stars
    star
    241
  • Rank 167,643 (Top 4 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created almost 11 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Unified SDK for OpenStack. Mirror of code maintained at opendev.org.

openstacksdk

openstacksdk is a client library for building applications to work with OpenStack clouds. The project aims to provide a consistent and complete set of interactions with OpenStack's many services, along with complete documentation, examples, and tools.

It also contains an abstraction interface layer. Clouds can do many things, but there are probably only about 10 of them that most people care about with any regularity. If you want to do complicated things, the per-service oriented portions of the SDK are for you. However, if what you want is to be able to write an application that talks to any OpenStack cloud regardless of configuration, then the Cloud Abstraction layer is for you.

More information about the history of openstacksdk can be found at https://docs.openstack.org/openstacksdk/latest/contributor/history.html

Getting started

openstacksdk aims to talk to any OpenStack cloud. To do this, it requires a configuration file. openstacksdk favours clouds.yaml files, but can also use environment variables. The clouds.yaml file should be provided by your cloud provider or deployment tooling. An example:

clouds:
  mordred:
    region_name: Dallas
    auth:
      username: 'mordred'
      password: XXXXXXX
      project_name: 'demo'
      auth_url: 'https://identity.example.com'

openstacksdk will look for clouds.yaml files in the following locations:

  • . (the current directory)
  • $HOME/.config/openstack
  • /etc/openstack

openstacksdk consists of three layers. Most users will make use of the proxy layer. Using the above clouds.yaml, consider listing servers:

import openstack

# Initialize and turn on debug logging
openstack.enable_logging(debug=True)

# Initialize connection
conn = openstack.connect(cloud='mordred')

# List the servers
for server in conn.compute.servers():
    print(server.to_dict())

openstacksdk also contains a higher-level cloud layer based on logical operations:

import openstack

# Initialize and turn on debug logging
openstack.enable_logging(debug=True)

# Initialize connection
conn = openstack.connect(cloud='mordred')

# List the servers
for server in conn.list_servers():
    print(server.to_dict())

The benefit of this layer is mostly seen in more complicated operations that take multiple steps and where the steps vary across providers. For example:

import openstack

# Initialize and turn on debug logging
openstack.enable_logging(debug=True)

# Initialize connection
conn = openstack.connect(cloud='mordred')

# Upload an image to the cloud
image = conn.create_image(
    'ubuntu-trusty', filename='ubuntu-trusty.qcow2', wait=True)

# Find a flavor with at least 512M of RAM
flavor = conn.get_flavor_by_ram(512)

# Boot a server, wait for it to boot, and then do whatever is needed
# to get a public IP address for it.
conn.create_server(
    'my-server', image=image, flavor=flavor, wait=True, auto_ip=True)

Finally, there is the low-level resource layer. This provides support for the basic CRUD operations supported by REST APIs and is the base building block for the other layers. You typically will not need to use this directly:

import openstack
import openstack.config.loader
import openstack.compute.v2.server

# Initialize and turn on debug logging
openstack.enable_logging(debug=True)

# Initialize connection
conn = openstack.connect(cloud='mordred')

# List the servers
for server in openstack.compute.v2.server.Server.list(session=conn.compute):
    print(server.to_dict())

Configuration

openstacksdk uses the openstack.config module to parse configuration. openstack.config will find cloud configuration for as few as one cloud and as many as you want to put in a config file. It will read environment variables and config files, and it also contains some vendor specific default values so that you don't have to know extra info to use OpenStack

  • If you have a config file, you will get the clouds listed in it
  • If you have environment variables, you will get a cloud named envvars
  • If you have neither, you will get a cloud named defaults with base defaults

You can view the configuration identified by openstacksdk in your current environment by running openstack.config.loader. For example:

$ python -m openstack.config.loader

More information at https://docs.openstack.org/openstacksdk/latest/user/config/configuration.html

Supported services

The following services are currently supported. A full list of all available OpenStack service can be found in the Project Navigator.

Note

Support here does not guarantee full-support for all APIs. It simply means some aspect of the project is supported.

Supported services
Service Description Cloud Layer Proxy & Resource Layer
Compute      
Nova Compute ✔ ✔ (openstack.compute)
Hardware Lifecycle      
Ironic Bare metal provisioning ✔ ✔ (openstack.baremetal, openstack.baremetal_introspection)
Cyborg Lifecycle management of accelerators ✔ ✔ (openstack.accelerator)
Storage      
Cinder Block storage ✔ ✔ (openstack.block_storage)
Swift Object store ✔ ✔ (openstack.object_store)
Cinder Shared filesystems ✔ ✔ (openstack.shared_file_system)
Networking      
Neutron Networking ✔ ✔ (openstack.network)
Octavia Load balancing ✔ ✔ (openstack.load_balancer)
Designate DNS ✔ ✔ (openstack.dns)
Shared services      
Keystone Identity ✔ ✔ (openstack.identity)
Placement Placement ✔ ✔ (openstack.placement)
Glance Image storage ✔ ✔ (openstack.image)
Barbican Key management ✔ ✔ (openstack.key_manager)
Workload provisioning      
Magnum Container orchestration engine provisioning ✔ ✔ (openstack.container_infrastructure_management)
Orchestration      
Heat Orchestration ✔ ✔ (openstack.orchestration)
Senlin Clustering ✔ ✔ (openstack.clustering)
Mistral Workflow ✔ ✔ (openstack.workflow)
Zaqar Messaging ✔ ✔ (openstack.message)
Application lifecycle      
Masakari Instances high availability service ✔ ✔ (openstack.instance_ha)

Links

More Repositories

1

openstack

Repository tracking all OpenStack repositories as submodules. Mirror of code maintained at opendev.org.
Python
4,913
star
2

nova

OpenStack Compute (Nova). Mirror of code maintained at opendev.org.
Python
2,964
star
3

swift

OpenStack Storage (Swift). Mirror of code maintained at opendev.org.
Python
2,493
star
4

devstack

System for quickly installing an OpenStack cloud from upstream git for testing and development. Mirror of code maintained at opendev.org.
Shell
1,982
star
5

openstack-ansible

Ansible playbooks for deploying OpenStack. Mirror of code maintained at opendev.org.
Python
1,384
star
6

neutron

OpenStack Networking (Neutron). Mirror of code maintained at opendev.org.
Python
1,341
star
7

horizon

OpenStack Dashboard (Horizon). Mirror of code maintained at opendev.org.
Python
1,305
star
8

kolla

Kolla provides production-ready containers and deployment tools for operating OpenStack clouds. Mirror of code maintained at opendev.org.
Python
1,110
star
9

keystone

OpenStack Identity (Keystone). Mirror of code maintained at opendev.org.
Python
666
star
10

ansible-hardening

Ansible role for security hardening. Mirror of code maintained at opendev.org.
Jinja
632
star
11

cinder

OpenStack Block Storage (Cinder). Mirror of code maintained at opendev.org.
Python
623
star
12

kolla-ansible

Ansible deployment of the Kolla containers. Mirror of code maintained at opendev.org.
Jinja
566
star
13

glance

OpenStack Image Management (Glance). Mirror of code maintained at opendev.org.
Python
500
star
14

ironic

A service for managing and provisioning Bare Metal servers. Mirror of code maintained at opendev.org.
Python
430
star
15

openstack-manuals

OpenStack Manuals. Mirror of code maintained at opendev.org.
HTML
411
star
16

openstack-helm

Helm charts for deploying OpenStack on Kubernetes. Mirror of code maintained at opendev.org.
Shell
392
star
17

heat

OpenStack Orchestration (Heat). Mirror of code maintained at opendev.org.
Python
385
star
18

heat-templates

OpenStack Orchestration (Heat) Templates. Mirror of code maintained at opendev.org.
PowerShell
381
star
19

python-novaclient

OpenStack Compute (Nova) Client. Mirror of code maintained at opendev.org.
Python
379
star
20

tempest

OpenStack Testing (Tempest) of an existing cloud. Mirror of code maintained at opendev.org.
Python
349
star
21

taskflow

A library to complete workflows/tasks in HA manner. Mirror of code maintained at opendev.org.
Python
339
star
22

diskimage-builder

Image building tools for OpenStack. Mirror of code maintained at opendev.org.
Shell
331
star
23

python-swiftclient

OpenStack Storage (Swift) Client. Mirror of code maintained at opendev.org.
Python
324
star
24

rally

Rally provides a framework for performance analysis and benchmarking of individual OpenStack components as well as full production OpenStack cloud deployments. Mirror of code maintained at opendev.org.
Python
322
star
25

magnum

Container Infrastructure Management Service for OpenStack. Mirror of code maintained at opendev.org.
Python
319
star
26

python-openstackclient

Client for OpenStack services. Mirror of code maintained at opendev.org.
Python
317
star
27

ceilometer

OpenStack Telemetry (Ceilometer). Mirror of code maintained at opendev.org.
Python
310
star
28

bashate

Code style enforcement for bash programs. Mirror of code maintained at opendev.org.
Python
308
star
29

trove

OpenStack Database As A Service (Trove). Mirror of code maintained at opendev.org.
Python
286
star
30

mistral

Workflow Service for OpenStack. Mirror of code maintained at opendev.org.
Python
246
star
31

hacking

OpenStack Hacking Style Checks. Mirror of code maintained at opendev.org.
Python
233
star
32

barbican

Barbican is a ReST API designed for the secure storage, provisioning and management of secrets, including in OpenStack environments. Mirror of code maintained at opendev.org.
Python
227
star
33

cliff

Command Line Interface Formulation Framework. Mirror of code maintained at opendev.org.
Python
217
star
34

devstack-vagrant

Vagrant configuration for building DevStack environments. Mirror of code maintained at opendev.org.
Shell
214
star
35

pbr

Python Build Reasonableness. Mirror of code maintained at opendev.org.
Python
209
star
36

python-keystoneclient

OpenStack Identity (Keystone) Client. Mirror of code maintained at opendev.org.
Python
199
star
37

stevedore

Manage dynamic plugins for Python applications. Mirror of code maintained at opendev.org.
Python
195
star
38

sahara

Sahara provides a scalable data processing stack and associated management interfaces. Mirror of code maintained at opendev.org.
Python
195
star
39

kuryr

Bridge between container framework networking and storage models to OpenStack networking and storage abstractions. Mirror of code maintained at opendev.org.
Python
191
star
40

python-neutronclient

OpenStack Networking (Neutron) Client. Mirror of code maintained at opendev.org.
Python
164
star
41

tripleo-heat-templates

Heat templates for deploying OpenStack. Mirror of code maintained at opendev.org.
Python
159
star
42

octavia

Load Balancing as a Service (LBaaS) for OpenStack. Mirror of code maintained at opendev.org.
Python
159
star
43

designate

OpenStack DNS As A Service (Designate). Mirror of code maintained at opendev.org.
Python
155
star
44

oslo.messaging

OpenStack library for messaging. Mirror of code maintained at opendev.org.
Python
153
star
45

manila

Shared filesystem management project for OpenStack. Mirror of code maintained at opendev.org.
Python
151
star
46

kuryr-kubernetes

Kubernetes integration with OpenStack networking. Mirror of code maintained at opendev.org.
Python
149
star
47

virtualbmc

A virtual BMC for controlling virtual machines using IPMI commands. Mirror of code maintained at opendev.org.
Python
149
star
48

cloudkitty

Rating service for OpenStack. Mirror of code maintained at opendev.org.
Python
140
star
49

zaqar

OpenStack Messaging (Zaqar). Mirror of code maintained at opendev.org.
Python
134
star
50

openstack-chef-repo

Examples and references to use Chef for OpenStack projects. Mirror of code maintained at opendev.org.
134
star
51

oslo.config

OpenStack library for config. Mirror of code maintained at opendev.org.
Python
134
star
52

yaql

Yet another query language. Mirror of code maintained at opendev.org.
Python
131
star
53

requirements

Global requirements for OpenStack. Mirror of code maintained at opendev.org.
Python
130
star
54

tacker

Tacker: ETSI MANO NFV Orchestrator / VNF Manager. See https://wiki.openstack.org/wiki/Tacker. Mirror of code maintained at opendev.org.
Python
129
star
55

openstack-helm-infra

Repository for OpenStack Helm infrastructure-related code. Mirror of code maintained at opendev.org.
Shell
129
star
56

tripleo-quickstart

Ansible based project for setting up TripleO virtual environments. Mirror of code maintained at opendev.org.
Shell
128
star
57

tooz

Coordinate distributed systems. Mirror of code maintained at opendev.org.
Python
128
star
58

liberasurecode

Erasure Code API library written in C with pluggable Erasure Code backends. Mirror of code maintained at opendev.org.
C
127
star
59

puppet-ceph

Ceph Puppet Module. Mirror of code maintained at opendev.org.
Ruby
120
star
60

project-config

Configuration files for project CI systems. Mirror of code maintained at opendev.org.
Python
112
star
61

murano

Application Catalog for OpenStack. Mirror of code maintained at opendev.org.
Python
109
star
62

python-glanceclient

OpenStack Image Management (Glance) Client. Mirror of code maintained at opendev.org.
Python
109
star
63

ironic-python-agent

A Python agent for provisioning and deprovisioning Bare Metal servers. Mirror of code maintained at opendev.org.
Python
108
star
64

osprofiler

OpenStack cross service/project profiler. Mirror of code maintained at opendev.org.
Python
106
star
65

solum

An OpenStack project designed to make cloud services easier to consume and integrate into your application development process. See: https://wiki.openstack.org/wiki/Solum. Mirror of code maintained at opendev.org.
Python
102
star
66

ec2-api

AWS EC2 and VPC API support in standalone service for OpenStack. Mirror of code maintained at opendev.org.
Python
100
star
67

python-cinderclient

OpenStack Block Storage (Cinder) Client. Mirror of code maintained at opendev.org.
Python
97
star
68

bifrost

Ansible roles and playbooks to enable a standalone Ironic install. Mirror of code maintained at opendev.org.
Python
93
star
69

python-heatclient

OpenStack Orchestration (Heat) Client. Mirror of code maintained at opendev.org.
Python
91
star
70

networking-ovn

DEPRECATED, Neutron integration with OVN. Mirror of code maintained at opendev.org.
90
star
71

monasca-agent

Agent for Monasca. Mirror of code maintained at opendev.org.
Python
88
star
72

tosca-parser

Parser for TOSCA Simple Profile in YAML. Mirror of code maintained at opendev.org.
Python
87
star
73

vitrage

OpenStack RCA (Root Cause Analysis) Engine. Mirror of code maintained at opendev.org.
Python
86
star
74

training-guides

Community created, open source training guides for OpenStack. Mirror of code maintained at opendev.org.
Shell
85
star
75

oslo.db

OpenStack Common DB Code. Mirror of code maintained at opendev.org.
Python
84
star
76

heat-translator

Translate non-heat templates to Heat Orchestration Template. Mirror of code maintained at opendev.org.
Python
84
star
77

monasca-api

Monasca REST API. Mirror of code maintained at opendev.org.
Python
82
star
78

zun

Containers Service for OpenStack. Mirror of code maintained at opendev.org.
Python
82
star
79

shade

Client library for OpenStack containing Infra business logic. Mirror of code maintained at opendev.org.
Python
80
star
80

oslo.utils

OpenStack library utils. Mirror of code maintained at opendev.org.
Python
80
star
81

api-site

OpenStack API site. Mirror of code maintained at opendev.org.
CSS
78
star
82

cookiecutter

Cookiecutter Template for new OpenStack projects. Mirror of code maintained at opendev.org.
Python
77
star
83

tripleo-image-elements

Disk image elements for deployment images of OpenStack. Mirror of code maintained at opendev.org.
Shell
77
star
84

networking-odl

Neutron drivers for OpenDaylight. Mirror of code maintained at opendev.org.
76
star
85

murano-apps

Examples and reference implementation of Murano application packages. Mirror of code maintained at opendev.org.
Shell
75
star
86

openstack-ansible-ops

Operations-related content for OpenStack-Ansible. Mirror of code maintained at opendev.org.
Jinja
72
star
87

governance

OpenStack Technical Committee Decisions. Mirror of code maintained at opendev.org.
Python
72
star
88

xstatic-jsencrypt

JSEncrypt JavaScript library packaged as XStatic. Mirror of code maintained at opendev.org.
JavaScript
72
star
89

puppet-nova

OpenStack Nova Puppet Module. Mirror of code maintained at opendev.org.
Ruby
71
star
90

python-troveclient

OpenStack Database as a Service (Trove) Client. Mirror of code maintained at opendev.org.
Python
70
star
91

puppet-keystone

OpenStack Keystone Puppet Module. Mirror of code maintained at opendev.org.
Ruby
69
star
92

oslo.concurrency

OpenStack library for all concurrency-related code. Mirror of code maintained at opendev.org.
Python
68
star
93

puppet-openstack-integration

Collection of scripts and manifests for module testing. Mirror of code maintained at opendev.org.
Puppet
68
star
94

watcher

Resource optimization service for OpenStack. Mirror of code maintained at opendev.org.
Python
68
star
95

operations-guide

OpenStack Operations Guide. Mirror of code maintained at opendev.org.
68
star
96

nova-specs

OpenStack Compute (Nova) Specifications. Mirror of code maintained at opendev.org.
Python
67
star
97

openstack-doc-tools

Tools used by OpenStack Documentation. Mirror of code maintained at opendev.org.
Python
67
star
98

glance_store

Glance stores library. Mirror of code maintained at opendev.org.
Python
67
star
99

keystonemiddleware

OpenStack Identity (Keystone) Middleware. Mirror of code maintained at opendev.org.
Python
65
star
100

neutron-fwaas

Firewall services for OpenStack Neutron. Mirror of code maintained at opendev.org.
Python
63
star