diff --git a/src/cli/one_helper.rb b/src/cli/one_helper.rb index e900a963bc..3785668a0c 100644 --- a/src/cli/one_helper.rb +++ b/src/cli/one_helper.rb @@ -329,9 +329,10 @@ EOT client = OpenNebula::Client.new pool = case poolname - when "HOST" then OpenNebula::HostPool.new(client) - when "GROUP" then OpenNebula::GroupPool.new(client) - when "USER" then OpenNebula::UserPool.new(client) + when "HOST" then OpenNebula::HostPool.new(client) + when "GROUP" then OpenNebula::GroupPool.new(client) + when "USER" then OpenNebula::UserPool.new(client) + when "DATASTORE" then OpenNebula::DatastorePool.new(client) end rc = pool.info diff --git a/src/cli/oneimage b/src/cli/oneimage index 4647ec1319..bb8635f5db 100755 --- a/src/cli/oneimage +++ b/src/cli/oneimage @@ -56,6 +56,10 @@ cmd=CommandParser::CmdParser.new(ARGV) do OpenNebulaHelper.rname_to_id(arg, "USER") end + set :format, :datastoreid, OpenNebulaHelper.rname_to_id_desc("DATASTORE") do |arg| + OpenNebulaHelper.rname_to_id(arg, "DATASTORE") + end + set :format, :imageid, OneImageHelper.to_id_desc do |arg| helper.to_id(arg) end @@ -76,10 +80,10 @@ cmd=CommandParser::CmdParser.new(ARGV) do Creates a new Image from the given template file EOT - command :create, create_desc, :file do + command :create, create_desc, :file, :datastoreid do helper.create_resource(options) do |image| template=File.read(args[0]) - image.allocate(template) + image.allocate(template, args[1]) end end diff --git a/src/oca/ruby/OpenNebula/Image.rb b/src/oca/ruby/OpenNebula/Image.rb index 348b4c4df1..878115ef3d 100644 --- a/src/oca/ruby/OpenNebula/Image.rb +++ b/src/oca/ruby/OpenNebula/Image.rb @@ -91,9 +91,13 @@ module OpenNebula # Allocates a new Image in OpenNebula # - # +description+ A string containing the template of the Image. - def allocate(description) - super(IMAGE_METHODS[:allocate],description) + # @param description [String] A string containing the template of the Image. + # @param ds_id [Integer] the target datastore ID + # + # @return [nil, OpenNebula::Error] nil in case of success, Error + # otherwise + def allocate(description, ds_id) + super(IMAGE_METHODS[:allocate],description, ds_id) end # Replaces the template contents