diff --git a/src/cli/one_helper.rb b/src/cli/one_helper.rb index fba7261906..786fea1756 100644 --- a/src/cli/one_helper.rb +++ b/src/cli/one_helper.rb @@ -68,14 +68,15 @@ EOT } # Command line VM template options + TEMPLATE_NAME_VM={ + :name => 'name', + :large => '--name name', + :description => + 'Name for the new VM', + :format => String + } + TEMPLATE_OPTIONS=[ - { - :name => 'name', - :large => '--name name', - :description => - 'Name for the VM', - :format => String - }, { :name => 'cpu', :large => '--cpu cpu', @@ -134,6 +135,8 @@ EOT } ] + TEMPLATE_OPTIONS_VM=[TEMPLATE_NAME_VM]+TEMPLATE_OPTIONS + OPTIONS = XML, NUMERIC, KILOBYTES class OneHelper diff --git a/src/cli/one_helper/onetemplate_helper.rb b/src/cli/one_helper/onetemplate_helper.rb index 03ec5b683c..82ace6c3be 100644 --- a/src/cli/one_helper/onetemplate_helper.rb +++ b/src/cli/one_helper/onetemplate_helper.rb @@ -18,11 +18,11 @@ require 'one_helper' class OneTemplateHelper < OpenNebulaHelper::OneHelper VM_NAME={ - :name => "vm_name", - :large => "--name vm_name", + :name => "name", + :large => "--name name", :format => String, :description => <<-EOT -Name of the new Virtual Machine. When instantiating +Name of the new VM or TEMPLATE. When instantiating multiple VMs you can use the\"%i\" wildcard to produce different names such as vm-0, vm-1... EOT diff --git a/src/cli/onetemplate b/src/cli/onetemplate index 627bce893c..462613b616 100755 --- a/src/cli/onetemplate +++ b/src/cli/onetemplate @@ -98,7 +98,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do EOT command :create, create_desc, [:file, nil], :options => - OpenNebulaHelper::TEMPLATE_OPTIONS do + [OneTemplateHelper::VM_NAME]+OpenNebulaHelper::TEMPLATE_OPTIONS do if args[0] && OpenNebulaHelper.create_template_options_used?(options) STDERR.puts "You can not use both template file and template"<< @@ -167,7 +167,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do number = options[:multiple] || 1 number.times do |i| exit_code=helper.perform_action(args[0],options,"instantiated") do |t| - name = options[:vm_name] + name = options[:name] name = name.gsub("%i",i.to_s) if name res = t.instantiate(name) diff --git a/src/cli/onevm b/src/cli/onevm index 8a527bbf09..0a866a994c 100755 --- a/src/cli/onevm +++ b/src/cli/onevm @@ -115,7 +115,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do EOT command :create, create_desc, [:file, nil], :options => - [OneVMHelper::MULTIPLE] + OpenNebulaHelper::TEMPLATE_OPTIONS do + [OneVMHelper::MULTIPLE]+OpenNebulaHelper::TEMPLATE_OPTIONS_VM do number = options[:multiple] || 1 exit_code = nil