opennebula-cli 5.4.15 → 5.5.80.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NOTICE +1 -1
- data/bin/oneacct +3 -3
- data/bin/oneacl +2 -2
- data/bin/onecluster +1 -1
- data/bin/onedatastore +1 -1
- data/bin/oneflow +1 -1
- data/bin/oneflow-template +1 -1
- data/bin/onegroup +1 -1
- data/bin/onehost +1 -1
- data/bin/oneimage +64 -1
- data/bin/onemarket +1 -1
- data/bin/onemarketapp +65 -2
- data/bin/onesecgroup +1 -1
- data/bin/oneshowback +2 -2
- data/bin/onetemplate +66 -3
- data/bin/oneuser +3 -3
- data/bin/onevcenter +95 -86
- data/bin/onevdc +1 -1
- data/bin/onevm +75 -11
- data/bin/onevmgroup +64 -1
- data/bin/onevnet +64 -1
- data/bin/onevrouter +64 -1
- data/bin/onezone +1 -1
- data/lib/cli_helper.rb +1 -1
- data/lib/command_parser.rb +9 -1
- data/lib/one_helper/oneacct_helper.rb +22 -18
- data/lib/one_helper/oneacl_helper.rb +1 -1
- data/lib/one_helper/onecluster_helper.rb +1 -1
- data/lib/one_helper/onedatastore_helper.rb +1 -1
- data/lib/one_helper/onegroup_helper.rb +1 -1
- data/lib/one_helper/onehost_helper.rb +32 -6
- data/lib/one_helper/oneimage_helper.rb +2 -1
- data/lib/one_helper/onemarket_helper.rb +1 -1
- data/lib/one_helper/onemarketapp_helper.rb +2 -1
- data/lib/one_helper/onequota_helper.rb +1 -1
- data/lib/one_helper/onesecgroup_helper.rb +1 -1
- data/lib/one_helper/onetemplate_helper.rb +2 -1
- data/lib/one_helper/oneuser_helper.rb +13 -1
- data/lib/one_helper/onevcenter_helper.rb +425 -0
- data/lib/one_helper/onevdc_helper.rb +5 -5
- data/lib/one_helper/onevm_helper.rb +100 -2
- data/lib/one_helper/onevmgroup_helper.rb +14 -9
- data/lib/one_helper/onevnet_helper.rb +7 -3
- data/lib/one_helper/onevrouter_helper.rb +2 -1
- data/lib/one_helper/onezone_helper.rb +22 -39
- data/lib/one_helper.rb +64 -8
- metadata +7 -6
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
|
3
3
|
# #
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -109,6 +109,7 @@ class OneVirtualRouterHelper < OpenNebulaHelper::OneHelper
|
|
109
109
|
puts str % ["NAME", obj.name]
|
110
110
|
puts str % ["USER", obj['UNAME']]
|
111
111
|
puts str % ["GROUP", obj['GNAME']]
|
112
|
+
puts str % ["LOCK", OpenNebulaHelper.level_lock_to_str(obj['LOCK/LOCKED'])]
|
112
113
|
puts
|
113
114
|
|
114
115
|
CLIHelper.print_header(str_h1 % "PERMISSIONS",false)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
|
3
3
|
# #
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -34,6 +34,20 @@ class OneZoneHelper < OpenNebulaHelper::OneHelper
|
|
34
34
|
:description => "Zone server RPC endpoint"
|
35
35
|
}
|
36
36
|
|
37
|
+
def show_resource(id, options)
|
38
|
+
resource = retrieve_resource(id)
|
39
|
+
|
40
|
+
rc = resource.info_extended
|
41
|
+
return -1, rc.message if OpenNebula.is_error?(rc)
|
42
|
+
|
43
|
+
if options[:xml]
|
44
|
+
return 0, resource.to_xml(true)
|
45
|
+
else
|
46
|
+
format_resource(resource, options)
|
47
|
+
return 0
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
37
51
|
def self.rname
|
38
52
|
"ZONE"
|
39
53
|
end
|
@@ -117,44 +131,6 @@ class OneZoneHelper < OpenNebulaHelper::OneHelper
|
|
117
131
|
zone_hash=zone.to_hash
|
118
132
|
|
119
133
|
if zone.has_elements?("/ZONE/SERVER_POOL/SERVER")
|
120
|
-
servers = zone_hash["ZONE"]["SERVER_POOL"]["SERVER"]
|
121
|
-
|
122
|
-
[servers].flatten.each { |s|
|
123
|
-
endpoint = s["ENDPOINT"]
|
124
|
-
|
125
|
-
next if endpoint.nil?
|
126
|
-
|
127
|
-
options[:timeout] = 5 #5 sec
|
128
|
-
client = OpenNebula::Client.new(nil, endpoint, options)
|
129
|
-
|
130
|
-
xml_doc = client.call("zone.raftstatus")
|
131
|
-
|
132
|
-
if OpenNebula::is_error?(xml_doc)
|
133
|
-
s["STATE"] = "error"
|
134
|
-
s["TERM"] = "-"
|
135
|
-
s["VOTEDFOR"] = "-"
|
136
|
-
s["COMMIT" ] = "-"
|
137
|
-
s["LOG_INDEX"] = "-"
|
138
|
-
|
139
|
-
next
|
140
|
-
end
|
141
|
-
|
142
|
-
xml_doc = Nokogiri::XML(xml_doc)
|
143
|
-
|
144
|
-
s["STATE"] = case xml_doc.root.at_xpath("STATE").text
|
145
|
-
when "0" then "solo"
|
146
|
-
when "1" then "candidate"
|
147
|
-
when "2" then "follower"
|
148
|
-
when "3" then "leader"
|
149
|
-
else "-"
|
150
|
-
end
|
151
|
-
s["TERM"] = xml_doc.root.at_xpath("TERM").text
|
152
|
-
s["VOTEDFOR"] = xml_doc.root.at_xpath("VOTEDFOR").text
|
153
|
-
s["COMMIT"] = xml_doc.root.at_xpath("COMMIT").text
|
154
|
-
|
155
|
-
s["LOG_INDEX"] = xml_doc.root.at_xpath("LOG_INDEX").text
|
156
|
-
s["FEDLOG_INDEX"] = xml_doc.root.at_xpath("FEDLOG_INDEX").text
|
157
|
-
}
|
158
134
|
|
159
135
|
puts
|
160
136
|
CLIHelper.print_header(str_h1 % "ZONE SERVERS",false)
|
@@ -188,6 +164,13 @@ class OneZoneHelper < OpenNebulaHelper::OneHelper
|
|
188
164
|
end
|
189
165
|
|
190
166
|
column :"STATE", "", :left, :size=>10 do |d|
|
167
|
+
d["STATE"] = case d["STATE"]
|
168
|
+
when "0" then "solo"
|
169
|
+
when "1" then "candidate"
|
170
|
+
when "2" then "follower"
|
171
|
+
when "3" then "leader"
|
172
|
+
else "error"
|
173
|
+
end
|
191
174
|
d["STATE"] if !d.nil?
|
192
175
|
end
|
193
176
|
|
data/lib/one_helper.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
|
3
3
|
# #
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -28,7 +28,7 @@ include OpenNebula
|
|
28
28
|
module OpenNebulaHelper
|
29
29
|
ONE_VERSION=<<-EOT
|
30
30
|
OpenNebula #{OpenNebula::VERSION}
|
31
|
-
Copyright 2002-
|
31
|
+
Copyright 2002-2018, OpenNebula Project, OpenNebula Systems
|
32
32
|
|
33
33
|
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
34
34
|
not use this file except in compliance with the License. You may obtain
|
@@ -38,9 +38,11 @@ EOT
|
|
38
38
|
if ONE_LOCATION
|
39
39
|
TABLE_CONF_PATH=ONE_LOCATION+"/etc/cli"
|
40
40
|
VAR_LOCATION=ONE_LOCATION+"/var" if !defined?(VAR_LOCATION)
|
41
|
+
CLI_ADDONS_LOCATION=ONE_LOCATION+"/lib/ruby/cli/addons"
|
41
42
|
else
|
42
43
|
TABLE_CONF_PATH="/etc/one/cli"
|
43
44
|
VAR_LOCATION="/var/lib/one" if !defined?(VAR_LOCATION)
|
45
|
+
CLI_ADDONS_LOCATION="/usr/lib/one/ruby/cli/addons"
|
44
46
|
end
|
45
47
|
|
46
48
|
EDITOR_PATH='/usr/bin/vi'
|
@@ -361,6 +363,18 @@ EOT
|
|
361
363
|
:format => String,
|
362
364
|
:description => "In a vCenter environment sets the the VMs and Template folder where the VM will be placed in." \
|
363
365
|
" The path uses slashes to separate folders. For example: --vcenter_vm_folder \"/Management/VMs\""
|
366
|
+
},
|
367
|
+
{
|
368
|
+
:name => 'as_uid',
|
369
|
+
:large => '--as_uid uid',
|
370
|
+
:format => Integer,
|
371
|
+
:description => 'The User ID to instantiate the VM'
|
372
|
+
},
|
373
|
+
{
|
374
|
+
:name => 'as_gid',
|
375
|
+
:large => '--as_gid gid',
|
376
|
+
:format => Integer,
|
377
|
+
:description => 'The Group ID to instantiate the VM'
|
364
378
|
}
|
365
379
|
]
|
366
380
|
|
@@ -745,8 +759,12 @@ EOT
|
|
745
759
|
|
746
760
|
rc = pool.info
|
747
761
|
if OpenNebula.is_error?(rc)
|
748
|
-
|
762
|
+
if rc.message.empty?
|
763
|
+
return -1, "OpenNebula #{self.class.rname} name not " <<
|
749
764
|
"found, use the ID instead"
|
765
|
+
else
|
766
|
+
return -1,rc.message
|
767
|
+
end
|
750
768
|
end
|
751
769
|
|
752
770
|
return 0, pool
|
@@ -782,13 +800,15 @@ EOT
|
|
782
800
|
end
|
783
801
|
|
784
802
|
def OpenNebulaHelper.size_in_mb(size)
|
785
|
-
m = size.match(/^(\d+(?:\.\d+)?)(m|mb|g|gb)?$/i)
|
803
|
+
m = size.match(/^(\d+(?:\.\d+)?)(t|tb|m|mb|g|gb)?$/i)
|
786
804
|
|
787
805
|
if !m
|
788
806
|
# return OpenNebula::Error.new('Size value malformed')
|
789
807
|
return -1, 'Size value malformed'
|
790
808
|
else
|
791
809
|
multiplier=case m[2]
|
810
|
+
when /(t|tb)/i
|
811
|
+
1024*1024
|
792
812
|
when /(g|gb)/i
|
793
813
|
1024
|
794
814
|
else
|
@@ -814,15 +834,31 @@ EOT
|
|
814
834
|
end
|
815
835
|
end
|
816
836
|
|
817
|
-
def OpenNebulaHelper.time_to_str(time, print_seconds=true)
|
837
|
+
def OpenNebulaHelper.time_to_str(time, print_seconds=true, print_hours=true, print_years=false)
|
818
838
|
value=time.to_i
|
819
839
|
if value==0
|
820
840
|
value='-'
|
821
841
|
else
|
822
|
-
if
|
823
|
-
|
842
|
+
if print_hours
|
843
|
+
if print_seconds
|
844
|
+
if print_years
|
845
|
+
value=Time.at(value).strftime("%m/%d/%y %H:%M:%S")
|
846
|
+
else
|
847
|
+
value=Time.at(value).strftime("%m/%d %H:%M:%S")
|
848
|
+
end
|
849
|
+
else
|
850
|
+
if print_years
|
851
|
+
value=Time.at(value).strftime("%m/%d/%y %H:%M")
|
852
|
+
else
|
853
|
+
value=Time.at(value).strftime("%m/%d %H:%M")
|
854
|
+
end
|
855
|
+
end
|
824
856
|
else
|
825
|
-
|
857
|
+
if print_years
|
858
|
+
value=Time.at(value).strftime("%m/%d/%y")
|
859
|
+
else
|
860
|
+
value=Time.at(value).strftime("%m/%d")
|
861
|
+
end
|
826
862
|
end
|
827
863
|
end
|
828
864
|
|
@@ -1098,6 +1134,9 @@ EOT
|
|
1098
1134
|
template<<"MEMORY=#{options[:memory]}\n" if options[:memory]
|
1099
1135
|
template<<"#{options[:raw]}\n" if options[:raw]
|
1100
1136
|
|
1137
|
+
template<<"AS_UID=#{options[:as_uid]}\n" if options[:as_uid]
|
1138
|
+
template<<"AS_GID=#{options[:as_gid]}\n" if options[:as_gid]
|
1139
|
+
|
1101
1140
|
if options[:disk]
|
1102
1141
|
res=create_disk_net(options[:disk], 'DISK', 'IMAGE')
|
1103
1142
|
return res if res.first!=0
|
@@ -1267,4 +1306,21 @@ EOT
|
|
1267
1306
|
return OpenNebula::Error.new("Remote server error: #{error_message}")
|
1268
1307
|
end
|
1269
1308
|
end
|
1309
|
+
|
1310
|
+
def OpenNebulaHelper.level_lock_to_str(str)
|
1311
|
+
level = str.to_i
|
1312
|
+
if level == 0
|
1313
|
+
"None"
|
1314
|
+
elsif level == 1
|
1315
|
+
"Use"
|
1316
|
+
elsif level == 2
|
1317
|
+
"Manage"
|
1318
|
+
elsif level == 3
|
1319
|
+
"Admin"
|
1320
|
+
elsif level == 4
|
1321
|
+
"All"
|
1322
|
+
else
|
1323
|
+
"-"
|
1324
|
+
end
|
1325
|
+
end
|
1270
1326
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opennebula-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.5.80.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenNebula
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opennebula
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.
|
19
|
+
version: 5.5.80.pre
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.
|
26
|
+
version: 5.5.80.pre
|
27
27
|
description: Commands used to talk to OpenNebula
|
28
28
|
email: contact@opennebula.org
|
29
29
|
executables:
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- lib/one_helper/onesecgroup_helper.rb
|
91
91
|
- lib/one_helper/onetemplate_helper.rb
|
92
92
|
- lib/one_helper/oneuser_helper.rb
|
93
|
+
- lib/one_helper/onevcenter_helper.rb
|
93
94
|
- lib/one_helper/onevdc_helper.rb
|
94
95
|
- lib/one_helper/onevm_helper.rb
|
95
96
|
- lib/one_helper/onevmgroup_helper.rb
|
@@ -113,9 +114,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
114
|
version: '0'
|
114
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
116
|
requirements:
|
116
|
-
- - '
|
117
|
+
- - '>'
|
117
118
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
119
|
+
version: 1.3.1
|
119
120
|
requirements: []
|
120
121
|
rubyforge_project:
|
121
122
|
rubygems_version: 2.0.14.1
|