mirror of
https://github.com/OpenNebula/one.git
synced 2025-04-01 06:50:25 +03:00
F #5076: Remove duplicated files. Update install.sh
This commit is contained in:
parent
007ce2dd9a
commit
11687cc8f6
15
install.sh
15
install.sh
@ -320,6 +320,7 @@ VAR_DIRS="$VAR_LOCATION/remotes \
|
||||
$VAR_LOCATION/remotes/etc/datastore/fs \
|
||||
$VAR_LOCATION/remotes/etc/datastore/ceph \
|
||||
$VAR_LOCATION/remotes/etc/im/kvm-probes.d \
|
||||
$VAR_LOCATION/remotes/etc/im/qemu-probes.d \
|
||||
$VAR_LOCATION/remotes/etc/im/lxd-probes.d \
|
||||
$VAR_LOCATION/remotes/etc/im/firecracker-probes.d \
|
||||
$VAR_LOCATION/remotes/etc/market/http \
|
||||
@ -581,13 +582,13 @@ INSTALL_FILES=(
|
||||
IM_PROBES_KVM_VM_STATUS_FILES:$VAR_LOCATION/remotes/im/kvm-probes.d/vm/status
|
||||
IM_PROBES_KVM_VM_SNAPSHOT_FILES:$VAR_LOCATION/remotes/im/kvm-probes.d/vm/snapshot
|
||||
IM_PROBES_ETC_KVM_PROBES_FILES:$VAR_LOCATION/remotes/etc/im/kvm-probes.d
|
||||
IM_PROBES_QEMU_HOST_BEACON_FILES:$VAR_LOCATION/remotes/im/kvm-probes.d/host/beacon
|
||||
IM_PROBES_QEMU_HOST_MONITOR_FILES:$VAR_LOCATION/remotes/im/kvm-probes.d/host/monitor
|
||||
IM_PROBES_QEMU_HOST_SYSTEM_FILES:$VAR_LOCATION/remotes/im/kvm-probes.d/host/system
|
||||
IM_PROBES_QEMU_VM_MONITOR_FILES:$VAR_LOCATION/remotes/im/kvm-probes.d/vm/monitor
|
||||
IM_PROBES_QEMU_VM_STATUS_FILES:$VAR_LOCATION/remotes/im/kvm-probes.d/vm/status
|
||||
IM_PROBES_QEMU_VM_SNAPSHOT_FILES:$VAR_LOCATION/remotes/im/kvm-probes.d/vm/snapshot
|
||||
IM_PROBES_ETC_QEMU_PROBES_FILES:$VAR_LOCATION/remotes/etc/im/kvm-probes.d
|
||||
IM_PROBES_QEMU_HOST_BEACON_FILES:$VAR_LOCATION/remotes/im/qemu-probes.d/host/beacon
|
||||
IM_PROBES_QEMU_HOST_MONITOR_FILES:$VAR_LOCATION/remotes/im/qemu-probes.d/host/monitor
|
||||
IM_PROBES_QEMU_HOST_SYSTEM_FILES:$VAR_LOCATION/remotes/im/qemu-probes.d/host/system
|
||||
IM_PROBES_QEMU_VM_MONITOR_FILES:$VAR_LOCATION/remotes/im/qemu-probes.d/vm/monitor
|
||||
IM_PROBES_QEMU_VM_STATUS_FILES:$VAR_LOCATION/remotes/im/qemu-probes.d/vm/status
|
||||
IM_PROBES_QEMU_VM_SNAPSHOT_FILES:$VAR_LOCATION/remotes/im/qemu-probes.d/vm/snapshot
|
||||
IM_PROBES_ETC_QEMU_PROBES_FILES:$VAR_LOCATION/remotes/etc/im/qemu-probes.d
|
||||
IM_PROBES_DUMMY_HOST_BEACON_FILES:$VAR_LOCATION/remotes/im/dummy-probes.d/host/beacon
|
||||
IM_PROBES_DUMMY_HOST_MONITOR_FILES:$VAR_LOCATION/remotes/im/dummy-probes.d/host/monitor
|
||||
IM_PROBES_DUMMY_HOST_SYSTEM_FILES:$VAR_LOCATION/remotes/im/dummy-probes.d/host/system
|
||||
|
1
src/im_mad/remotes/qemu-probes.d
Symbolic link
1
src/im_mad/remotes/qemu-probes.d
Symbolic link
@ -0,0 +1 @@
|
||||
kvm-probes.d/
|
@ -1 +0,0 @@
|
||||
../../../common.d/date.sh
|
@ -1,29 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2021, 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. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
(
|
||||
[ -f /tmp/one-monitord-client.pid ] || exit 0
|
||||
running_pid=$(cat /tmp/one-monitord-client.pid)
|
||||
pids=$(ps axuwww | grep -e "/monitord-client.rb kvm" | grep -v grep | awk '{ print $2 }' | grep -v "^${running_pid}$")
|
||||
|
||||
if [ -n "$pids" ]; then
|
||||
kill $pids
|
||||
fi
|
||||
|
||||
) > /dev/null
|
||||
|
@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2021, 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. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
require_relative '../../../lib/linux'
|
||||
|
||||
LinuxHost.usage('kvm')
|
@ -1 +0,0 @@
|
||||
../../../node-probes.d/numa_usage.rb
|
@ -1 +0,0 @@
|
||||
../../../node-probes.d/architecture.sh
|
@ -1 +0,0 @@
|
||||
../../../node-probes.d/cpu.sh
|
@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2021, 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. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
require_relative '../../../lib/linux'
|
||||
|
||||
LinuxHost.config('kvm')
|
@ -1,113 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2021, 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. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
require 'rexml/document'
|
||||
require 'open3'
|
||||
|
||||
ENV['LANG'] = 'C'
|
||||
ENV['LC_ALL'] = 'C'
|
||||
|
||||
GUEST_ARCHS = %w(i686 x86_64)
|
||||
|
||||
begin
|
||||
|
||||
capabilities = ""
|
||||
archs = []
|
||||
machines = []
|
||||
models = []
|
||||
|
||||
cmd = 'virsh -r -c qemu:///system capabilities'
|
||||
capabilities, e, s = Open3.capture3(cmd)
|
||||
exit(-1) unless s.success?
|
||||
|
||||
cap_xml = REXML::Document.new(capabilities)
|
||||
cap_xml = cap_xml.root
|
||||
|
||||
GUEST_ARCHS.each { |a|
|
||||
a_elem = cap_xml.elements["guest/arch[@name='#{a}']"]
|
||||
next if !a_elem
|
||||
|
||||
# Evaluate the domain specific machines with higher priority
|
||||
# over the machines listed just inside the architecture.
|
||||
#
|
||||
# <guest>
|
||||
# <os_type>hvm</os_type>
|
||||
# <arch name='x86_64'>
|
||||
# <wordsize>64</wordsize>
|
||||
# <emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
# <machine maxCpus='255'>pc-i440fx-2.0</machine>
|
||||
# <machine canonical='pc-i440fx-2.0' maxCpus='255'>pc</machine>
|
||||
# ...
|
||||
# <machine maxCpus='255'>pc-1.0</machine>
|
||||
# <machine maxCpus='255'>pc-0.13</machine>
|
||||
# <domain type='qemu'/>
|
||||
# <domain type='kvm'>
|
||||
# <emulator>/usr/libexec/qemu-kvm</emulator>
|
||||
# <machine maxCpus='240'>pc-i440fx-rhel7.4.0</machine>
|
||||
# <machine canonical='pc-i440fx-rhel7.4.0' maxCpus='240'>pc</machine>
|
||||
# ...
|
||||
# <machine maxCpus='240'>rhel6.2.0</machine>
|
||||
# <machine maxCpus='240'>pc-i440fx-rhel7.3.0</machine>
|
||||
# </domain>
|
||||
# </arch>
|
||||
# ...
|
||||
# </guest>
|
||||
|
||||
a_machines = []
|
||||
|
||||
['kvm', 'kqemu', 'qemu', ''].each { |type|
|
||||
if type.empty?
|
||||
d_elem = a_elem
|
||||
else
|
||||
d_elem = a_elem.elements["domain[@type='#{type}']"]
|
||||
end
|
||||
|
||||
if d_elem
|
||||
d_elem.elements.each('machine') { |m|
|
||||
a_machines << m.text
|
||||
}
|
||||
|
||||
# take only first found domain type
|
||||
unless a_machines.empty?
|
||||
machines.concat(a_machines)
|
||||
break
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
cmd = "virsh -r -c qemu:///system cpu-models #{a}"
|
||||
cpu_models, e, s = Open3.capture3(cmd)
|
||||
break unless s.success?
|
||||
|
||||
cpu_models.each_line { |l|
|
||||
l.chomp!
|
||||
next if l.empty? or l =~ /all CPU models are accepted/i;
|
||||
models << l
|
||||
}
|
||||
}
|
||||
|
||||
machines.uniq!
|
||||
models.uniq!
|
||||
|
||||
puts "KVM_MACHINES=\"#{machines.join(' ')}\""
|
||||
puts "KVM_CPU_MODELS=\"#{models.join(' ')}\""
|
||||
puts "KVM_CPU_MODEL=\"#{cap_xml.elements['host/cpu/model'].text}\""
|
||||
|
||||
rescue
|
||||
end
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
../../../node-probes.d/monitor_ds.rb
|
@ -1 +0,0 @@
|
||||
../../../node-probes.d/name.sh
|
@ -1 +0,0 @@
|
||||
../../../node-probes.d/numa_host.rb
|
@ -1 +0,0 @@
|
||||
../../../node-probes.d/pci.rb
|
@ -1 +0,0 @@
|
||||
../../../common.d/version.sh
|
@ -1,7 +0,0 @@
|
||||
#!/usr/bin/ruby
|
||||
|
||||
require_relative '../../../lib/kvm'
|
||||
|
||||
KVM.load_conf
|
||||
|
||||
puts DomainList.wilds_info
|
@ -1 +0,0 @@
|
||||
../node-probes.d/pci.conf
|
@ -1 +0,0 @@
|
||||
../../../node-probes.d/monitor_ds_vm.rb
|
@ -1,7 +0,0 @@
|
||||
#!/usr/bin/ruby
|
||||
|
||||
require_relative '../../../lib/kvm'
|
||||
|
||||
KVM.load_conf
|
||||
|
||||
puts DomainList.info
|
@ -1,99 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2021, 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. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
require 'rexml/document'
|
||||
require 'fileutils'
|
||||
require 'open3'
|
||||
require 'base64'
|
||||
|
||||
def xml_elem(xml, xpath)
|
||||
rexml = REXML::Document.new(xml).root
|
||||
rexml.elements[xpath].text.to_s
|
||||
rescue StandardError
|
||||
nil
|
||||
end
|
||||
|
||||
ds_loc = xml_elem(STDIN.read, 'DATASTORE_LOCATION')
|
||||
ds_loc ||= '/var/lib/one/datastores'
|
||||
Dir.chdir ds_loc
|
||||
|
||||
datastores = Dir.glob('*').select do |f|
|
||||
File.directory?(f) && f.match(/^\d+$/)
|
||||
end
|
||||
|
||||
monitor_data = []
|
||||
|
||||
datastores.each do |ds|
|
||||
# Skip if datastore is not ssh
|
||||
mark = "#{ds_loc}/#{ds}/.monitor"
|
||||
next unless File.exist? mark
|
||||
|
||||
driver = File.read mark
|
||||
driver.chomp!
|
||||
next unless driver == 'ssh'
|
||||
|
||||
# for all VMs
|
||||
Dir.entries("#{ds_loc}/#{ds}").each do |vm_id|
|
||||
vm_dir = "#{ds_loc}/#{ds}/#{vm_id}"
|
||||
next if vm_id !~ /^\d+$/
|
||||
next unless File.directory?(vm_dir)
|
||||
|
||||
disk_data = []
|
||||
# for all disks
|
||||
Dir.entries(vm_dir).each do |disk|
|
||||
next if disk !~ /^disk.\d+$/
|
||||
next unless File.file?("#{vm_dir}/#{disk}.snap/base.1")
|
||||
next unless File.file?("#{vm_dir}/vm.xml")
|
||||
next unless File.file?("#{vm_dir}/ds.xml")
|
||||
|
||||
disk_id = disk.split('.')[1]
|
||||
|
||||
replica = xml_elem(File.read("#{vm_dir}/ds.xml"),
|
||||
'/DATASTORE/TEMPLATE/REPLICA_HOST')
|
||||
|
||||
freq = xml_elem(File.read("#{vm_dir}/vm.xml"),
|
||||
"/VM/TEMPLATE/DISK[DISK_ID=#{disk_id}]/" <<
|
||||
'RECOVERY_SNAPSHOT_FREQ')
|
||||
|
||||
rs_script = '/var/tmp/one/tm/ssh/recovery_snap_create_live'
|
||||
next if freq.empty? || replica.empty? || !File.exist?(rs_script)
|
||||
|
||||
o, _e, s = Open3.capture3("#{rs_script} #{vm_id} " <<
|
||||
"#{vm_dir}/#{disk} " <<
|
||||
"#{freq} #{replica}")
|
||||
o.chomp!
|
||||
|
||||
if s.exitstatus == 0
|
||||
disk_data << \
|
||||
'DISK_RECOVERY_SNAPSHOT = ' \
|
||||
"[ ID=#{disk_id}, TIMESTAMP=\"#{o}\" ]"
|
||||
else
|
||||
disk_data << \
|
||||
'DISK_RECOVERY_SNAPSHOT = ' \
|
||||
"[ ID=#{disk_id}, MSG=\"ERROR #{o}\" ]"
|
||||
end
|
||||
end
|
||||
|
||||
next if disk_data.empty?
|
||||
|
||||
enc_data = Base64.strict_encode64(disk_data.join("\n"))
|
||||
monitor_data << \
|
||||
"VM = [ ID=\"#{vm_id}\", MONITOR=\"#{enc_data}\" ]"
|
||||
end
|
||||
end
|
||||
|
||||
puts monitor_data.join("\n")
|
@ -1,30 +0,0 @@
|
||||
#!/usr/bin/ruby
|
||||
|
||||
require_relative '../../../lib/kvm'
|
||||
require_relative '../../../lib/probe_db'
|
||||
|
||||
xml_txt = STDIN.read
|
||||
host = ARGV[-1]
|
||||
host_id = ARGV[-2]
|
||||
|
||||
begin
|
||||
config = REXML::Document.new(xml_txt).root
|
||||
sync = config.elements['PROBES_PERIOD/SYNC_STATE_VM'].text.to_i
|
||||
rescue StandardError
|
||||
sync = 180
|
||||
end
|
||||
|
||||
KVM.load_conf
|
||||
|
||||
begin
|
||||
vmdb = VirtualMachineDB.new('kvm',
|
||||
host,
|
||||
host_id,
|
||||
:missing_state => 'POWEROFF',
|
||||
:sync => sync)
|
||||
vmdb.purge
|
||||
|
||||
puts vmdb.to_status
|
||||
rescue StandardError => e
|
||||
puts e
|
||||
end
|
1
src/im_mad/remotes/qemu.d
Symbolic link
1
src/im_mad/remotes/qemu.d
Symbolic link
@ -0,0 +1 @@
|
||||
kvm.d/
|
@ -1 +0,0 @@
|
||||
../common.d/monitord-client.rb
|
@ -1 +0,0 @@
|
||||
../common.d/monitord-client_control.sh
|
Loading…
x
Reference in New Issue
Block a user