feature #1640: add --dry option to oneimage

This commit is contained in:
Javi Fontan committed 2012-11-20 14:40:09 +01:00
1 parent 8d3c79334f
commit 69d12194ea
3 files changed
+16 -9

No files matched your search

+7 -6
View File
@@ -76,6 +76,12 @@ EOT
:format => String
}
DRY={
:name => 'dry',
:large => '--dry',
:description => 'Just print the template'
}
CLIENT_OPTIONS=[
{
:name => 'user',
@@ -194,15 +200,10 @@ EOT
:large => '--boot device',
:description => 'Select boot device (hd|fd|cdrom|network)',
:format => String
},
{
:name => 'dry',
:large => '--dry',
:description => 'Just print the template'
}
]
TEMPLATE_OPTIONS_VM=[TEMPLATE_NAME_VM]+TEMPLATE_OPTIONS
TEMPLATE_OPTIONS_VM=[TEMPLATE_NAME_VM]+TEMPLATE_OPTIONS+[DRY]
OPTIONS = XML, NUMERIC, KILOBYTES
+3 -2
View File
@@ -161,7 +161,8 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
[0, o]
end
end
}
},
OpenNebulaHelper::DRY
]
def self.rname
@@ -322,7 +323,7 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
end
template=create_image_variables(
options, template_options-[:persistent])
options, template_options-[:persistent, :dry])
template<<"PERSISTENT=YES\n" if options[:persistent]
+6 -1
View File
@@ -107,7 +107,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
command :create, create_desc, [:file, nil], :options=>CREATE_OPTIONS +
OneImageHelper::TEMPLATE_OPTIONS do
if options[:datastore].nil?
if options[:datastore].nil? && !options[:dry]
STDERR.puts "Datastore to save the image is mandatory: "
STDERR.puts "\t -d datastore_id"
exit -1
@@ -134,6 +134,11 @@ cmd=CommandParser::CmdParser.new(ARGV) do
template = res.last
end
if options[:dry]
puts template
exit 0
end
image.allocate(template, options[:datastore])
rescue => e
STDERR.puts e.messsage