<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hello all<br>
<br>
I'm trying to put together a very simple ruby script that outputs
opennebula's images and its vms<br>
<br>
as far as listing opennebula's images, everything is fine, but I get
an error when trying, for each image, to lists its vms<br>
<br>
acording to the 4.2 API documentation the image class should have a
"vms" list/array member, but I get an error when I try to
instantiate that<br>
<br>
where's the script. The offending statement in red. Any help would
be appreciated<br>
<br>
thanks<br>
joão<br>
<br>
-------------------------- (snatched from openneb examples and then
adapted...)<br>
<div class="moz-text-plain" wrap="true" graphical-quote="true"
style="font-family: -moz-fixed; font-size: 14px;" lang="x-western">
<pre wrap="">#!/usr/bin/env ruby
##############################################################################
# Environment Configuration
##############################################################################
ONE_LOCATION=ENV["ONE_LOCATION"]
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby"
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
end
$: << RUBY_LIB_LOCATION
##############################################################################
# Required libraries
##############################################################################
require 'opennebula'
include OpenNebula
# OpenNebula credentials
CREDENTIALS = "oneadmin:(REMOVED)"
# XML_RPC endpoint where OpenNebula is listening
ENDPOINT = <a class="moz-txt-link-rfc2396E" href="http://localhost:2633/RPC2">"http://localhost:2633/RPC2"</a>
client = Client.new(CREDENTIALS, ENDPOINT)
img_pool = ImagePool.new(client, -1)
rc2 = img_pool.info
if OpenNebula.is_error?(rc2)
puts rc2.message
exit -1
end
img_pool.each do <code class="moz-txt-verticalline"><span class="moz-txt-tag">|</span>img<span class="moz-txt-tag">|</span></code>
puts "img id=#{img.id},#{img.name}"
<font color="#ff0000"> img.vms.each do <code class="moz-txt-verticalline"><span class="moz-txt-tag">|</span>vm<span class="moz-txt-tag">|</span></code>
end</font>
end
</pre>
</div>
<br>
---------------------------<br>
</body>
</html>