diff --git a/src/cli/one_helper/onevcenter_helper.rb b/src/cli/one_helper/onevcenter_helper.rb index 79ace6a2219..0965b2b9393 100644 --- a/src/cli/one_helper/onevcenter_helper.rb +++ b/src/cli/one_helper/onevcenter_helper.rb @@ -120,6 +120,8 @@ def show_header(vcenter_host) # @param type [String] String representing the vCenter resource # def set_object(type) + raise "you need to use -o option!" unless type + type = type.downcase if (type == "datastores") @vobject = VOBJECT::DATASTORE diff --git a/src/cli/onevcenter b/src/cli/onevcenter index a5e1c656ff8..ab03ebeb528 100755 --- a/src/cli/onevcenter +++ b/src/cli/onevcenter @@ -51,7 +51,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do :short => "-o object", :large => "--object object ", :format => String, - :description => "vCenter object" + :description => "vCenter object: [datastores, templates, networks, datastores, images]" } HOST = { @@ -128,8 +128,16 @@ cmd=CommandParser::CmdParser.new(ARGV) do ############################################################################ list_desc = <<-EOT.unindent Show a list with unimported vCenter objects - EOT + Examples: + - listing available templates: + + onevcenter list -o templates -h + + - listing available images: + + onevcenter list -o datastores -h -d + EOT command :list, list_desc, :options=>[ OBJECT, HOST, DATASTORE, VCENTER, USER, PASS ] do begin args = helper.parse_opts(options) @@ -148,6 +156,19 @@ cmd=CommandParser::CmdParser.new(ARGV) do import_desc = <<-EOT.unindent Import the the desired vCenter object + + Examples: + - importing first datastore + + onevcenter list -o templates -h + + - importing 2 concrete templates: + + onevcenter import "vm-1252, vm-553, vm-1248" -o templates -h + + - importing a image range: + + onevcenter import 0..10 -o images -h -d EOT command :import, import_desc, [:oid, nil], :options=>[ OBJECT, HOST, DATASTORE ] do @@ -194,6 +215,11 @@ cmd=CommandParser::CmdParser.new(ARGV) do ############################################################################ host_desc = <<-EOT.unindent Import vCenter clusters as OpenNebula hosts + + Example: + - Get available clusters: + + onevcenter hosts --vcenter --vuser --vpass EOT command :hosts, host_desc, :options=>[ VCENTER, USER, PASS, USE_DEFAULTS ] do con_ops = helper.connection_options("Hosts", options)