Code Monkey home page Code Monkey logo

addon-pyone's Introduction

PyONE: Open Nebula Python Bindings

Description

PyOne is an implementation of Open Nebula XML-RPC bindings in Python.

The main goals of this library are completeness and maintainability.

Proxies and generators have been used whenever possible to minimize the impact of API updates, ensuring that the distributed xsd files are the only update required when new API versions are released.

This library is meant to be used together with OpenNebula API documentation:

The XML-RPC API must be used to know which calls to make.

Development

To contribute enhancements or fixes use GitHub tools: Pull requests and issues. Please note that by contributing to this project you accept that your contributions are under the Apache License 2.0, just like the rest of this project. Please take some time to read and understand the license terms and ensure that you are happy with it.

Authors

Compatibility

  • PyONE is compatible with OpenNebula v5.4
  • It should be easy to backport PyOne to any OpenNebula version with XML-RPC API that includes XML Schema Definition (XSD) files.

Requirements

  • Connectivity and Credentials to OpenNebula XML-RPC Server.

Installation

PyONE is distributed as a python package, it can be installed as:

pip install pyone

Configuration

You can configure your XML-RPC Server endpoint and credentials in the constructor:

import pyone
one = pyone.OneServer("http://one/RPC2", session="oneadmin:onepass" )

If you are connecting to a test platform with a self signed certificate you can disable certificate verification as:

import pyone
import ssl
one = pyone.OneServer("http://one/RPC2", session="oneadmin:onepass", context=ssl._create_unverified_context() )

It is also possible to modify the default connection timeout, but note that the setting will modify the TCP socket default timeout of your Python VM, ensure that the chosen timeout is suitable to any other connections runing in your project.

Usage

Making Calls

Calls match the API documentation provided by Open Nebula:

import pyone

one = pyone.OneServer("http://one/RPC2", session="oneadmin:onepass" )
hostpool = one.hostpool.info()
host = hostpool.HOST[0]
id = host.ID

Note that the session parameter is automatically included as well as the "one." prefix to the method.

Returned Objects

The returned types have been generated with PyXB and closely match the XSD specification. You can use the XSD specification as primary documentation while your IDE will offer code completion as you code or debug.

marketpool = one.marketpool.info()
m0 = marketpool.MARKETPLACE[0]
print "Markeplace name is " + m0.NAME

Structured Parameters

When making calls, the library will translate flat dictionaries into attribute=value vectors. Such as:

one.host.update(0,  {"LABELS": "HD"}, 1)

When the provided dictionary has a "root" dictionary, it is considered to be root element and it will be translated to XML:

one.vm.update(1,
  {
    'TEMPLATE': {
      'NAME': 'abc',
      'MEMORY': '1024',
      'ATT1': 'value1'
    }
  }, 1)

Building from Source

Note that a Makefile is provided to generate the python bindings

References

PyONE started as part of the Privazio project.

Privazio is a private cloud for residential users, startups or workgroups with a special focus on privacy.

PyONE is meant to be a key component to implement an Ansible module for managing Open Nebula.

License

PyONE is licensed under Apache License 2.0

addon-pyone's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.