mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-25 23:21:29 +03:00
Feature #1112: Add datastore id to image creation in ruby OCA and CLI
This commit is contained in:
parent
0dfb521b9b
commit
4950f23652
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user