Skip to content

Commit

Permalink
B OpenNebula#2416: onevcenter tool improvements and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sergio semedi committed Sep 13, 2018
1 parent 1dd5dc6 commit 43f2472
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/cli/one_helper/onevcenter_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 28 additions & 2 deletions src/cli/onevcenter
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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 <host_id>
- listing available images:
onevcenter list -o datastores -h <host_id> -d <ds-img_id>
EOT
command :list, list_desc, :options=>[ OBJECT, HOST, DATASTORE, VCENTER, USER, PASS ] do
begin
args = helper.parse_opts(options)
Expand All @@ -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 <host_id>
- importing 2 concrete templates:
onevcenter import "vm-1252, vm-553, vm-1248" -o templates -h <host_id>
- importing a image range:
onevcenter import 0..10 -o images -h <host_id> -d <ds-img_id>
EOT

command :import, import_desc, [:oid, nil], :options=>[ OBJECT, HOST, DATASTORE ] do
Expand Down Expand Up @@ -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 <vcenter> --vuser <vcenter_user> --vpass <password>
EOT
command :hosts, host_desc, :options=>[ VCENTER, USER, PASS, USE_DEFAULTS ] do
con_ops = helper.connection_options("Hosts", options)
Expand Down

0 comments on commit 43f2472

Please sign in to comment.