opennebula-cli 6.3.85.pre → 6.3.90.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/oneflow +23 -0
- data/bin/oneirb +131 -0
- data/bin/onelog +101 -0
- data/bin/onevm +34 -0
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f3fc9a8c3825e9063b10901a749e086a10d4025c1f1742f4954db927832ee2e
|
4
|
+
data.tar.gz: 2f77621f9e521f6f02f63b5d39486157004cba81c9d6ab76923720b0b4d2c9f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9dfbab37a9aa42558431c6c03386944b2bfd904256b636dbf2d5746142b5b7ecd0a4f6c7895bde791969286f5e8ba9d24caeb8d82003fd484dc3df056f0ceec
|
7
|
+
data.tar.gz: bb2fa551de041f71aac6b6acd38f755c65dc92ed514eb4eab54ff00df03adf905031ab487b10e03058b10fa219a47e168a028fa673025b1f5e6930ae1a53a570
|
data/bin/oneflow
CHANGED
@@ -521,4 +521,27 @@ CommandParser::CmdParser.new(ARGV) do
|
|
521
521
|
0
|
522
522
|
end
|
523
523
|
end
|
524
|
+
|
525
|
+
###
|
526
|
+
|
527
|
+
release_desc = <<-EOT.unindent
|
528
|
+
Release roles of a service on hold
|
529
|
+
EOT
|
530
|
+
|
531
|
+
command :release, release_desc, :service_id do
|
532
|
+
service_id = args[0]
|
533
|
+
client = helper.client(options)
|
534
|
+
|
535
|
+
params = {}
|
536
|
+
json = Service.build_json_action('release', params)
|
537
|
+
|
538
|
+
response = client.post("#{RESOURCE_PATH}/#{service_id}/action",
|
539
|
+
json)
|
540
|
+
|
541
|
+
if CloudClient.is_error?(response)
|
542
|
+
[response.code.to_i, response.to_s]
|
543
|
+
else
|
544
|
+
0
|
545
|
+
end
|
546
|
+
end
|
524
547
|
end
|
data/bin/oneirb
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# -------------------------------------------------------------------------- #
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
|
+
# #
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
|
+
# not use this file except in compliance with the License. You may obtain #
|
8
|
+
# a copy of the License at #
|
9
|
+
# #
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
11
|
+
# #
|
12
|
+
# Unless required by applicable law or agreed to in writing, software #
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS, #
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
15
|
+
# See the License for the specific language governing permissions and #
|
16
|
+
# limitations under the License. #
|
17
|
+
#--------------------------------------------------------------------------- #
|
18
|
+
|
19
|
+
ONE_LOCATION = ENV['ONE_LOCATION']
|
20
|
+
|
21
|
+
if !ONE_LOCATION
|
22
|
+
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
|
23
|
+
GEMS_LOCATION = '/usr/share/one/gems'
|
24
|
+
else
|
25
|
+
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
|
26
|
+
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
27
|
+
end
|
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
|
+
|
49
|
+
$LOAD_PATH << RUBY_LIB_LOCATION
|
50
|
+
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
51
|
+
$LOAD_PATH << RUBY_LIB_LOCATION + '/oneflow/lib'
|
52
|
+
|
53
|
+
################################################################################
|
54
|
+
# Required libraries
|
55
|
+
################################################################################
|
56
|
+
|
57
|
+
require 'base64'
|
58
|
+
require 'csv'
|
59
|
+
require 'date'
|
60
|
+
require 'digest/md5'
|
61
|
+
require 'erb'
|
62
|
+
require 'json'
|
63
|
+
require 'nokogiri'
|
64
|
+
require 'openssl'
|
65
|
+
require 'ox'
|
66
|
+
require 'pp'
|
67
|
+
require 'set'
|
68
|
+
require 'socket'
|
69
|
+
require 'sqlite3'
|
70
|
+
require 'tempfile'
|
71
|
+
require 'time'
|
72
|
+
require 'uri'
|
73
|
+
require 'yaml'
|
74
|
+
|
75
|
+
require 'opennebula'
|
76
|
+
require 'vcenter_driver'
|
77
|
+
|
78
|
+
# Include OpenNebula to avoid having to use OpenNebula:: namespace
|
79
|
+
include OpenNebula
|
80
|
+
|
81
|
+
################################################################################
|
82
|
+
# vCenter helper functions
|
83
|
+
################################################################################
|
84
|
+
|
85
|
+
# Get VIClient object from host
|
86
|
+
#
|
87
|
+
# @param id [Integer] Host ID
|
88
|
+
def vi_client_host(id)
|
89
|
+
VCenterDriver::VIClient.new_from_host(id)
|
90
|
+
end
|
91
|
+
|
92
|
+
# Get VM vCenter object
|
93
|
+
#
|
94
|
+
# @param id [Integer] VM ID
|
95
|
+
def vm(id)
|
96
|
+
one_vm = VCenterDriver::VIHelper.one_item(OpenNebula::VirtualMachine, id)
|
97
|
+
|
98
|
+
did = one_vm['DEPLOY_ID']
|
99
|
+
hid = one_vm.retrieve_xmlelements(
|
100
|
+
'HISTORY_RECORDS/HISTORY/HID'
|
101
|
+
).last.text.to_i
|
102
|
+
|
103
|
+
VCenterDriver::VirtualMachine.new_one(vi_client_host(hid), did, one_vm)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Get host vCenter object
|
107
|
+
#
|
108
|
+
# @param id [Integer] Host ID
|
109
|
+
def host(id)
|
110
|
+
vi_client = vi_client_host(id)
|
111
|
+
one_h = VCenterDriver::VIHelper.one_item(OpenNebula::Host, hid)
|
112
|
+
|
113
|
+
VCenterDriver::ClusterComputeResource.new_from_ref(
|
114
|
+
one_h['TEMPLATE/VCENTER_CCR_REF'],
|
115
|
+
vi_client
|
116
|
+
)
|
117
|
+
end
|
118
|
+
|
119
|
+
################################################################################
|
120
|
+
# Open irb session
|
121
|
+
################################################################################
|
122
|
+
|
123
|
+
puts '* You can use the function vi_client_host(id) to get vCenter client'
|
124
|
+
puts '* You can use the function vm(id) to get vCenter VM'
|
125
|
+
puts '* You can use the function host(id) to get vCenter host'
|
126
|
+
|
127
|
+
@client = Client.new
|
128
|
+
version = '>= 0'
|
129
|
+
|
130
|
+
gem 'pry', version
|
131
|
+
load Gem.bin_path('pry', 'pry', version)
|
data/bin/onelog
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# -------------------------------------------------------------------------- #
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
|
+
# #
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
|
+
# not use this file except in compliance with the License. You may obtain #
|
8
|
+
# a copy of the License at #
|
9
|
+
# #
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
11
|
+
# #
|
12
|
+
# Unless required by applicable law or agreed to in writing, software #
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS, #
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
15
|
+
# See the License for the specific language governing permissions and #
|
16
|
+
# limitations under the License. #
|
17
|
+
#--------------------------------------------------------------------------- #
|
18
|
+
|
19
|
+
ONE_LOCATION = ENV['ONE_LOCATION']
|
20
|
+
|
21
|
+
if !ONE_LOCATION
|
22
|
+
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
|
23
|
+
else
|
24
|
+
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
|
25
|
+
end
|
26
|
+
|
27
|
+
$LOAD_PATH << RUBY_LIB_LOCATION
|
28
|
+
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
29
|
+
|
30
|
+
# Default pager to check logs
|
31
|
+
DEFAULT_PAGER = 'less'
|
32
|
+
|
33
|
+
# List of OpenNebula services and the logs files
|
34
|
+
SERVICES = {
|
35
|
+
'fireedge' => { :log => 'fireedge.log', :error => 'fireedge.error' },
|
36
|
+
'monitor' => 'monitor.log',
|
37
|
+
'novnc' => 'novnc.log',
|
38
|
+
'oned' => 'oned.log',
|
39
|
+
'onehem' => { :log => 'onehem.log', :error => 'onehem.error' },
|
40
|
+
'sched' => 'sched.log',
|
41
|
+
'sunstone' => { :log => 'sunstone.log', :error => 'sunstone.error' },
|
42
|
+
'vcenter' => 'vcenter_monitor.log'
|
43
|
+
}
|
44
|
+
|
45
|
+
require 'command_parser'
|
46
|
+
require 'one_helper'
|
47
|
+
|
48
|
+
CommandParser::CmdParser.new(ARGV) do
|
49
|
+
usage '`onelog` <command> [<args>] [<options>]'
|
50
|
+
version OpenNebulaHelper::ONE_VERSION
|
51
|
+
|
52
|
+
TYPE = {
|
53
|
+
:name => 'type',
|
54
|
+
:short => '-t type',
|
55
|
+
:large => '--type type',
|
56
|
+
:format => String,
|
57
|
+
:description => 'Log type (log/error) [default: log]'
|
58
|
+
}
|
59
|
+
|
60
|
+
PAGER = {
|
61
|
+
:name => 'pager',
|
62
|
+
:short => '-p pager',
|
63
|
+
:large => '--pager pager',
|
64
|
+
:format => String,
|
65
|
+
:description => 'Pager to use to read logs [defaul: less]'
|
66
|
+
}
|
67
|
+
|
68
|
+
PAGER_OPTS = {
|
69
|
+
:name => 'pager_opts',
|
70
|
+
:large => '--pager-opts pager_opts',
|
71
|
+
:format => String,
|
72
|
+
:description => 'Pager options'
|
73
|
+
}
|
74
|
+
|
75
|
+
get_desc = <<-EOT.unindent
|
76
|
+
Gets log from an specific OpenNebula service
|
77
|
+
EOT
|
78
|
+
|
79
|
+
command :get, get_desc, :service, :options => [TYPE, PAGER, PAGER_OPTS] do
|
80
|
+
unless SERVICES[args[0]]
|
81
|
+
STDERR.puts "Service '#{args[0]}' not found"
|
82
|
+
exit 1
|
83
|
+
end
|
84
|
+
|
85
|
+
if options[:type] && !SERVICES[args[0]][options[:type].to_sym]
|
86
|
+
STDERR.puts "Log file type '#{options[:type]}' not found"
|
87
|
+
exit 1
|
88
|
+
end
|
89
|
+
|
90
|
+
if (SERVICES[args[0]].is_a? Hash) && !options[:type]
|
91
|
+
options[:type] = :log
|
92
|
+
end
|
93
|
+
|
94
|
+
type = options[:type].to_sym
|
95
|
+
pager = options[:pager] || DEFAULT_PAGER
|
96
|
+
|
97
|
+
type.nil? ? file = SERVICES[args[0]] : file = SERVICES[args[0]][type]
|
98
|
+
|
99
|
+
system("#{pager} #{options[:pager_opts]} /var/log/one/#{file}")
|
100
|
+
end
|
101
|
+
end
|
data/bin/onevm
CHANGED
@@ -49,6 +49,9 @@ end
|
|
49
49
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
50
50
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
51
51
|
|
52
|
+
# Default VNC viewer
|
53
|
+
DEFAULT_VNC = 'vinagre'
|
54
|
+
|
52
55
|
require 'command_parser'
|
53
56
|
require 'one_helper/onevm_helper'
|
54
57
|
require 'one_helper/onedatastore_helper'
|
@@ -239,6 +242,13 @@ CommandParser::CmdParser.new(ARGV) do
|
|
239
242
|
:description => 'SSH options to use'
|
240
243
|
}
|
241
244
|
|
245
|
+
VNC = {
|
246
|
+
:name => 'vnc',
|
247
|
+
:large => '--vnc vnc',
|
248
|
+
:format => String,
|
249
|
+
:description => 'VNC client to use'
|
250
|
+
}
|
251
|
+
|
242
252
|
OpenNebulaHelper::TEMPLATE_OPTIONS_VM.delete_if do |v|
|
243
253
|
%w[as_gid as_uid].include?(v[:name])
|
244
254
|
end
|
@@ -1666,6 +1676,30 @@ CommandParser::CmdParser.new(ARGV) do
|
|
1666
1676
|
end
|
1667
1677
|
end
|
1668
1678
|
|
1679
|
+
connect_desc = <<-EOT.unindent
|
1680
|
+
Opens a VNC session to the VM
|
1681
|
+
EOT
|
1682
|
+
|
1683
|
+
command :vnc, connect_desc, :vmid, :options => [VNC] do
|
1684
|
+
helper.perform_action(args[0], options, 'VNC') do |vm|
|
1685
|
+
rc = vm.info
|
1686
|
+
|
1687
|
+
if OpenNebula.is_error?(rc)
|
1688
|
+
STDERR.puts rc.message
|
1689
|
+
exit(1)
|
1690
|
+
end
|
1691
|
+
|
1692
|
+
host = vm['HISTORY_RECORDS/HISTORY[last()]/HOSTNAME']
|
1693
|
+
port = vm['TEMPLATE/GRAPHICS/PORT']
|
1694
|
+
|
1695
|
+
vncviewer = options['vnc'] || DEFAULT_VNC
|
1696
|
+
|
1697
|
+
cmd = [vncviewer, "#{host}::#{port}"]
|
1698
|
+
|
1699
|
+
exec(*cmd)
|
1700
|
+
end
|
1701
|
+
end
|
1702
|
+
|
1669
1703
|
# Deprecated commands
|
1670
1704
|
|
1671
1705
|
deprecated_command(:shutdown, 'terminate')
|
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.3.
|
4
|
+
version: 6.3.90.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenNebula
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-28 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.3.
|
19
|
+
version: 6.3.90.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: 6.3.
|
26
|
+
version: 6.3.90.pre
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,6 +50,7 @@ executables:
|
|
50
50
|
- onehook
|
51
51
|
- onevdc
|
52
52
|
- oneacl
|
53
|
+
- oneirb
|
53
54
|
- oneflow-template
|
54
55
|
- onevrouter
|
55
56
|
- oneshowback
|
@@ -57,6 +58,7 @@ executables:
|
|
57
58
|
- oneacct
|
58
59
|
- onesecgroup
|
59
60
|
- onecluster
|
61
|
+
- onelog
|
60
62
|
- onemarketapp
|
61
63
|
- onetemplate
|
62
64
|
- onemarket
|
@@ -80,6 +82,8 @@ files:
|
|
80
82
|
- bin/onehook
|
81
83
|
- bin/onehost
|
82
84
|
- bin/oneimage
|
85
|
+
- bin/oneirb
|
86
|
+
- bin/onelog
|
83
87
|
- bin/onemarket
|
84
88
|
- bin/onemarketapp
|
85
89
|
- bin/onesecgroup
|