Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Simple ruby / xen module

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION
Octocat-spinner-32 xen-ruby.gemspec
README
A simple ruby module to admin xen instances
This gem includes a log mechanism (log4r) with various modes (DEBUG, INFO, WARN ...).


gem install xen-ruby

How to use it :

###########################
# To get instance informations
instance = Xen::Instance.find_by_name(name)

# To get all instaces
puts Xen::Instance.all

###########################
# To start an instance

instance.start(name)

# or
instance = Xen::Instance.find_by_name(name)
instance.start

# or
instance = Xen::Instance.new(name)
instance.start

###########################
# To create a new instance 
# attributes includes {:mem => "", :size => "", :name => "", :ip => "", :vcpus: => "",
# :arch => "", :dist => ""}
# mem   = Memory
# size  = HDD size
# name  = Hostname
# ip    = Ip address
# vcpus = Virtual cpu's
# arch  = System architecture [i386|amd64]
# dist  = distribution [lucid, hardy, etc.]
Xen::Instance.create(attributes)

##########################
# Instance actions
instance = Xen::Instance.find_by_name(name)

# start
instance.start

# stop
instance.shutdown

# reboot
instance.reboot

# pause
instance.pause

# unpause
instance.unpause

# kill
instance.destroy



##################################
Creating & installing the gem :

gem build xen.gemspec
sudo gem install xen-<version>.gem


todo:
- Xen::Instance.create have a small bug (timeout)
- Tests

Something went wrong with that request. Please try again.