opennebula-cli 6.4.0.1 → 6.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/oneacct +1 -1
- data/bin/oneacl +1 -1
- data/bin/onecluster +1 -1
- data/bin/onedatastore +2 -2
- data/bin/oneflow +2 -2
- data/bin/oneflow-template +2 -3
- data/bin/onegroup +1 -1
- data/bin/onehook +1 -1
- data/bin/onehost +1 -1
- data/bin/oneimage +2 -2
- data/bin/oneirb +1 -1
- data/bin/onelog +82 -13
- data/bin/onemarket +2 -2
- data/bin/onemarketapp +2 -2
- data/bin/onesecgroup +2 -2
- data/bin/oneshowback +1 -1
- data/bin/onetemplate +45 -11
- data/bin/oneuser +1 -1
- data/bin/onevcenter +38 -3
- data/bin/onevdc +1 -1
- data/bin/onevm +9 -3
- data/bin/onevmgroup +2 -2
- data/bin/onevnet +2 -2
- data/bin/onevntemplate +42 -7
- data/bin/onevrouter +2 -2
- data/bin/onezone +1 -1
- data/lib/cli_helper.rb +1 -1
- data/lib/command_parser.rb +1 -1
- data/lib/one_helper/oneacct_helper.rb +1 -1
- 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/oneflow_helper.rb +1 -1
- data/lib/one_helper/oneflowtemplate_helper.rb +1 -1
- data/lib/one_helper/onegroup_helper.rb +1 -1
- data/lib/one_helper/onehook_helper.rb +1 -1
- data/lib/one_helper/onehost_helper.rb +1 -1
- data/lib/one_helper/oneimage_helper.rb +1 -1
- data/lib/one_helper/onemarket_helper.rb +1 -1
- data/lib/one_helper/onemarketapp_helper.rb +1 -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 +1 -1
- data/lib/one_helper/oneuser_helper.rb +1 -1
- data/lib/one_helper/onevcenter_helper.rb +1 -56
- data/lib/one_helper/onevdc_helper.rb +1 -1
- data/lib/one_helper/onevm_helper.rb +2 -2
- data/lib/one_helper/onevmgroup_helper.rb +1 -1
- data/lib/one_helper/onevnet_helper.rb +1 -1
- data/lib/one_helper/onevntemplate_helper.rb +1 -1
- data/lib/one_helper/onevrouter_helper.rb +1 -1
- data/lib/one_helper/onezone_helper.rb +1 -1
- data/lib/one_helper.rb +53 -5
- data/share/schemas/xsd/host.xsd +2 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 003723be19ffff60bc9f577b306af83be5168c39be3be02913e3536c4b3abec8
|
4
|
+
data.tar.gz: 2c45d3c203e8efb33e3a446a8b36dc17d538ad528d79f4abe08e17cccf72374b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db8fce550c33714a7752f157bf8fb4ee75fb8c5ab30f4d195d3ed248f75e770f6ce96b9f87f4efd086cd051a5f92b711619dc0fd4909c8ee4494a3e67da364e6
|
7
|
+
data.tar.gz: da31372a0c1b47c0d6d85d27bb840c9a20ae3424306ed1d4580fb7aab1f1b4acbb1d8123dd45d15d9a9f4a65429c7dc66a841d8dfe0bc76dfdaac4f99f1a8244
|
data/bin/oneacct
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/oneacl
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onecluster
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onedatastore
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -158,7 +158,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
158
158
|
|
159
159
|
command :chmod, chmod_desc, [:range, :datastoreid_list], :octet do
|
160
160
|
helper.perform_actions(args[0], options, 'Permissions changed') do |obj|
|
161
|
-
obj.chmod_octet(args[1])
|
161
|
+
obj.chmod_octet(OpenNebulaHelper.to_octet(args[1]))
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
data/bin/oneflow
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -285,7 +285,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
285
285
|
|
286
286
|
Service.perform_actions(args[0]) do |service_id|
|
287
287
|
params = {}
|
288
|
-
params['octet'] = args[1]
|
288
|
+
params['octet'] = OpenNebulaHelper.to_octet(args[1])
|
289
289
|
|
290
290
|
json = Service.build_json_action('chmod', params)
|
291
291
|
|
data/bin/oneflow-template
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -59,7 +59,6 @@ require 'tempfile'
|
|
59
59
|
|
60
60
|
require 'command_parser'
|
61
61
|
require 'opennebula/oneflow_client'
|
62
|
-
require 'models'
|
63
62
|
require 'cli_helper'
|
64
63
|
require 'one_helper/oneflowtemplate_helper'
|
65
64
|
|
@@ -346,7 +345,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
346
345
|
|
347
346
|
Service.perform_actions(args[0]) do |service_id|
|
348
347
|
params = {}
|
349
|
-
params['octet'] = args[1]
|
348
|
+
params['octet'] = OpenNebulaHelper.to_octet(args[1])
|
350
349
|
|
351
350
|
json = Service.build_json_action('chmod', params)
|
352
351
|
|
data/bin/onegroup
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onehook
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onehost
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/oneimage
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -363,7 +363,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
363
363
|
command :chmod, chmod_desc, [:range, :imageid_list], :octet do
|
364
364
|
helper.perform_actions(args[0], options,
|
365
365
|
'Permissions changed') do |image|
|
366
|
-
image.chmod_octet(args[1])
|
366
|
+
image.chmod_octet(OpenNebulaHelper.to_octet(args[1]))
|
367
367
|
end
|
368
368
|
end
|
369
369
|
|
data/bin/oneirb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onelog
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -20,10 +20,32 @@ ONE_LOCATION = ENV['ONE_LOCATION']
|
|
20
20
|
|
21
21
|
if !ONE_LOCATION
|
22
22
|
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
|
23
|
+
GEMS_LOCATION = '/usr/share/one/gems'
|
23
24
|
else
|
24
25
|
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
|
26
|
+
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
25
27
|
end
|
26
28
|
|
29
|
+
# %%RUBYGEMS_SETUP_BEGIN%%
|
30
|
+
if File.directory?(GEMS_LOCATION)
|
31
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
32
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
33
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
34
|
+
|
35
|
+
# Suppress warnings from Rubygems
|
36
|
+
# https://github.com/OpenNebula/one/issues/5379
|
37
|
+
begin
|
38
|
+
verb = $VERBOSE
|
39
|
+
$VERBOSE = nil
|
40
|
+
require 'rubygems'
|
41
|
+
Gem.use_paths(real_gems_path)
|
42
|
+
ensure
|
43
|
+
$VERBOSE = verb
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
# %%RUBYGEMS_SETUP_END%%
|
48
|
+
|
27
49
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
28
50
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
29
51
|
|
@@ -33,13 +55,13 @@ DEFAULT_PAGER = 'less'
|
|
33
55
|
# List of OpenNebula services and the logs files
|
34
56
|
SERVICES = {
|
35
57
|
'fireedge' => { :log => 'fireedge.log', :error => 'fireedge.error' },
|
36
|
-
'monitor' => 'monitor.log',
|
37
|
-
'novnc' => 'novnc.log',
|
38
|
-
'oned' => 'oned.log',
|
58
|
+
'monitor' => { :log => 'monitor.log' },
|
59
|
+
'novnc' => { :log => 'novnc.log' },
|
60
|
+
'oned' => { :log => 'oned.log' },
|
39
61
|
'onehem' => { :log => 'onehem.log', :error => 'onehem.error' },
|
40
|
-
'sched' => 'sched.log',
|
62
|
+
'sched' => { :log => 'sched.log' },
|
41
63
|
'sunstone' => { :log => 'sunstone.log', :error => 'sunstone.error' },
|
42
|
-
'vcenter' => 'vcenter_monitor.log'
|
64
|
+
'vcenter' => { :log => 'vcenter_monitor.log' }
|
43
65
|
}
|
44
66
|
|
45
67
|
require 'command_parser'
|
@@ -77,25 +99,72 @@ CommandParser::CmdParser.new(ARGV) do
|
|
77
99
|
EOT
|
78
100
|
|
79
101
|
command :get, get_desc, :service, :options => [TYPE, PAGER, PAGER_OPTS] do
|
80
|
-
|
102
|
+
logs = SERVICES[args[0]]
|
103
|
+
pager = options[:pager] || DEFAULT_PAGER
|
104
|
+
|
105
|
+
unless logs
|
81
106
|
STDERR.puts "Service '#{args[0]}' not found"
|
82
107
|
exit 1
|
83
108
|
end
|
84
109
|
|
85
|
-
if options[:type] && !
|
110
|
+
if options[:type] && !logs[options[:type].to_sym]
|
86
111
|
STDERR.puts "Log file type '#{options[:type]}' not found"
|
87
112
|
exit 1
|
88
113
|
end
|
89
114
|
|
90
|
-
|
91
|
-
|
115
|
+
options[:type].nil? ? f = logs[:log] : f = logs[options[:type].to_sym]
|
116
|
+
|
117
|
+
system("#{pager} #{options[:pager_opts]} /var/log/one/#{f}")
|
118
|
+
end
|
119
|
+
|
120
|
+
vm_desc = <<-EOT.unindent
|
121
|
+
Gets VM log
|
122
|
+
EOT
|
123
|
+
|
124
|
+
command :'get-vm', vm_desc, :id, :options => [PAGER, PAGER_OPTS] do
|
125
|
+
pager = options[:pager] || DEFAULT_PAGER
|
126
|
+
|
127
|
+
begin
|
128
|
+
Integer(args[0])
|
129
|
+
|
130
|
+
file = "/var/log/one/#{args[0]}.log"
|
131
|
+
|
132
|
+
unless File.exist?(file)
|
133
|
+
STDERR.puts "No LOG file found for '#{args[0]}' VM"
|
134
|
+
exit 1
|
135
|
+
end
|
136
|
+
|
137
|
+
system("#{pager} #{options[:pager_opts]} #{file}")
|
138
|
+
rescue StandardError
|
139
|
+
STDERR.puts 'Only ID is supported'
|
140
|
+
exit 1
|
92
141
|
end
|
142
|
+
end
|
93
143
|
|
94
|
-
|
144
|
+
service_desc = <<-EOT.unindent
|
145
|
+
Gets Service log
|
146
|
+
EOT
|
147
|
+
|
148
|
+
command :'get-service',
|
149
|
+
service_desc,
|
150
|
+
:id,
|
151
|
+
:options => [PAGER, PAGER_OPTS] do
|
95
152
|
pager = options[:pager] || DEFAULT_PAGER
|
96
153
|
|
97
|
-
|
154
|
+
begin
|
155
|
+
Integer(args[0])
|
156
|
+
|
157
|
+
file = "/var/log/one/oneflow/#{args[0]}.log"
|
98
158
|
|
99
|
-
|
159
|
+
unless File.exist?(file)
|
160
|
+
STDERR.puts "No LOG file found for '#{args[0]}' service"
|
161
|
+
exit 1
|
162
|
+
end
|
163
|
+
|
164
|
+
system("#{pager} #{options[:pager_opts]} #{file}")
|
165
|
+
rescue StandardError
|
166
|
+
STDERR.puts 'Only ID is supported'
|
167
|
+
exit 1
|
168
|
+
end
|
100
169
|
end
|
101
170
|
end
|
data/bin/onemarket
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -151,7 +151,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
151
151
|
|
152
152
|
command :chmod, chmod_desc, [:range, :marketplaceid_list], :octet do
|
153
153
|
helper.perform_actions(args[0], options, 'Permissions changed') do |obj|
|
154
|
-
obj.chmod_octet(args[1])
|
154
|
+
obj.chmod_octet(OpenNebulaHelper.to_octet(args[1]))
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
data/bin/onemarketapp
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -388,7 +388,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
388
388
|
|
389
389
|
command :chmod, chmod_desc, [:range, :appid_list], :octet do
|
390
390
|
helper.perform_actions(args[0], options, 'Permissions changed') do |app|
|
391
|
-
app.chmod_octet(args[1])
|
391
|
+
app.chmod_octet(OpenNebulaHelper.to_octet(args[1]))
|
392
392
|
end
|
393
393
|
end
|
394
394
|
|
data/bin/onesecgroup
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -174,7 +174,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
174
174
|
|
175
175
|
command :chmod, chmod_desc, [:range, :secgroupid_list], :octet do
|
176
176
|
helper.perform_actions(args[0], options, 'Permissions changed') do |t|
|
177
|
-
t.chmod_octet(args[1])
|
177
|
+
t.chmod_octet(OpenNebulaHelper.to_octet(args[1]))
|
178
178
|
end
|
179
179
|
end
|
180
180
|
|
data/bin/oneshowback
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onetemplate
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -87,6 +87,14 @@ CommandParser::CmdParser.new(ARGV) do
|
|
87
87
|
:description => 'lock all actions'
|
88
88
|
}
|
89
89
|
|
90
|
+
PREFIX = {
|
91
|
+
:name => 'prefix',
|
92
|
+
:large => '--prefix prefix',
|
93
|
+
:description => 'Prefix to autogenerate name, e.g: 001, 01',
|
94
|
+
:format => String
|
95
|
+
|
96
|
+
}
|
97
|
+
|
90
98
|
########################################################################
|
91
99
|
# Global Options
|
92
100
|
########################################################################
|
@@ -102,7 +110,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
102
110
|
OneTemplateHelper::MULTIPLE,
|
103
111
|
OneTemplateHelper::USERDATA,
|
104
112
|
OneVMHelper::HOLD,
|
105
|
-
OneTemplateHelper::PERSISTENT
|
113
|
+
OneTemplateHelper::PERSISTENT,
|
114
|
+
PREFIX
|
106
115
|
]
|
107
116
|
|
108
117
|
########################################################################
|
@@ -252,16 +261,37 @@ CommandParser::CmdParser.new(ARGV) do
|
|
252
261
|
number = options[:multiple] || 1
|
253
262
|
user_inputs = options[:user_inputs]
|
254
263
|
|
255
|
-
number.times do |i|
|
256
|
-
exit_code = helper.perform_action(
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
264
|
+
number.times.each_with_index do |i, index|
|
265
|
+
exit_code = helper.perform_action(
|
266
|
+
args[0],
|
267
|
+
options,
|
268
|
+
'instantiated'
|
269
|
+
) do |t|
|
270
|
+
name = options[:name]
|
271
|
+
prefix = options[:prefix]
|
272
|
+
c_i = nil
|
273
|
+
p = nil
|
274
|
+
|
275
|
+
if prefix && name
|
276
|
+
# Get leading zeros
|
277
|
+
p = prefix.scan(/^0+/)[0]
|
278
|
+
|
279
|
+
# Get current index
|
280
|
+
c_i = prefix.gsub(p, '') if p
|
281
|
+
|
282
|
+
# Convert it to Integer to check if we can use it
|
283
|
+
begin
|
284
|
+
c_i = Integer(c_i)
|
285
|
+
name = name.gsub('%i', "#{p}#{c_i + index}")
|
286
|
+
rescue StandardError
|
287
|
+
end
|
288
|
+
elsif name
|
289
|
+
name = name.gsub('%i', i.to_s)
|
290
|
+
end
|
262
291
|
|
292
|
+
on_hold = !options[:hold].nil?
|
263
293
|
extra_template = ''
|
264
|
-
rc
|
294
|
+
rc = t.info
|
265
295
|
|
266
296
|
if OpenNebula.is_error?(rc)
|
267
297
|
STDERR.puts rc.message
|
@@ -281,6 +311,10 @@ CommandParser::CmdParser.new(ARGV) do
|
|
281
311
|
extra_template = res.last
|
282
312
|
end
|
283
313
|
|
314
|
+
if c_i
|
315
|
+
extra_template.gsub!('%i', "#{p}#{c_i + index}")
|
316
|
+
end
|
317
|
+
|
284
318
|
if !user_inputs
|
285
319
|
user_inputs = OneTemplateHelper.get_user_inputs(t.to_hash)
|
286
320
|
else
|
@@ -344,7 +378,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
344
378
|
recursive = (options[:recursive] == true)
|
345
379
|
|
346
380
|
helper.perform_actions(args[0], options, 'Permissions changed') do |t|
|
347
|
-
t.chmod_octet(args[1], recursive)
|
381
|
+
t.chmod_octet(OpenNebulaHelper.to_octet(args[1]), recursive)
|
348
382
|
end
|
349
383
|
end
|
350
384
|
|
data/bin/oneuser
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onevcenter
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -409,7 +409,42 @@ CommandParser::CmdParser.new(ARGV) do
|
|
409
409
|
|
410
410
|
begin
|
411
411
|
print '.'
|
412
|
-
|
412
|
+
|
413
|
+
client = Client.new
|
414
|
+
|
415
|
+
vm_pool = VirtualMachinePool.new(client, -1)
|
416
|
+
host_pool = HostPool.new(client)
|
417
|
+
deploy_id = -1
|
418
|
+
host_id = -1
|
419
|
+
hostname = ''
|
420
|
+
|
421
|
+
rc = vm_pool.info
|
422
|
+
raise rc.message if OpenNebula.is_error?(rc)
|
423
|
+
|
424
|
+
rc = host_pool.info
|
425
|
+
raise rc.message if OpenNebula.is_error?(rc)
|
426
|
+
|
427
|
+
vm_pool.each do |vm|
|
428
|
+
next if vm.id.to_s != vmid
|
429
|
+
|
430
|
+
deploy_id = vm.deploy_id
|
431
|
+
vm_history = vm.to_hash['VM']['HISTORY_RECORDS']['HISTORY']
|
432
|
+
hostname = vm_history['HOSTNAME']
|
433
|
+
break
|
434
|
+
end
|
435
|
+
|
436
|
+
host_pool.each do |host|
|
437
|
+
if host.name == hostname
|
438
|
+
host_id = host.id
|
439
|
+
end
|
440
|
+
end
|
441
|
+
|
442
|
+
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
|
443
|
+
vm = VCenterDriver::VirtualMachine
|
444
|
+
.new(vi_client, deploy_id, vmid)
|
445
|
+
|
446
|
+
keys = vm.extra_config_keys
|
447
|
+
|
413
448
|
print '.'
|
414
449
|
|
415
450
|
if keys.empty?
|
@@ -422,7 +457,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
422
457
|
puts 'The following keys will be removed:'
|
423
458
|
keys.each {|key| puts "\t- #{key}" }
|
424
459
|
|
425
|
-
|
460
|
+
vm.clear_tags
|
426
461
|
rescue StandardError => e
|
427
462
|
STDERR.puts "Couldn't clear VM tags. Reason: #{e.message}"
|
428
463
|
exit 1
|
data/bin/onevdc
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onevm
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -472,7 +472,13 @@ CommandParser::CmdParser.new(ARGV) do
|
|
472
472
|
verbose = "disk #{disk_id} prepared to be saved in " \
|
473
473
|
"the image #{image_name}"
|
474
474
|
else
|
475
|
-
snapshot_id =
|
475
|
+
err, snapshot_id = helper.retrieve_disk_snapshot_id(args[0],
|
476
|
+
snapshot_id)
|
477
|
+
|
478
|
+
if err == -1
|
479
|
+
STDERR.puts snapshot_id
|
480
|
+
exit(-1)
|
481
|
+
end
|
476
482
|
|
477
483
|
verbose = "disk #{disk_id} snapshot #{snapshot_id} prepared to " \
|
478
484
|
"be saved in the image #{image_name}"
|
@@ -981,7 +987,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
981
987
|
|
982
988
|
command :chmod, chmod_desc, [:range, :vmid_list], :octet do
|
983
989
|
helper.perform_actions(args[0], options, 'Permissions changed') do |vm|
|
984
|
-
vm.chmod_octet(args[1])
|
990
|
+
vm.chmod_octet(OpenNebulaHelper.to_octet(args[1]))
|
985
991
|
end
|
986
992
|
end
|
987
993
|
|
data/bin/onevmgroup
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -197,7 +197,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
197
197
|
|
198
198
|
command :chmod, chmod_desc, [:range, :vmgroupid_list], :octet do
|
199
199
|
helper.perform_actions(args[0], options, 'Permissions changed') do |t|
|
200
|
-
t.chmod_octet(args[1])
|
200
|
+
t.chmod_octet(OpenNebulaHelper.to_octet(args[1]))
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
data/bin/onevnet
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -335,7 +335,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
335
335
|
|
336
336
|
command :chmod, chmod_desc, [:range, :vnetid_list], :octet do
|
337
337
|
helper.perform_actions(args[0], options, 'Permissions changed') do |vn|
|
338
|
-
vn.chmod_octet(args[1])
|
338
|
+
vn.chmod_octet(OpenNebulaHelper.to_octet(args[1]))
|
339
339
|
end
|
340
340
|
end
|
341
341
|
|
data/bin/onevntemplate
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -87,6 +87,14 @@ CommandParser::CmdParser.new(ARGV) do
|
|
87
87
|
:description => 'lock all actions'
|
88
88
|
}
|
89
89
|
|
90
|
+
PREFIX = {
|
91
|
+
:name => 'prefix',
|
92
|
+
:large => '--prefix prefix',
|
93
|
+
:description => 'Prefix to autogenerate name, e.g: 001, 01',
|
94
|
+
:format => String
|
95
|
+
|
96
|
+
}
|
97
|
+
|
90
98
|
########################################################################
|
91
99
|
# Global Options
|
92
100
|
########################################################################
|
@@ -102,7 +110,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
102
110
|
OneVNTemplateHelper::MULTIPLE,
|
103
111
|
OneVNTemplateHelper::EXTENDED,
|
104
112
|
OpenNebulaHelper::AS_USER,
|
105
|
-
OpenNebulaHelper::AS_GROUP
|
113
|
+
OpenNebulaHelper::AS_GROUP,
|
114
|
+
PREFIX
|
106
115
|
]
|
107
116
|
|
108
117
|
########################################################################
|
@@ -204,10 +213,32 @@ CommandParser::CmdParser.new(ARGV) do
|
|
204
213
|
number = options[:multiple] || 1
|
205
214
|
|
206
215
|
number.times do |i|
|
207
|
-
exit_code = helper.perform_action(
|
208
|
-
|
209
|
-
|
210
|
-
|
216
|
+
exit_code = helper.perform_action(
|
217
|
+
args[0],
|
218
|
+
options,
|
219
|
+
'instantiated'
|
220
|
+
) do |t|
|
221
|
+
name = options[:name]
|
222
|
+
prefix = options[:prefix]
|
223
|
+
c_i = nil
|
224
|
+
p = nil
|
225
|
+
|
226
|
+
if prefix && name
|
227
|
+
# Get leading zeros
|
228
|
+
p = prefix.scan(/^0+/)[0]
|
229
|
+
|
230
|
+
# Get current index
|
231
|
+
c_i = prefix.gsub(p, '') if p
|
232
|
+
|
233
|
+
# Convert it to Integer to check if we can use it
|
234
|
+
begin
|
235
|
+
c_i = Integer(c_i)
|
236
|
+
name = name.gsub('%i', "#{p}#{c_i + index}")
|
237
|
+
rescue StandardError
|
238
|
+
end
|
239
|
+
elsif name
|
240
|
+
name = name.gsub('%i', i.to_s)
|
241
|
+
end
|
211
242
|
|
212
243
|
extra_template = ''
|
213
244
|
rc = t.info
|
@@ -234,6 +265,10 @@ CommandParser::CmdParser.new(ARGV) do
|
|
234
265
|
end
|
235
266
|
end
|
236
267
|
|
268
|
+
if c_i
|
269
|
+
extra_template.gsub!('%i', "#{p}#{c_i + index}")
|
270
|
+
end
|
271
|
+
|
237
272
|
res = t.instantiate(name, extra_template)
|
238
273
|
|
239
274
|
if !OpenNebula.is_error?(res)
|
@@ -279,7 +314,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
279
314
|
recursive = (options[:recursive] == true)
|
280
315
|
|
281
316
|
helper.perform_actions(args[0], options, 'Permissions changed') do |t|
|
282
|
-
t.chmod_octet(args[1], recursive)
|
317
|
+
t.chmod_octet(OpenNebulaHelper.to_octet(args[1]), recursive)
|
283
318
|
end
|
284
319
|
end
|
285
320
|
|
data/bin/onevrouter
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -251,7 +251,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
251
251
|
|
252
252
|
command :chmod, chmod_desc, [:range, :vrouterid_list], :octet do
|
253
253
|
helper.perform_actions(args[0], options, 'Permissions changed') do |obj|
|
254
|
-
obj.chmod_octet(args[1])
|
254
|
+
obj.chmod_octet(OpenNebulaHelper.to_octet(args[1]))
|
255
255
|
end
|
256
256
|
end
|
257
257
|
|
data/bin/onezone
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/cli_helper.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
data/lib/command_parser.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -520,59 +520,4 @@ class OneVcenterHelper < OpenNebulaHelper::OneHelper
|
|
520
520
|
opts
|
521
521
|
end
|
522
522
|
|
523
|
-
def clear_tags(vmid)
|
524
|
-
client = Client.new
|
525
|
-
|
526
|
-
vm_pool = VirtualMachinePool.new(client, -1)
|
527
|
-
host_pool = HostPool.new(client)
|
528
|
-
deploy_id = -1
|
529
|
-
host_id = -1
|
530
|
-
hostname = ''
|
531
|
-
|
532
|
-
rc = vm_pool.info
|
533
|
-
raise rc.message if OpenNebula.is_error?(rc)
|
534
|
-
|
535
|
-
rc = host_pool.info
|
536
|
-
raise rc.message if OpenNebula.is_error?(rc)
|
537
|
-
|
538
|
-
vm_pool.each do |vm|
|
539
|
-
next if vm.id.to_s != vmid
|
540
|
-
|
541
|
-
deploy_id = vm.deploy_id
|
542
|
-
vm_history = vm.to_hash['VM']['HISTORY_RECORDS']['HISTORY']
|
543
|
-
hostname = vm_history['HOSTNAME']
|
544
|
-
break
|
545
|
-
end
|
546
|
-
|
547
|
-
host_pool.each do |host|
|
548
|
-
if host.name == hostname
|
549
|
-
host_id = host.id
|
550
|
-
end
|
551
|
-
end
|
552
|
-
|
553
|
-
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
|
554
|
-
vm = VCenterDriver::VirtualMachine
|
555
|
-
.new(vi_client, deploy_id, vmid)
|
556
|
-
|
557
|
-
keys_to_remove = []
|
558
|
-
vm['config.extraConfig'].each do |extraconfig|
|
559
|
-
next unless extraconfig.key.include?('opennebula.disk') ||
|
560
|
-
extraconfig.key.include?('opennebula.vm') ||
|
561
|
-
extraconfig.key.downcase.include?('remotedisplay')
|
562
|
-
|
563
|
-
keys_to_remove << extraconfig.key
|
564
|
-
end
|
565
|
-
|
566
|
-
[vm, keys_to_remove]
|
567
|
-
end
|
568
|
-
|
569
|
-
def remove_keys(vm, keys_to_remove)
|
570
|
-
spec_hash = keys_to_remove.map {|key| { :key => key, :value => '' } }
|
571
|
-
|
572
|
-
spec = RbVmomi::VIM.VirtualMachineConfigSpec(
|
573
|
-
:extraConfig => spec_hash
|
574
|
-
)
|
575
|
-
vm.item.ReconfigVM_Task(:spec => spec).wait_for_completion
|
576
|
-
end
|
577
|
-
|
578
523
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -297,7 +297,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
|
297
297
|
vm.info
|
298
298
|
ids = vm.retrieve_elements("/VM/SNAPSHOTS/SNAPSHOT[NAME='#{id}']/ID")
|
299
299
|
|
300
|
-
return [-1, "#{id} not found or duplicated"] \
|
300
|
+
return [-1, "Snapshot #{id} not found or duplicated"] \
|
301
301
|
if ids.nil? || ids.size > 1
|
302
302
|
|
303
303
|
[0, ids[0].to_i]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
data/lib/one_helper.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
2
|
-
# Copyright 2002-
|
2
|
+
# Copyright 2002-2022, 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 #
|
@@ -30,7 +30,7 @@ include OpenNebula
|
|
30
30
|
module OpenNebulaHelper
|
31
31
|
ONE_VERSION=<<-EOT
|
32
32
|
OpenNebula #{OpenNebula::VERSION}
|
33
|
-
Copyright 2002-
|
33
|
+
Copyright 2002-2022, OpenNebula Project, OpenNebula Systems
|
34
34
|
EOT
|
35
35
|
|
36
36
|
if ONE_LOCATION
|
@@ -747,12 +747,9 @@ EOT
|
|
747
747
|
ppid = start_pager
|
748
748
|
end
|
749
749
|
|
750
|
-
puts "<#{pname}>"
|
751
|
-
|
752
750
|
puts page
|
753
751
|
|
754
752
|
if elements < size
|
755
|
-
puts "</#{pname}>"
|
756
753
|
return 0
|
757
754
|
end
|
758
755
|
|
@@ -2305,4 +2302,55 @@ EOT
|
|
2305
2302
|
end
|
2306
2303
|
end
|
2307
2304
|
|
2305
|
+
# Convert u=rwx,g=rx,o=r to octet
|
2306
|
+
#
|
2307
|
+
# @param perm [String] Permissions in human readbale format
|
2308
|
+
#
|
2309
|
+
# @return [String] Permissions in octet format
|
2310
|
+
def OpenNebulaHelper.to_octet(perm)
|
2311
|
+
begin
|
2312
|
+
Integer(perm)
|
2313
|
+
perm
|
2314
|
+
rescue StandardError
|
2315
|
+
perm = perm.split(',')
|
2316
|
+
ret = 0
|
2317
|
+
|
2318
|
+
perm.each do |p|
|
2319
|
+
p = p.split('=')
|
2320
|
+
|
2321
|
+
next unless p.size == 2
|
2322
|
+
|
2323
|
+
r = p[1].count('r')
|
2324
|
+
w = p[1].count('w')
|
2325
|
+
x = p[1].count('x')
|
2326
|
+
|
2327
|
+
rwx = (2 ** 0) * x + (2 ** 1) * w + (2 ** 2) * r
|
2328
|
+
|
2329
|
+
case p[0]
|
2330
|
+
when 'u'
|
2331
|
+
ret += rwx * 100
|
2332
|
+
when 'g'
|
2333
|
+
ret += rwx * 10
|
2334
|
+
else
|
2335
|
+
ret += rwx * 1
|
2336
|
+
end
|
2337
|
+
end
|
2338
|
+
|
2339
|
+
if ret == 0
|
2340
|
+
STDERR.puts 'Error in permissions format'
|
2341
|
+
exit(-1)
|
2342
|
+
else
|
2343
|
+
ret = ret.to_s
|
2344
|
+
|
2345
|
+
if ret.size == 1
|
2346
|
+
"00#{ret}"
|
2347
|
+
elsif ret.size == 2
|
2348
|
+
"0#{ret}"
|
2349
|
+
else
|
2350
|
+
ret
|
2351
|
+
end
|
2352
|
+
end
|
2353
|
+
end
|
2354
|
+
end
|
2355
|
+
|
2308
2356
|
end
|
data/share/schemas/xsd/host.xsd
CHANGED
@@ -65,9 +65,11 @@
|
|
65
65
|
<xs:element name="DOMAIN" type="xs:string"/>
|
66
66
|
<xs:element name="FUNCTION" type="xs:string"/>
|
67
67
|
<xs:element name="NUMA_NODE" type="xs:string"/>
|
68
|
+
<xs:element name="PROFILES" type="xs:string" minOccurs="0"/>
|
68
69
|
<xs:element name="SHORT_ADDRESS" type="xs:string"/>
|
69
70
|
<xs:element name="SLOT" type="xs:string"/>
|
70
71
|
<xs:element name="TYPE" type="xs:string"/>
|
72
|
+
<xs:element name="UUID" type="xs:string" minOccurs="0"/>
|
71
73
|
<xs:element name="VENDOR" type="xs:string"/>
|
72
74
|
<xs:element name="VENDOR_NAME" type="xs:string"/>
|
73
75
|
<xs:element name="VMID" type="xs:integer"/>
|
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: 6.4.
|
4
|
+
version: 6.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenNebula
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-12 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: 6.4.
|
19
|
+
version: 6.4.1
|
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: 6.4.
|
26
|
+
version: 6.4.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|