mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-22 20:54:49 +09:00
* F #3859: Adopt one2one driver to new monitoring * L #-: Lint one2one driver
This commit is contained in:
1 parent
29e18184b8
commit
93bb828735
17 files changed
+714
-558
No files matched your search
+26
-2
@@ -317,6 +317,10 @@ VAR_DIRS="$VAR_LOCATION/remotes \
|
||||
$VAR_LOCATION/remotes/im/az-probes.d/vm/monitor \
|
||||
$VAR_LOCATION/remotes/im/az-probes.d/vm/status \
|
||||
$VAR_LOCATION/remotes/im/one.d \
|
||||
$VAR_LOCATION/remotes/im/one-probes.d/host/monitor \
|
||||
$VAR_LOCATION/remotes/im/one-probes.d/host/system \
|
||||
$VAR_LOCATION/remotes/im/one-probes.d/vm/monitor \
|
||||
$VAR_LOCATION/remotes/im/one-probes.d/vm/status \
|
||||
$VAR_LOCATION/remotes/im/packet.d \
|
||||
$VAR_LOCATION/remotes/pm \
|
||||
$VAR_LOCATION/remotes/pm/ec2 \
|
||||
@@ -528,6 +532,10 @@ INSTALL_FILES=(
|
||||
IM_PROBES_EC2_HOST_SYSTEM_FILES:$VAR_LOCATION/remotes/im/ec2-probes.d/host/system
|
||||
IM_PROBES_EC2_VM_MONITOR_FILES:$VAR_LOCATION/remotes/im/ec2-probes.d/vm/monitor
|
||||
IM_PROBES_EC2_VM_STATUS_FILES:$VAR_LOCATION/remotes/im/ec2-probes.d/vm/status
|
||||
IM_PROBES_ONE_HOST_MONITOR_FILES:$VAR_LOCATION/remotes/im/one-probes.d/host/monitor
|
||||
IM_PROBES_ONE_HOST_SYSTEM_FILES:$VAR_LOCATION/remotes/im/one-probes.d/host/system
|
||||
IM_PROBES_ONE_VM_MONITOR_FILES:$VAR_LOCATION/remotes/im/one-probes.d/vm/monitor
|
||||
IM_PROBES_ONE_VM_STATUS_FILES:$VAR_LOCATION/remotes/im/one-probes.d/vm/status
|
||||
IM_PROBES_VERSION:$VAR_LOCATION/remotes
|
||||
IM_PROBES_FIRECRACKER_HOST_BEACON_FILES:$VAR_LOCATION/remotes/im/firecracker-probes.d/host/beacon
|
||||
IM_PROBES_FIRECRACKER_HOST_MONITOR_FILES:$VAR_LOCATION/remotes/im/firecracker-probes.d/host/monitor
|
||||
@@ -1140,7 +1148,6 @@ VMM_EXEC_ONE_SCRIPTS="src/vmm_mad/remotes/one/cancel \
|
||||
src/vmm_mad/remotes/one/reboot \
|
||||
src/vmm_mad/remotes/one/reset \
|
||||
src/vmm_mad/remotes/one/save \
|
||||
src/vmm_mad/remotes/one/poll \
|
||||
src/vmm_mad/remotes/one/shutdown \
|
||||
src/vmm_mad/remotes/one/reconfigure \
|
||||
src/vmm_mad/remotes/one/prereconfigure"
|
||||
@@ -1333,7 +1340,24 @@ IM_PROBES_AZ_VM_MONITOR_FILES="\
|
||||
IM_PROBES_AZ_VM_STATUS_FILES="\
|
||||
src/im_mad/remotes/az-probes.d/vm/status/probe_vm_status.rb"
|
||||
|
||||
IM_PROBES_ONE_FILES="src/im_mad/remotes/one.d/poll"
|
||||
# ONE monitord-client
|
||||
IM_PROBES_ONE_FILES="\
|
||||
src/im_mad/remotes/one.d/monitord-client_control.sh \
|
||||
src/im_mad/remotes/one.d/monitord-client.rb"
|
||||
|
||||
# ONE probes
|
||||
IM_PROBES_ONE_HOST_MONITOR_FILES="\
|
||||
src/im_mad/remotes/one-probes.d/host/monitor/probe_host_monitor.rb"
|
||||
|
||||
IM_PROBES_ONE_HOST_SYSTEM_FILES="\
|
||||
src/im_mad/remotes/one-probes.d/host/system/probe_host_system.rb"
|
||||
|
||||
IM_PROBES_ONE_VM_MONITOR_FILES="\
|
||||
src/im_mad/remotes/one-probes.d/vm/monitor/probe_vm_monitor.rb"
|
||||
|
||||
IM_PROBES_ONE_VM_STATUS_FILES="\
|
||||
src/im_mad/remotes/one-probes.d/vm/status/probe_vm_status.rb"
|
||||
|
||||
|
||||
IM_PROBES_PACKET_FILES="src/im_mad/remotes/packet.d/poll"
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
# -------------------------------------------------------------------------- #
|
||||
|
||||
ONE_LOCATION = ENV['ONE_LOCATION'] unless defined? ONE_LOCATION
|
||||
|
||||
if !ONE_LOCATION
|
||||
RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby'
|
||||
GEMS_LOCATION ||= '/usr/share/one/gems'
|
||||
else
|
||||
RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby'
|
||||
GEMS_LOCATION ||= ONE_LOCATION + '/share/gems'
|
||||
end
|
||||
|
||||
if File.directory?(GEMS_LOCATION)
|
||||
Gem.use_paths(GEMS_LOCATION)
|
||||
end
|
||||
|
||||
$LOAD_PATH << RUBY_LIB_LOCATION
|
||||
|
||||
require 'opennebula_driver'
|
||||
host = ARGV[-1]
|
||||
host_id = ARGV[-2]
|
||||
|
||||
one2one_drv = One2OneDriver.new(host, host_id)
|
||||
|
||||
begin
|
||||
puts one2one_drv.probe_host_monitor
|
||||
rescue StandardError => e
|
||||
OpenNebula.handle_driver_exception('im probe_host_monitor', e, host)
|
||||
end
|
||||
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
# -------------------------------------------------------------------------- #
|
||||
|
||||
ONE_LOCATION = ENV['ONE_LOCATION'] unless defined? ONE_LOCATION
|
||||
|
||||
if !ONE_LOCATION
|
||||
RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby'
|
||||
GEMS_LOCATION ||= '/usr/share/one/gems'
|
||||
else
|
||||
RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby'
|
||||
GEMS_LOCATION ||= ONE_LOCATION + '/share/gems'
|
||||
end
|
||||
|
||||
if File.directory?(GEMS_LOCATION)
|
||||
Gem.use_paths(GEMS_LOCATION)
|
||||
end
|
||||
|
||||
$LOAD_PATH << RUBY_LIB_LOCATION
|
||||
|
||||
require 'opennebula_driver'
|
||||
host = ARGV[-1]
|
||||
host_id = ARGV[-2]
|
||||
|
||||
one2one_drv = One2OneDriver.new(host, host_id)
|
||||
|
||||
begin
|
||||
puts one2one_drv.probe_host_system
|
||||
rescue StandardError => e
|
||||
OpenNebula.handle_driver_exception('im probe_host_system', e, host)
|
||||
end
|
||||
+11
-8
@@ -16,14 +16,14 @@
|
||||
# limitations under the License. #
|
||||
# -------------------------------------------------------------------------- #
|
||||
|
||||
ONE_LOCATION = ENV['ONE_LOCATION'] if !defined?(ONE_LOCATION)
|
||||
ONE_LOCATION = ENV['ONE_LOCATION'] unless defined? ONE_LOCATION
|
||||
|
||||
if !ONE_LOCATION
|
||||
RUBY_LIB_LOCATION = '/usr/lib/one/ruby' if !defined?(RUBY_LIB_LOCATION)
|
||||
GEMS_LOCATION = '/usr/share/one/gems' if !defined?(GEMS_LOCATION)
|
||||
RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby'
|
||||
GEMS_LOCATION ||= '/usr/share/one/gems'
|
||||
else
|
||||
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby' if !defined?(RUBY_LIB_LOCATION)
|
||||
GEMS_LOCATION = ONE_LOCATION + '/share/gems' if !defined?(GEMS_LOCATION)
|
||||
RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby'
|
||||
GEMS_LOCATION ||= ONE_LOCATION + '/share/gems'
|
||||
end
|
||||
|
||||
if File.directory?(GEMS_LOCATION)
|
||||
@@ -36,7 +36,10 @@ require 'opennebula_driver'
|
||||
host = ARGV[-1]
|
||||
host_id = ARGV[-2]
|
||||
|
||||
one2one_drv = OpenNebulaDriver.new(host, host_id)
|
||||
|
||||
one2one_drv.monitor_all_vms
|
||||
one2one_drv = One2OneDriver.new(host, host_id)
|
||||
|
||||
begin
|
||||
puts one2one_drv.probe_vm_monitor
|
||||
rescue StandardError => e
|
||||
OpenNebula.handle_driver_exception('im probe_vm_monitor', e, host)
|
||||
end
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
# -------------------------------------------------------------------------- #
|
||||
|
||||
ONE_LOCATION = ENV['ONE_LOCATION'] unless defined? ONE_LOCATION
|
||||
|
||||
if !ONE_LOCATION
|
||||
RUBY_LIB_LOCATION ||= '/usr/lib/one/ruby'
|
||||
GEMS_LOCATION ||= '/usr/share/one/gems'
|
||||
else
|
||||
RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby'
|
||||
GEMS_LOCATION ||= ONE_LOCATION + '/share/gems'
|
||||
end
|
||||
|
||||
if File.directory?(GEMS_LOCATION)
|
||||
Gem.use_paths(GEMS_LOCATION)
|
||||
end
|
||||
|
||||
$LOAD_PATH << RUBY_LIB_LOCATION
|
||||
|
||||
require 'opennebula_driver'
|
||||
require_relative '../../../lib/probe_db'
|
||||
|
||||
host = ARGV[-1]
|
||||
host_id = ARGV[-2]
|
||||
|
||||
begin
|
||||
vmdb = VirtualMachineDB.new('one2one',
|
||||
:missing_state => 'UNKNOWN',
|
||||
:sync => 180)
|
||||
vmdb.purge
|
||||
puts vmdb.to_status(host, host_id)
|
||||
rescue StandardError => e
|
||||
OpenNebula.handle_driver_exception('im probe_vm_status', e, host)
|
||||
end
|
||||
@@ -0,0 +1 @@
|
||||
../common.d/monitord-client.rb
|
||||
@@ -0,0 +1 @@
|
||||
../common.d/monitord-client_control.sh
|
||||
@@ -51,6 +51,7 @@ module PublicCloudDriver
|
||||
|
||||
data = "HYPERVISOR=#{@hypervisor}\n"
|
||||
data << "PUBLIC_CLOUD=YES\n"
|
||||
data << "PRIORITY=-1\n"
|
||||
data << "TOTALCPU=#{total_cpu}\n"
|
||||
data << "TOTALMEMORY=#{total_mem}\n"
|
||||
|
||||
@@ -187,8 +188,8 @@ module PublicCloudDriver
|
||||
end
|
||||
|
||||
# Hash to ONE template format
|
||||
def hash_to_template(h, pref = '', post = '')
|
||||
tmpl = h.to_a.map {|e| "#{e[0].to_s.upcase}=\"#{e[1]}\"" }.join(', ')
|
||||
def hash_to_template(h, pref = '', post = '', delim = ', ')
|
||||
tmpl = h.to_a.map {|e| "#{e[0].to_s.upcase}=\"#{e[1]}\"" }.join(delim)
|
||||
pref + tmpl + post
|
||||
end
|
||||
|
||||
|
||||
@@ -788,8 +788,8 @@ end
|
||||
############################################################################
|
||||
module DomainList
|
||||
|
||||
def self.state_info(id, name)
|
||||
az = AzureDriver.new(id, name)
|
||||
def self.state_info(name, id)
|
||||
az = AzureDriver.new(name, id)
|
||||
|
||||
vms = az.retreive_vms_data
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ end
|
||||
|
||||
EC2_DRIVER_CONF = "#{ETC_LOCATION}/ec2_driver.conf"
|
||||
EC2_DRIVER_DEFAULT = "#{ETC_LOCATION}/ec2_driver.default"
|
||||
EC2_DATABASE_PATH = "#{VAR_LOCATION}/remotes/im/ec2.d/ec-cache.db"
|
||||
EC2_DATABASE_PATH = "#{VAR_LOCATION}/remotes/im/ec2.d/ec2-cache.db"
|
||||
|
||||
if File.directory?(GEMS_LOCATION)
|
||||
Gem.use_paths(GEMS_LOCATION)
|
||||
@@ -1022,8 +1022,8 @@ end
|
||||
############################################################################
|
||||
module DomainList
|
||||
|
||||
def self.state_info(*args)
|
||||
ec2 = EC2Driver.new(*args)
|
||||
def self.state_info(name, id)
|
||||
ec2 = EC2Driver.new(name, id)
|
||||
|
||||
vms = ec2.retreive_vms_data
|
||||
|
||||
|
||||
@@ -44,5 +44,5 @@ vm.info
|
||||
|
||||
lcm_state = vm.lcm_state_str
|
||||
|
||||
one2one_drv = OpenNebulaDriver.new(host)
|
||||
one2one_drv = One2OneDriver.new(host)
|
||||
one2one_drv.cancel(deploy_id, lcm_state)
|
||||
@@ -46,7 +46,7 @@ vm.info
|
||||
lcm_state = vm.lcm_state_str
|
||||
deploy_id = vm.deploy_id
|
||||
|
||||
one2one_drv = OpenNebulaDriver.new(host)
|
||||
one2one_drv = One2OneDriver.new(host)
|
||||
|
||||
text=File.read(dfile)
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -38,5 +38,5 @@ require 'opennebula_driver'
|
||||
deploy_id = ARGV[0]
|
||||
host = ARGV[1]
|
||||
|
||||
one2one_drv = OpenNebulaDriver.new(host)
|
||||
one2one_drv = One2OneDriver.new(host)
|
||||
one2one_drv.reboot(deploy_id)
|
||||
@@ -38,5 +38,5 @@ require 'opennebula_driver'
|
||||
deploy_id = ARGV[1]
|
||||
host = ARGV[0]
|
||||
|
||||
one2one_drv = OpenNebulaDriver.new(host)
|
||||
one2one_drv = One2OneDriver.new(host)
|
||||
one2one_drv.reset(deploy_id)
|
||||
@@ -39,5 +39,5 @@ deploy_id = ARGV[0]
|
||||
file = ARGV[1]
|
||||
host = ARGV[2]
|
||||
|
||||
one2one_drv = OpenNebulaDriver.new(host)
|
||||
one2one_drv = One2OneDriver.new(host)
|
||||
one2one_drv.save(deploy_id)
|
||||
@@ -45,5 +45,5 @@ vm.info
|
||||
|
||||
lcm_state = vm.lcm_state_str
|
||||
|
||||
one2one_drv = OpenNebulaDriver.new(host)
|
||||
one2one_drv = One2OneDriver.new(host)
|
||||
one2one_drv.shutdown(deploy_id, lcm_state)
|
||||
Reference in new issue
Block a user