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 => “”, :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