0.0
The project is in a healthy, maintained state
This library can be used as a module for fog or as standalone provider
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.1
~> 0.1
~> 2.1
 Project Readme

Fog::OpenNebula

release

OpenNebula OpenNebula

Description

Interaction with OpenNebula is done via the Ruby OpenNebula Cloud API.

Note: This provider is under construction! This means everything that is provided should work without problems, but there are many features not available yet. Please contribute!

Requirements

  • See gemspec for ruby and gem versions
  • User credentials for an XMLRPC endpoint of an OpenNebula instance

Installation

Build the gem from source code

 cd fog-opennebula
 gem build fog-opennebula.gemspec
 version=$(ruby -e 'require "./lib/fog/opennebula/version"; puts Fog::OpenNebula::VERSION')
 gem install fog-opennebula-"$version".gem

Install from rubygems

 gem install fog-opennebula

Usage

General proceeding:

  • connect to OpenNebula xml-rpc
  • create new vm object
  • fetch a template/flavor from OpenNebula (this template should be predefined)
  • assign the flavor/template to the vm
  • change the attributes of this flavor/template (name, cpu, memory, nics....)
  • save/instantiate the vm
require 'fog/opennebula'

con = Fog::Compute.new(
  provider: 'OpenNebula',
  opennebula_username: 'oneadmin',
  opennebula_password: 'password',
  opennebula_endpoint: 'http://localhost:2633/RPC2'
)

# list all vms
con.servers

# list all OpenNebula templates
con.flavors

# get template with id 0
con.flavors.get 0

# list all Virtual Networks
con.networks
con.networks.get 0

# get all usergroups
con.groups

# create a new vm object (creates the object, the vm is not instantiated yet)
newvm = con.servers.new

# set the flavor of the vm
newvm.flavor = con.flavors.get 0

# set the name of the vm
newvm.name = "FooBarVM"

# set the groupid of the vm
newvm.gid = 0

# set cores and memory (MB)
newvm.flavor.vcpu = 2
newvm.flavor.memory = 256

# create a new network interface attached to the network with id 0 and virtio as driver/model
network = con.networks.get(0)
nic = con.interfaces.new({ :vnet => network, :model => "virtio"})

# Attach the new nic to our vm
newvm.flavor.nic = [ nic ]

# instantiate the new vm
newvm.save

Additional Resources