mirror of
https://github.com/OpenNebula/one.git
synced 2026-10-23 03:37:33 +09:00
The remote scripts directory (former SCRIPTS_REMOTE_DIR) is now fixed
to /var/lib/one-remotes and the configuration attribute is gone. The
old default /var/tmp/one was broken in several ways: /var/tmp content
is aged away by systemd-tmpfiles, the world-writable parent allows
squatting on the directory, and the configurable location was silently
not honored by many drivers, probes and static files (sudoers,
AppArmor, tmpfiles, cron).
- The remotes are synced to /var/lib/one-remotes on the hosts; the
directory is created by the node packages, as it cannot be created
by the unprivileged oneadmin
- The node monitoring DB moves along to /var/lib/one-remotes-db;
it cannot live inside the remotes directory as the sync
(rsync --delete) would remove it. The monitord client migrates
the DB from the legacy location on its first start
- Helpers executed through sudo are installed at a fixed path
(/usr/lib/one/sbin) by the node packages, so they are no longer
executed from an oneadmin-writable location
- Remote hooks (REMOTE = yes) run from /var/lib/one-remotes/hooks.
Hook commands given as an absolute path are executed as-is and
must be updated manually
- Fix remotes sync to run the mkdir on the host: the local shell
interpreted the unquoted ';' and ran it on the frontend instead
- onecfg migrator drops SCRIPTS_REMOTE_DIR from oned.conf and the
stock :remote_hook_base_path from onehem-server.conf
This commit is contained in:
1 parent
aae2db9f8d
commit
82196ef2be
56 files changed
+165
-122
No files matched your search
+13
-4
@@ -90,6 +90,7 @@ fi
|
||||
if [ -z "$ROOT" ] ; then
|
||||
BIN_LOCATION="/usr/bin"
|
||||
LIB_LOCATION="/usr/lib/one"
|
||||
LIBEXEC_LOCATION="/usr/libexec/one"
|
||||
SBIN_LOCATION="/usr/sbin"
|
||||
ETC_LOCATION="/etc/one"
|
||||
LOG_LOCATION="/var/log/one"
|
||||
@@ -139,6 +140,7 @@ else
|
||||
BIN_LOCATION="$ROOT/bin"
|
||||
SBIN_LOCATION="$ROOT/sbin"
|
||||
LIB_LOCATION="$ROOT/lib"
|
||||
LIBEXEC_LOCATION="$ROOT/libexec"
|
||||
ETC_LOCATION="$ROOT/etc"
|
||||
VAR_LOCATION="$ROOT/var"
|
||||
RUN_LOCATION="$VAR_LOCATION/run"
|
||||
@@ -237,7 +239,7 @@ INSTALL_FILES=(
|
||||
MAD_RUBY_LIB_FILES:"$LIB_LOCATION"/ruby
|
||||
MAD_RUBY_LIB_FILES:"$VAR_LOCATION"/remotes
|
||||
MADS_LIB_FILES:"$LIB_LOCATION"/mads
|
||||
REMOTE_FILES:"$VAR_LOCATION"/remotes
|
||||
SUDO_SBIN_FILES:"$LIBEXEC_LOCATION"
|
||||
|
||||
IM_PROBES_FILES:"$VAR_LOCATION"/remotes/im
|
||||
IM_PROBES_ETC_KVM_PROBES_FILES:"$VAR_LOCATION"/remotes/etc/im/kvm-probes.d
|
||||
@@ -361,7 +363,7 @@ INSTALL_TREES=(
|
||||
src/schedm_mad/remotes/one_drs/lib:"$VAR_LOCATION"/remotes/scheduler/one_drs/lib:mapper,models
|
||||
src/schedm_mad/remotes/one_drs/lib/mapper:"$VAR_LOCATION"/remotes/scheduler/one_drs/lib/mapper
|
||||
src/schedm_mad/remotes/one_drs/lib/models:"$VAR_LOCATION"/remotes/scheduler/one_drs/lib/models
|
||||
src/vnm_mad/remotes/lib:"$VAR_LOCATION"/remotes/vnm
|
||||
src/vnm_mad/remotes/lib:"$VAR_LOCATION"/remotes/vnm:ip_netns_exec,tproxy
|
||||
src/cli/one_helper:"$LIB_LOCATION"/ruby/cli/one_helper
|
||||
src/cloud/common:"$LIB_LOCATION"/ruby/cloud:CloudAuth
|
||||
src/cloud/common/CloudAuth:"$LIB_LOCATION"/ruby/cloud/CloudAuth:SunstoneCloudAuth.rb
|
||||
@@ -662,8 +664,15 @@ RUBY_AUTH_LIB_FILES="src/authm_mad/remotes/ssh/ssh_auth.rb \
|
||||
# and remotes directory
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
REMOTE_FILES="src/vmm_mad/remotes/kvm/vgpu
|
||||
src/vmm_mad/remotes/kvm/vtpm_setup"
|
||||
#-------------------------------------------------------------------------------
|
||||
# Host helper files executed through sudo, installed under $LIBEXEC_LOCATION
|
||||
# by the node packages. Referenced by the sudoers rules
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
SUDO_SBIN_FILES="src/vmm_mad/remotes/kvm/vgpu
|
||||
src/vmm_mad/remotes/kvm/vtpm_setup
|
||||
src/vnm_mad/remotes/lib/tproxy
|
||||
src/vnm_mad/remotes/lib/ip_netns_exec"
|
||||
|
||||
MAD_RUBY_LIB_FILES="src/mad/ruby/DriverLogger.rb \
|
||||
src/mad/ruby/CommandManager.rb"
|
||||
|
||||
@@ -301,7 +301,6 @@
|
||||
<xs:element name="SCHED_MAX_WND_TIME" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="SCHED_RETRY_TIME" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
|
||||
<xs:element name="SCRIPTS_REMOTE_DIR" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="SESSION_EXPIRATION_TIME" type="xs:integer" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="SHOWBACK_ONLY_RUNNING" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element name="TIMEOUT" type="xs:integer" minOccurs="0" maxOccurs="1"/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
SHELL=/bin/sh
|
||||
|
||||
# activate LVM volumes on reboot
|
||||
@reboot oneadmin test -x /var/tmp/one/tm/fs_lvm/activate && /var/tmp/one/tm/fs_lvm/activate >/dev/null 2>&1
|
||||
@reboot oneadmin test -x /var/lib/one-remotes/tm/fs_lvm/activate && /var/lib/one-remotes/tm/fs_lvm/activate >/dev/null 2>&1
|
||||
@@ -15,9 +15,6 @@
|
||||
# DS_MONITOR_VM_DISK: Number of MONITORING_INTERVAL_DATASTORE intervals to monitor
|
||||
# VM disks. 0 to disable. Only applies to fs and fs_lvm datastores
|
||||
#
|
||||
# SCRIPTS_REMOTE_DIR: Remote path to store the monitoring and VM management
|
||||
# scripts.
|
||||
#
|
||||
# DB: Configuration attributes for the database backend
|
||||
# backend : can be sqlite or mysql (default is sqlite)
|
||||
# server : (mysql) host name or an IP address for the MySQL server
|
||||
@@ -75,8 +72,6 @@ MONITORING_INTERVAL_MARKET = 600
|
||||
|
||||
#DS_MONITOR_VM_DISK = 10
|
||||
|
||||
SCRIPTS_REMOTE_DIR=/var/tmp/one
|
||||
|
||||
DB = [ BACKEND = "sqlite",
|
||||
TIMEOUT = 2500 ]
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@ Cmnd_Alias ONE_LVM = /usr/sbin/lvcreate, /usr/sbin/lvremove, /usr/sbin/lvs, /usr
|
||||
Cmnd_Alias ONE_NFS = /usr/bin/mount, /usr/bin/umount, /usr/bin/sed -i -f /proc/self/fd/0 /etc/fstab
|
||||
Cmnd_Alias ONE_LXC = /usr/bin/mount, /usr/bin/umount, /usr/bin/bindfs, /usr/sbin/losetup, /usr/bin/qemu-nbd, /usr/bin/lxc-attach, /usr/bin/lxc-config, /usr/bin/lxc-create, /usr/bin/lxc-destroy, /usr/bin/lxc-info, /usr/bin/lxc-ls, /usr/bin/lxc-start, /usr/bin/lxc-stop, /usr/bin/lxc-console, /usr/bin/lxc-device, /usr/bin/lxc-freeze, /usr/bin/lxc-unfreeze, /usr/sbin/e2fsck, /usr/sbin/resize2fs, /usr/sbin/xfs_growfs, /usr/bin/rbd-nbd
|
||||
Cmnd_Alias ONE_MARKET = /usr/lib/one/sh/create_container_image.sh
|
||||
Cmnd_Alias ONE_NET = /usr/sbin/iptables, /usr/sbin/ip6tables, /usr/sbin/ipset, /usr/sbin/ip link *, /usr/sbin/ip neighbour *, /usr/sbin/ip route *, /usr/sbin/ip rule *, /usr/sbin/ip tuntap *, /usr/sbin/nft, /var/tmp/one/vnm/tproxy, /usr/sbin/bridge vlan *, /usr/sbin/devlink, /usr/sbin/ethtool
|
||||
Cmnd_Alias ONE_NET = /usr/sbin/iptables, /usr/sbin/ip6tables, /usr/sbin/ipset, /usr/sbin/ip link *, /usr/sbin/ip neighbour *, /usr/sbin/ip route *, /usr/sbin/ip rule *, /usr/sbin/ip tuntap *, /usr/sbin/nft, /usr/libexec/one/tproxy, /usr/sbin/bridge vlan *, /usr/sbin/devlink, /usr/sbin/ethtool
|
||||
Cmnd_Alias ONE_SCSI = /usr/sbin/blockdev, /usr/sbin/multipath, /usr/sbin/multipathd, /usr/sbin/iscsiadm, /usr/bin/tee, /usr/bin/find, /usr/bin/cat /etc/iscsi/initiatorname.iscsi
|
||||
Cmnd_Alias ONE_NETNS = /usr/sbin/ip netns add *, /usr/sbin/ip netns delete *, /usr/sbin/ip netns pids *, /var/tmp/one/vnm/ip_netns_exec ip address *, /var/tmp/one/vnm/ip_netns_exec ip link *, /var/tmp/one/vnm/ip_netns_exec ip -j link show *, /var/tmp/one/vnm/ip_netns_exec ip route *, /var/tmp/one/vnm/ip_netns_exec sysctl -w net.ipv4.conf.all.arp_ignore=0 net.ipv4.conf.default.arp_ignore=0
|
||||
Cmnd_Alias ONE_NETNS = /usr/sbin/ip netns add *, /usr/sbin/ip netns delete *, /usr/sbin/ip netns pids *, /usr/libexec/one/ip_netns_exec ip address *, /usr/libexec/one/ip_netns_exec ip link *, /usr/libexec/one/ip_netns_exec ip -j link show *, /usr/libexec/one/ip_netns_exec ip route *, /usr/libexec/one/ip_netns_exec sysctl -w net.ipv4.conf.all.arp_ignore=0 net.ipv4.conf.default.arp_ignore=0
|
||||
Cmnd_Alias ONE_OVS = /usr/bin/ovs-ofctl, /usr/bin/ovs-vsctl, /usr/bin/ovs-appctl
|
||||
Cmnd_Alias ONE_MEM = /usr/sbin/sysctl vm.drop_caches=3 vm.compact_memory=1
|
||||
Cmnd_Alias ONE_VGPU = /var/tmp/one/vgpu
|
||||
Cmnd_Alias ONE_VTPM = /var/tmp/one/vtpm_setup
|
||||
Cmnd_Alias ONE_VGPU = /usr/libexec/one/vgpu
|
||||
Cmnd_Alias ONE_VTPM = /usr/libexec/one/vtpm_setup
|
||||
Cmnd_Alias ONE_OVIRTAPI = /usr/bin/qemu-nbd
|
||||
Cmnd_Alias ONE_FABRIC = /usr/sbin/dmidecode *
|
||||
Cmnd_Alias ONE_FS = /usr/sbin/mkfs
|
||||
|
||||
@@ -6,13 +6,13 @@ Cmnd_Alias ONE_LVM = /usr/sbin/lvcreate, /usr/sbin/lvremove, /usr/sbin/lvs, /usr
|
||||
Cmnd_Alias ONE_NFS = /usr/bin/mount, /usr/bin/umount, /usr/bin/sed -i -f /proc/self/fd/0 /etc/fstab
|
||||
Cmnd_Alias ONE_LXC = /usr/bin/mount, /usr/bin/umount, /usr/bin/bindfs, /usr/sbin/losetup, /usr/bin/qemu-nbd, /usr/bin/lxc-attach, /usr/bin/lxc-config, /usr/bin/lxc-create, /usr/bin/lxc-destroy, /usr/bin/lxc-info, /usr/bin/lxc-ls, /usr/bin/lxc-start, /usr/bin/lxc-stop, /usr/bin/lxc-console, /usr/bin/lxc-device, /usr/bin/lxc-freeze, /usr/bin/lxc-unfreeze, /usr/sbin/e2fsck, /usr/sbin/resize2fs, /usr/sbin/xfs_growfs, /usr/bin/rbd-nbd
|
||||
Cmnd_Alias ONE_MARKET = /usr/lib/one/sh/create_container_image.sh
|
||||
Cmnd_Alias ONE_NET = /usr/sbin/iptables, /usr/sbin/ip6tables, /usr/sbin/ipset, /usr/sbin/ip link *, /usr/sbin/ip neighbour *, /usr/sbin/ip route *, /usr/sbin/ip rule *, /usr/sbin/ip tuntap *, /usr/sbin/nft, /var/tmp/one/vnm/tproxy, /usr/sbin/bridge vlan *, /usr/sbin/devlink, /usr/sbin/ethtool
|
||||
Cmnd_Alias ONE_NET = /usr/sbin/iptables, /usr/sbin/ip6tables, /usr/sbin/ipset, /usr/sbin/ip link *, /usr/sbin/ip neighbour *, /usr/sbin/ip route *, /usr/sbin/ip rule *, /usr/sbin/ip tuntap *, /usr/sbin/nft, /usr/libexec/one/tproxy, /usr/sbin/bridge vlan *, /usr/sbin/devlink, /usr/sbin/ethtool
|
||||
Cmnd_Alias ONE_SCSI = /usr/sbin/blockdev, /usr/sbin/multipath, /usr/sbin/multipathd, /usr/sbin/iscsiadm, /usr/bin/tee, /usr/bin/find, /usr/bin/cat /etc/iscsi/initiatorname.iscsi
|
||||
Cmnd_Alias ONE_NETNS = /usr/sbin/ip netns add *, /usr/sbin/ip netns delete *, /usr/sbin/ip netns pids *, /var/tmp/one/vnm/ip_netns_exec ip address *, /var/tmp/one/vnm/ip_netns_exec ip link *, /var/tmp/one/vnm/ip_netns_exec ip -j link show *, /var/tmp/one/vnm/ip_netns_exec ip route *, /var/tmp/one/vnm/ip_netns_exec sysctl -w net.ipv4.conf.all.arp_ignore=0 net.ipv4.conf.default.arp_ignore=0
|
||||
Cmnd_Alias ONE_NETNS = /usr/sbin/ip netns add *, /usr/sbin/ip netns delete *, /usr/sbin/ip netns pids *, /usr/libexec/one/ip_netns_exec ip address *, /usr/libexec/one/ip_netns_exec ip link *, /usr/libexec/one/ip_netns_exec ip -j link show *, /usr/libexec/one/ip_netns_exec ip route *, /usr/libexec/one/ip_netns_exec sysctl -w net.ipv4.conf.all.arp_ignore=0 net.ipv4.conf.default.arp_ignore=0
|
||||
Cmnd_Alias ONE_OVS = /usr/bin/ovs-ofctl, /usr/bin/ovs-vsctl, /usr/bin/ovs-appctl
|
||||
Cmnd_Alias ONE_MEM = /usr/sbin/sysctl vm.drop_caches=3 vm.compact_memory=1
|
||||
Cmnd_Alias ONE_VGPU = /var/tmp/one/vgpu
|
||||
Cmnd_Alias ONE_VTPM = /var/tmp/one/vtpm_setup
|
||||
Cmnd_Alias ONE_VGPU = /usr/libexec/one/vgpu
|
||||
Cmnd_Alias ONE_VTPM = /usr/libexec/one/vtpm_setup
|
||||
Cmnd_Alias ONE_OVIRTAPI = /usr/bin/qemu-nbd
|
||||
Cmnd_Alias ONE_FABRIC = /usr/sbin/dmidecode *
|
||||
Cmnd_Alias ONE_FS = /usr/sbin/mkfs
|
||||
|
||||
@@ -7,13 +7,13 @@ Cmnd_Alias ONE_LVM = /usr/sbin/lvcreate, /usr/sbin/lvremove, /usr/sbin/lvs, /usr
|
||||
Cmnd_Alias ONE_NFS = /usr/bin/mount, /usr/bin/umount, /usr/bin/sed -i -f /proc/self/fd/0 /etc/fstab
|
||||
Cmnd_Alias ONE_LXC = /usr/bin/mount, /usr/bin/umount, /usr/bin/bindfs, /usr/sbin/losetup, /usr/bin/qemu-nbd, /usr/bin/lxc-attach, /usr/bin/lxc-config, /usr/bin/lxc-create, /usr/bin/lxc-destroy, /usr/bin/lxc-info, /usr/bin/lxc-ls, /usr/bin/lxc-start, /usr/bin/lxc-stop, /usr/bin/lxc-console, /usr/bin/lxc-device, /usr/bin/lxc-freeze, /usr/bin/lxc-unfreeze, /usr/sbin/e2fsck, /usr/sbin/resize2fs, /usr/sbin/xfs_growfs, /usr/bin/rbd-nbd
|
||||
Cmnd_Alias ONE_MARKET = /usr/lib/one/sh/create_container_image.sh
|
||||
Cmnd_Alias ONE_NET = /usr/sbin/iptables, /usr/sbin/ip6tables, /usr/sbin/ipset, /usr/sbin/ip link *, /usr/sbin/ip neighbour *, /usr/sbin/ip route *, /usr/sbin/ip rule *, /usr/sbin/ip tuntap *, /usr/sbin/nft, /var/tmp/one/vnm/tproxy, /usr/sbin/bridge vlan *, /usr/sbin/devlink, /usr/sbin/ethtool
|
||||
Cmnd_Alias ONE_NET = /usr/sbin/iptables, /usr/sbin/ip6tables, /usr/sbin/ipset, /usr/sbin/ip link *, /usr/sbin/ip neighbour *, /usr/sbin/ip route *, /usr/sbin/ip rule *, /usr/sbin/ip tuntap *, /usr/sbin/nft, /usr/libexec/one/tproxy, /usr/sbin/bridge vlan *, /usr/sbin/devlink, /usr/sbin/ethtool
|
||||
Cmnd_Alias ONE_SCSI = /usr/sbin/blockdev, /usr/sbin/multipath, /usr/sbin/multipathd, /sbin/iscsiadm, /usr/bin/tee, /usr/bin/find, /usr/bin/cat /etc/iscsi/initiatorname.iscsi
|
||||
Cmnd_Alias ONE_NETNS = /usr/sbin/ip netns add *, /usr/sbin/ip netns delete *, /usr/sbin/ip netns pids *, /var/tmp/one/vnm/ip_netns_exec ip address *, /var/tmp/one/vnm/ip_netns_exec ip link *, /var/tmp/one/vnm/ip_netns_exec ip -j link show *, /var/tmp/one/vnm/ip_netns_exec ip route *, /var/tmp/one/vnm/ip_netns_exec sysctl -w net.ipv4.conf.all.arp_ignore=0 net.ipv4.conf.default.arp_ignore=0
|
||||
Cmnd_Alias ONE_NETNS = /usr/sbin/ip netns add *, /usr/sbin/ip netns delete *, /usr/sbin/ip netns pids *, /usr/libexec/one/ip_netns_exec ip address *, /usr/libexec/one/ip_netns_exec ip link *, /usr/libexec/one/ip_netns_exec ip -j link show *, /usr/libexec/one/ip_netns_exec ip route *, /usr/libexec/one/ip_netns_exec sysctl -w net.ipv4.conf.all.arp_ignore=0 net.ipv4.conf.default.arp_ignore=0
|
||||
Cmnd_Alias ONE_OVS = /usr/bin/ovs-ofctl, /usr/bin/ovs-vsctl, /usr/bin/ovs-appctl
|
||||
Cmnd_Alias ONE_MEM = /usr/sbin/sysctl vm.drop_caches=3 vm.compact_memory=1
|
||||
Cmnd_Alias ONE_VGPU = /var/tmp/one/vgpu
|
||||
Cmnd_Alias ONE_VTPM = /var/tmp/one/vtpm_setup
|
||||
Cmnd_Alias ONE_VGPU = /usr/libexec/one/vgpu
|
||||
Cmnd_Alias ONE_VTPM = /usr/libexec/one/vtpm_setup
|
||||
Cmnd_Alias ONE_OVIRTAPI = /usr/bin/qemu-nbd
|
||||
Cmnd_Alias ONE_FABRIC = /usr/sbin/dmidecode *
|
||||
Cmnd_Alias ONE_FS = /usr/sbin/mkfs
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
x /var/tmp/one/*
|
||||
# Create the OpenNebula remote scripts directory and its metrics DB
|
||||
# sibling. The remotes are synced into it from the Front-end by the
|
||||
# unprivileged oneadmin user, which cannot create it under /var/lib.
|
||||
d /var/lib/one-remotes 0755 oneadmin oneadmin -
|
||||
d /var/lib/one-remotes-db 0755 oneadmin oneadmin -
|
||||
@@ -22,7 +22,7 @@ class Sudoers
|
||||
|
||||
attr_accessor :cmds
|
||||
|
||||
def initialize(lib_location)
|
||||
def initialize(lib_location, libexec_location = '/usr/libexec/one')
|
||||
# Commands required to be used as root, without password, by oneadmin
|
||||
@cmds = {
|
||||
:NET => [
|
||||
@@ -35,7 +35,7 @@ class Sudoers
|
||||
'ip rule *',
|
||||
'ip tuntap *',
|
||||
'nft',
|
||||
'/var/tmp/one/vnm/tproxy',
|
||||
"#{libexec_location}/tproxy",
|
||||
'bridge',
|
||||
'devlink',
|
||||
'ethtool'
|
||||
@@ -44,11 +44,11 @@ class Sudoers
|
||||
'ip netns add *',
|
||||
'ip netns delete *',
|
||||
'ip netns pids *',
|
||||
'/var/tmp/one/vnm/ip_netns_exec ip address *',
|
||||
'/var/tmp/one/vnm/ip_netns_exec ip link *',
|
||||
'/var/tmp/one/vnm/ip_netns_exec ip -j link show *',
|
||||
'/var/tmp/one/vnm/ip_netns_exec ip route *',
|
||||
'/var/tmp/one/vnm/ip_netns_exec sysctl -w ' \
|
||||
"#{libexec_location}/ip_netns_exec ip address *",
|
||||
"#{libexec_location}/ip_netns_exec ip link *",
|
||||
"#{libexec_location}/ip_netns_exec ip -j link show *",
|
||||
"#{libexec_location}/ip_netns_exec ip route *",
|
||||
"#{libexec_location}/ip_netns_exec sysctl -w " \
|
||||
'net.ipv4.conf.all.arp_ignore=0 net.ipv4.conf.default.arp_ignore=0'
|
||||
],
|
||||
:LVM => [
|
||||
@@ -87,8 +87,8 @@ class Sudoers
|
||||
],
|
||||
:MARKET => ["#{lib_location}/sh/create_container_image.sh"],
|
||||
:MEM => ['sysctl vm.drop_caches=3 vm.compact_memory=1'],
|
||||
:VGPU => ['sudo', '/var/tmp/one/vgpu'],
|
||||
:VTPM => ['sudo', '/var/tmp/one/vtpm_setup'],
|
||||
:VGPU => ['sudo', "#{libexec_location}/vgpu"],
|
||||
:VTPM => ['sudo', "#{libexec_location}/vtpm_setup"],
|
||||
:NFS => ['mount', 'umount', '/usr/bin/sed -i -f /proc/self/fd/0 /etc/fstab'],
|
||||
:SCSI => [
|
||||
'blockdev',
|
||||
|
||||
@@ -232,11 +232,7 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
|
||||
|
||||
cluster_id = options[:cluster]
|
||||
|
||||
rc = OpenNebula::System.new(@client).get_configuration
|
||||
return -1, rc.message if OpenNebula.is_error?(rc)
|
||||
|
||||
conf = rc
|
||||
sync_manager = HostSyncManager.new(conf)
|
||||
sync_manager = HostSyncManager.new
|
||||
|
||||
# Verify the existence of REMOTES_LOCATION
|
||||
if !File.directory? REMOTES_LOCATION
|
||||
|
||||
@@ -126,7 +126,7 @@ begin
|
||||
payload = read_exact(socket, bytes_to_write)
|
||||
|
||||
File.open(to, 'r+b') do |file|
|
||||
if total_size > 0 && file.size.zero?
|
||||
if total_size > 0 && file.empty?
|
||||
file.truncate(total_size)
|
||||
end
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class Restic
|
||||
RESTIC_BIN_PATHS = {
|
||||
:frontend => "#{ENV['ONE_LOCATION']&.then {|p| "#{p}/var" } || '/var/lib/one'}" \
|
||||
'/remotes/datastore/restic/restic',
|
||||
:hypervisor => '/var/tmp/one/datastore/restic/restic'
|
||||
:hypervisor => '/var/lib/one-remotes/datastore/restic/restic'
|
||||
}.freeze
|
||||
|
||||
class << self
|
||||
@@ -675,9 +675,9 @@ class Restic
|
||||
mkdir -p '#{@path}/'
|
||||
|
||||
# Check if the correct restic binary is available.
|
||||
[[ -x /var/tmp/one/datastore/restic/restic ]] && \
|
||||
[[ -f /var/tmp/one/VERSION ]] && \
|
||||
[[ '#{one_version}' = $(head -1 /var/tmp/one/VERSION) ]] && \
|
||||
[[ -x /var/lib/one-remotes/datastore/restic/restic ]] && \
|
||||
[[ -f /var/lib/one-remotes/VERSION ]] && \
|
||||
[[ '#{one_version}' = $(head -1 /var/lib/one-remotes/VERSION) ]] && \
|
||||
echo true || echo false
|
||||
|
||||
# Collect filesystem stats.
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
# :remote_hook_base_path location of hook scripts when commands not given as an
|
||||
# absolute path and REMOTE = yes is specified
|
||||
:hook_base_path: '/var/lib/one/remotes/hooks'
|
||||
:remote_hook_base_path: '/var/tmp/one/hooks'
|
||||
#:remote_hook_base_path: '/var/lib/one-remotes/hooks'
|
||||
|
||||
# :subscriber_endpoint to subscribe for OpenNebula events must match those in
|
||||
# oned.conf
|
||||
|
||||
@@ -24,7 +24,7 @@ if !ONE_LOCATION
|
||||
ETC_LOCATION = '/etc/one'
|
||||
LIB_LOCATION = '/usr/lib/one'
|
||||
HOOK_LOCATION = '/var/lib/one/remotes/hooks'
|
||||
REMOTE_HOOK_LOCATION = '/var/tmp/one/hooks'
|
||||
REMOTE_HOOK_LOCATION = '/var/lib/one-remotes/hooks'
|
||||
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
|
||||
GEMS_LOCATION = '/usr/share/one/gems'
|
||||
else
|
||||
@@ -33,7 +33,7 @@ else
|
||||
ETC_LOCATION = ONE_LOCATION + '/etc'
|
||||
LIB_LOCATION = ONE_LOCATION + '/lib'
|
||||
HOOK_LOCATION = ONE_LOCATION + '/var/remotest/hooks'
|
||||
REMOTE_HOOK_LOCATION = '/var/tmp/one/hooks'
|
||||
REMOTE_HOOK_LOCATION = '/var/lib/one-remotes/hooks'
|
||||
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
|
||||
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
||||
end
|
||||
|
||||
@@ -220,9 +220,9 @@ end
|
||||
#-------------------------------------------------------------------------------
|
||||
# Configuration (from monitord)
|
||||
# DB_PATH: Folder to include metrics DB for forecasting. It also includes
|
||||
# local additions in the hypervisor (/var/tmp/one uses rsync --delete)
|
||||
# local additions in the hypervisor (/var/lib/one-remotes uses rsync --delete)
|
||||
#-------------------------------------------------------------------------------
|
||||
DB_PATH = '/var/tmp/one_db'
|
||||
DB_PATH = '/var/lib/one-remotes-db'
|
||||
ETC_PATH = "#{DB_PATH}/etc"
|
||||
PCI_CACHE = "#{DB_PATH}/pci_net_names"
|
||||
PID_FILE = "#{DB_PATH}/.monitor_client.pid"
|
||||
@@ -230,6 +230,17 @@ PID_FILE = "#{DB_PATH}/.monitor_client.pid"
|
||||
MONITORD_CONF = "#{ETC_PATH}/monitord.conf"
|
||||
|
||||
FileUtils.mkdir_p(DB_PATH)
|
||||
|
||||
# One-time migration of the metrics DB from the pre-7.6 location. This
|
||||
# client is the only writer of the DB files and any old client has been
|
||||
# stopped before this one is started, so the move is race free.
|
||||
LEGACY_DB_PATH = '/var/tmp/one_db'
|
||||
|
||||
if !File.exist?(File.join(DB_PATH, 'host.db')) && File.directory?(LEGACY_DB_PATH)
|
||||
FileUtils.mv(Dir.glob("#{LEGACY_DB_PATH}/*"), DB_PATH, :force => true)
|
||||
FileUtils.rm_rf(LEGACY_DB_PATH)
|
||||
end
|
||||
|
||||
FileUtils.rm_rf(PCI_CACHE)
|
||||
FileUtils.mkdir_p(ETC_PATH)
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ datastores.each do |ds|
|
||||
"/VM/TEMPLATE/DISK[DISK_ID=#{disk_id}]/" <<
|
||||
'RECOVERY_SNAPSHOT_FREQ')
|
||||
|
||||
rs_script = '/var/tmp/one/tm/ssh/recovery_snap_create_live'
|
||||
rs_script = '/var/lib/one-remotes/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} " <<
|
||||
|
||||
@@ -53,7 +53,7 @@ class BaseDomain
|
||||
DB_MONITOR_KEYS = MONITOR_KEYS.clone
|
||||
DB_MONITOR_KEYS.freeze
|
||||
|
||||
DB_PATH = '/var/tmp/one_db'
|
||||
DB_PATH = '/var/lib/one-remotes-db'
|
||||
|
||||
def initialize(name)
|
||||
@name = name
|
||||
|
||||
@@ -155,7 +155,7 @@ end
|
||||
#-------------------------------------------------------------------------------
|
||||
class Domain < BaseDomain
|
||||
|
||||
DB_PATH = '/var/tmp/one_db'
|
||||
DB_PATH = '/var/lib/one-remotes-db'
|
||||
|
||||
def initialize(name)
|
||||
super(name)
|
||||
@@ -304,7 +304,7 @@ class Domain < BaseDomain
|
||||
|
||||
# Compute forecast values for the VM metrics
|
||||
def predictions
|
||||
base = '/var/tmp/one/im/lib/python/prediction.sh'
|
||||
base = '/var/lib/one-remotes/im/lib/python/prediction.sh'
|
||||
cmd = "#{base} --entity virtualmachine,#{@vm[:id]},#{@vm[:uuid]},#{DB_PATH}"
|
||||
|
||||
o, _e, s = Open3.capture3 cmd
|
||||
|
||||
@@ -38,7 +38,7 @@ class LinuxHost
|
||||
'nettx' => ->(m) { m.net[:tx] }
|
||||
}
|
||||
|
||||
DB_PATH = '/var/tmp/one_db'
|
||||
DB_PATH = '/var/lib/one-remotes-db'
|
||||
DB_NAME = 'host.db'
|
||||
|
||||
######
|
||||
|
||||
@@ -137,7 +137,7 @@ end
|
||||
#-------------------------------------------------------------------------------
|
||||
class Domain < BaseDomain
|
||||
|
||||
DB_PATH = '/var/tmp/one_db'
|
||||
DB_PATH = '/var/lib/one-remotes-db'
|
||||
|
||||
def initialize(name)
|
||||
super(name)
|
||||
@@ -189,7 +189,7 @@ class Domain < BaseDomain
|
||||
|
||||
# Compute forecast values for the VM metrics
|
||||
def predictions
|
||||
base = '/var/tmp/one/im/lib/python/prediction.sh'
|
||||
base = '/var/lib/one-remotes/im/lib/python/prediction.sh'
|
||||
cmd = "#{base} --entity virtualmachine,#{@vm[:id]},#{@vm[:uuid]},#{DB_PATH}"
|
||||
|
||||
o, _e, s = Open3.capture3 cmd
|
||||
|
||||
@@ -376,8 +376,8 @@ DERIVED_METRICS = [
|
||||
]
|
||||
|
||||
# Path constants
|
||||
FORECAST_CONFIG_FILE = "/var/tmp/one/etc/im/kvm-probes.d/forecast.conf"
|
||||
ENTITIES_CONFIG_FILE = "/var/tmp/one_db/config"
|
||||
FORECAST_CONFIG_FILE = "/var/lib/one-remotes/etc/im/kvm-probes.d/forecast.conf"
|
||||
ENTITIES_CONFIG_FILE = "/var/lib/one-remotes-db/config"
|
||||
|
||||
# ########################
|
||||
# Main functions
|
||||
|
||||
@@ -19,7 +19,7 @@ require 'fileutils'
|
||||
|
||||
begin
|
||||
FILE_PATTERN = '*.db'
|
||||
DB_DIR_PATH = '/var/tmp/one_db/'
|
||||
DB_DIR_PATH = '/var/lib/one-remotes-db/'
|
||||
OLD_THRESHOLD = 6 * 7 * 24 * 60 * 60 # 6 weeks in seconds
|
||||
|
||||
threshold = Time.now - OLD_THRESHOLD
|
||||
|
||||
@@ -71,7 +71,7 @@ datastores.each do |ds|
|
||||
driver.chomp!
|
||||
|
||||
# NOTE: tm folder may not be defined relative for custom datastore_location
|
||||
tm_script = "/var/tmp/one/tm/#{driver}/monitor_ds"
|
||||
tm_script = "/var/lib/one-remotes/tm/#{driver}/monitor_ds"
|
||||
|
||||
next unless File.exist? tm_script
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ UDEV_RENAMES = extract_pci_interfaces('/etc/udev/rules.d/99-rename.rules')
|
||||
|
||||
# File-based cache for network interface names.
|
||||
# Stores mappings as files: `<dir>/<pci_address>` contains `<ifname>`.
|
||||
NET_NAMES_CACHE_DIR = '/var/tmp/one_db/pci_net_names'
|
||||
NET_NAMES_CACHE_DIR = '/var/lib/one-remotes-db/pci_net_names'
|
||||
|
||||
begin
|
||||
probes_path = File.dirname(File.realdirpath(__FILE__))
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
STDIN=`cat -`
|
||||
|
||||
PYTHON_PATH=/var/tmp/one/im/lib/python
|
||||
PYTHON_PATH=/var/lib/one-remotes/im/lib/python
|
||||
|
||||
PYTHON_VERSION=$(python3 --version | cut -d ' ' -f2)
|
||||
|
||||
@@ -38,7 +38,7 @@ else
|
||||
fi
|
||||
|
||||
HOST_ID=$(echo "${STDIN}" | xmllint --xpath 'string(//HOST_ID)' -)
|
||||
ENTITYH="host,${HOST_ID},0,/var/tmp/one_db"
|
||||
ENTITYH="host,${HOST_ID},0,/var/lib/one-remotes-db"
|
||||
|
||||
export OMP_NUM_THREADS=${OMP_NUM_THREADS:-1}
|
||||
export OPENBLAS_NUM_THREADS=${OPENBLAS_NUM_THREADS:-1}
|
||||
|
||||
@@ -40,7 +40,7 @@ module DriverExecHelper
|
||||
# Initialize module variables
|
||||
def initialize_helper(directory, options)
|
||||
@config = read_configuration
|
||||
@remote_scripts_base_path = @config['SCRIPTS_REMOTE_DIR']
|
||||
@remote_scripts_base_path = '/var/lib/one-remotes'
|
||||
|
||||
@local_actions = options[:local_actions]
|
||||
@per_drvr_local_actions = options[:per_drvr_local_actions] || []
|
||||
|
||||
@@ -24,31 +24,21 @@
|
||||
# rubocop:disable Style/ParallelAssignment
|
||||
|
||||
require 'CommandManager'
|
||||
require 'shellwords'
|
||||
|
||||
# This helper module introduces a common routine that synchronizes
|
||||
# the "remotes".
|
||||
class HostSyncManager
|
||||
|
||||
def initialize(one_config = nil)
|
||||
def initialize
|
||||
one_location = ENV['ONE_LOCATION']&.delete("'")
|
||||
if one_location.nil?
|
||||
@one_config_path = '/var/lib/one/config'
|
||||
@local_scripts_base_path = '/var/lib/one/remotes'
|
||||
else
|
||||
@one_config_path = one_location + '/var/config'
|
||||
@local_scripts_base_path = one_location + '/var/remotes'
|
||||
end
|
||||
|
||||
# Do a simple parsing of the config file unless the values
|
||||
# are already provided. NOTE: We don't care about "arrays" here..
|
||||
one_config ||= File.read(@one_config_path).lines.each_with_object({}) \
|
||||
do |line, object|
|
||||
key, value = line.split('=').map(&:strip)
|
||||
object[key.upcase] = value
|
||||
end
|
||||
|
||||
@remote_scripts_base_path = one_config['SCRIPTS_REMOTE_DIR']
|
||||
@remote_scripts_base_path&.delete!("'")
|
||||
@remote_scripts_base_path = '/var/lib/one-remotes'
|
||||
end
|
||||
|
||||
def update_remotes(hostname, logger = nil, copy_method = :rsync, subset = nil)
|
||||
@@ -69,9 +59,11 @@ class HostSyncManager
|
||||
|
||||
case copy_method
|
||||
when :ssh
|
||||
# Empty the directory instead of recreating it; removing it
|
||||
# would fail as its parent is not writable by oneadmin
|
||||
mkdir_cmd = assemble_cmd.call [
|
||||
"rm -rf '#{@remote_scripts_base_path}'/",
|
||||
"mkdir -p '#{@remote_scripts_base_path}'/"
|
||||
"mkdir -p '#{@remote_scripts_base_path}'/",
|
||||
"find '#{@remote_scripts_base_path}'/ -mindepth 1 -delete"
|
||||
]
|
||||
|
||||
sync_cmd = assemble_cmd.call [
|
||||
@@ -91,8 +83,18 @@ class HostSyncManager
|
||||
]
|
||||
end
|
||||
|
||||
cmd = SSHCommand.run(mkdir_cmd, hostname, logger)
|
||||
return cmd.code if error?(cmd)
|
||||
# Escape the command so it fully runs on the remote side. Otherwise
|
||||
# the local shell would interpret the metacharacters (';', '&&') and
|
||||
# run all but the first command locally.
|
||||
cmd = SSHCommand.run(mkdir_cmd.shellescape, hostname, logger)
|
||||
|
||||
if error?(cmd)
|
||||
STDERR.puts "Could not create '#{@remote_scripts_base_path}' " \
|
||||
"on host '#{hostname}'. The directory is created " \
|
||||
'by the OpenNebula node packages; make sure they ' \
|
||||
'are installed and up to date on the host.'
|
||||
return cmd.code
|
||||
end
|
||||
|
||||
cmd = LocalCommand.run(sync_cmd, logger)
|
||||
return cmd.code if error?(cmd)
|
||||
|
||||
@@ -1378,8 +1378,8 @@ function send_to_monitor {
|
||||
fi
|
||||
|
||||
# Read monitord config
|
||||
if [ -f "/var/tmp/one_db/etc/monitord.conf" ]; then
|
||||
mon_conf="/var/tmp/one_db/etc/monitord.conf"
|
||||
if [ -f "/var/lib/one-remotes-db/etc/monitord.conf" ]; then
|
||||
mon_conf="/var/lib/one-remotes-db/etc/monitord.conf"
|
||||
elif [ -f "/etc/one/monitord.conf" ]; then
|
||||
mon_conf="/etc/one/monitord.conf"
|
||||
elif [ -n "$ONE_LOCATION" ] && [ -f "$ONE_LOCATION/etc/monitord.conf" ]; then
|
||||
|
||||
@@ -217,7 +217,6 @@ void Nebula::start(bool bootstrap_only)
|
||||
int fd;
|
||||
sigset_t mask;
|
||||
int signal;
|
||||
string scripts_remote_dir;
|
||||
SqlDB * db_backend;
|
||||
bool solo;
|
||||
|
||||
@@ -246,8 +245,6 @@ void Nebula::start(bool bootstrap_only)
|
||||
config_file.close();
|
||||
}
|
||||
|
||||
nebula_configuration->get("SCRIPTS_REMOTE_DIR", scripts_remote_dir);
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// Get Hostname
|
||||
// -----------------------------------------------------------
|
||||
|
||||
@@ -26,7 +26,7 @@ if !ONE_LOCATION
|
||||
GEMS_LOCATION ||= '/usr/share/one/gems'
|
||||
LOG_LOCATION ||= '/var/log/one'
|
||||
VAR_LOCATION ||= '/var/lib/one'
|
||||
ETC_LOCATION ||= '/var/tmp/one/etc'
|
||||
ETC_LOCATION ||= '/var/lib/one-remotes/etc'
|
||||
else
|
||||
RUBY_LIB_LOCATION ||= ONE_LOCATION + '/lib/ruby'
|
||||
GEMS_LOCATION ||= ONE_LOCATION + '/share/gems'
|
||||
|
||||
@@ -38,6 +38,33 @@ module Migrator
|
||||
new[:server][:bind] = host if old.key?(:host)
|
||||
new[:server][:port] = port if old.key?(:port)
|
||||
end
|
||||
|
||||
process('/etc/one/oned.conf', 'Augeas::ONE') do |old, new|
|
||||
break unless old && new
|
||||
|
||||
bug7899_scripts_remote_dir(new)
|
||||
end
|
||||
|
||||
process('/etc/one/onehem-server.conf', 'Yaml') do |old, new|
|
||||
break unless old.is_a?(Hash) && new.is_a?(Hash)
|
||||
|
||||
bug7899_remote_hook_base_path(old, new)
|
||||
end
|
||||
end
|
||||
|
||||
# Since 7.5.80 the remote scripts directory is fixed to
|
||||
# /var/lib/one-remotes; the configuration attribute is gone
|
||||
def bug7899_scripts_remote_dir(new)
|
||||
new.rm('SCRIPTS_REMOTE_DIR')
|
||||
end
|
||||
|
||||
# Since 7.5.80 the remote hooks are executed from the hooks
|
||||
# directory inside the fixed remote scripts directory. Drop the old
|
||||
# stock value so that the new default applies; keep custom paths.
|
||||
def bug7899_remote_hook_base_path(old, new)
|
||||
return unless old[:remote_hook_base_path] == '/var/tmp/one/hooks'
|
||||
|
||||
new.delete(:remote_hook_base_path)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -370,7 +370,6 @@ void OpenNebulaTemplate::set_conf_default()
|
||||
# LISTEN_ADDRESS, GRPC_LISTEN_ADDRESS
|
||||
# PORT, GRPC_PORT
|
||||
# DB
|
||||
# SCRIPTS_REMOTE_DIR
|
||||
# VM_SUBMIT_ON_HOLD
|
||||
# API_LIST_ORDER
|
||||
# VNC_PORTS
|
||||
@@ -387,7 +386,6 @@ void OpenNebulaTemplate::set_conf_default()
|
||||
set_conf_single("GRPC_PORT", "2634");
|
||||
set_conf_single("GRPC_LISTEN_ADDRESS", "0.0.0.0");
|
||||
#endif
|
||||
set_conf_single("SCRIPTS_REMOTE_DIR", "/var/tmp/one");
|
||||
set_conf_single("VM_SUBMIT_ON_HOLD", "NO");
|
||||
set_conf_single("API_LIST_ORDER", "DESC");
|
||||
set_conf_single("SHOWBACK_ONLY_RUNNING", "NO");
|
||||
|
||||
@@ -149,7 +149,7 @@ class KVMDomain
|
||||
return unless @vm.elements['TEMPLATE/TPM/MODEL']
|
||||
|
||||
<<~EOS
|
||||
(sudo -l | grep -q vtpm_setup) && sudo /var/tmp/one/vtpm_setup backup "#{@dom}" "#{@vm_dir}"
|
||||
(sudo -l | grep -q vtpm_setup) && sudo /usr/libexec/one/vtpm_setup backup "#{@dom}" "#{@vm_dir}"
|
||||
tar zcvf #{@bck_dir}/disk.tpm.0 -C #{@vm_dir} tpm
|
||||
EOS
|
||||
end
|
||||
|
||||
@@ -34,7 +34,7 @@ require 'load_opennebula_paths'
|
||||
|
||||
$LOAD_PATH << RUBY_LIB_LOCATION
|
||||
|
||||
$LOAD_PATH.unshift('/var/tmp/one')
|
||||
$LOAD_PATH.unshift('/var/lib/one-remotes')
|
||||
|
||||
require 'fileutils'
|
||||
require 'tempfile'
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
# ---------------------------------------------------------------------------- #
|
||||
$LOAD_PATH.unshift('/var/tmp/one')
|
||||
$LOAD_PATH.unshift('/var/lib/one-remotes')
|
||||
|
||||
require 'fileutils'
|
||||
require 'tempfile'
|
||||
|
||||
@@ -167,7 +167,7 @@ module TransferManager
|
||||
expo_clup = ''
|
||||
snap_abort = ''
|
||||
|
||||
backup_util = '/var/tmp/one/tm/lib/backup_rbd.rb'
|
||||
backup_util = '/var/lib/one-remotes/tm/lib/backup_rbd.rb'
|
||||
|
||||
if @interactive
|
||||
return backup_cmds_interactive(backup_dir, ds, live, backup_util)
|
||||
|
||||
@@ -130,7 +130,7 @@ module TransferManager
|
||||
snap_cmd = ''
|
||||
expo_cmd = ''
|
||||
snap_clup = ''
|
||||
backup_util = '/var/tmp/one/tm/lib/backup_lvmthin.rb'
|
||||
backup_util = '/var/lib/one-remotes/tm/lib/backup_lvmthin.rb'
|
||||
|
||||
if @interactive
|
||||
return backup_cmds_interactive(backup_dir, ds, live, backup_util)
|
||||
|
||||
@@ -25,7 +25,8 @@ module TransferManager
|
||||
# OneBEX client used by interactive backups.
|
||||
class OneBEX
|
||||
|
||||
REMOTE_LIB_DIR = '/var/tmp/one/tm/lib'
|
||||
# Remote TM scripts run with /var/lib/one-remotes/tm/lib as their installed libdir.
|
||||
REMOTE_LIB_DIR = '/var/lib/one-remotes/tm/lib'
|
||||
|
||||
CONFIG_FILE = File.expand_path(
|
||||
'../../etc/onebex/onebex-server.conf',
|
||||
|
||||
@@ -80,7 +80,7 @@ ds = TransferManager::Datastore.from_image_ds(:image => image,
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
if ds['/DATASTORE/TEMPLATE/CACHE_ENABLE'].to_s.upcase == 'YES' && image['/IMAGE/PERSISTENT'] == '0'
|
||||
cache_util = '/var/tmp/one/tm/lib/tm_cache.rb'
|
||||
cache_util = '/var/lib/one-remotes/tm/lib/tm_cache.rb'
|
||||
|
||||
config = {
|
||||
:ds_xml => ds.xml_to_hash,
|
||||
|
||||
@@ -44,7 +44,7 @@ bck_dir = if base_path
|
||||
"#{rdir}/backup"
|
||||
end
|
||||
|
||||
qcow2_util = '/var/tmp/one/tm/lib/backup_qcow2.rb'
|
||||
qcow2_util = '/var/lib/one-remotes/tm/lib/backup_qcow2.rb'
|
||||
|
||||
post_script = <<~EOS
|
||||
set -ex -o pipefail
|
||||
|
||||
@@ -65,7 +65,7 @@ bck_dir = if base_path
|
||||
"#{rdir}/backup"
|
||||
end
|
||||
|
||||
qcow2_util = '/var/tmp/one/tm/lib/backup_qcow2.rb'
|
||||
qcow2_util = '/var/lib/one-remotes/tm/lib/backup_qcow2.rb'
|
||||
qcow2_cmd = "#{qcow2_util} -d \"#{disks}\" -x #{bck_dir}/vm.xml -p #{rdir}"
|
||||
|
||||
pipe_r, pipe_w = IO.pipe
|
||||
|
||||
@@ -66,7 +66,7 @@ bck_dir = if base_path
|
||||
"#{rdir}/backup"
|
||||
end
|
||||
|
||||
qcow2_util = '/var/tmp/one/tm/lib/backup_qcow2.rb'
|
||||
qcow2_util = '/var/lib/one-remotes/tm/lib/backup_qcow2.rb'
|
||||
qcow2_cmd = "#{qcow2_util} -l -d \"#{disks}\" -x #{bck_dir}/vm.xml -p #{rdir}"
|
||||
|
||||
pipe_r, pipe_w = IO.pipe
|
||||
|
||||
@@ -1509,7 +1509,7 @@ int LibVirtDriver::deployment_description_kvm(
|
||||
|
||||
file << "\t\t<filesystem type='mount' accessmode='passthrough'>\n"
|
||||
<< "\t\t\t<driver type='virtiofs' queue='1024'/>\n"
|
||||
<< "\t\t\t<binary path='/var/tmp/one/vmm/kvm/virtiofsd.sh' xattr='on'>\n"
|
||||
<< "\t\t\t<binary path='/var/lib/one-remotes/vmm/kvm/virtiofsd.sh' xattr='on'>\n"
|
||||
<< "\t\t\t\t<cache mode='always'/>\n"
|
||||
<< "\t\t\t\t<sandbox mode='namespace'/>\n"
|
||||
<< "\t\t\t</binary>\n"
|
||||
|
||||
@@ -26,14 +26,14 @@ TIMEOUT=60
|
||||
function destroy_and_monitor
|
||||
{
|
||||
# Get datastore path to get vm.xml
|
||||
DATASTORE="$(/var/tmp/one/vgpu "DATASTORE" "$deploy_id")"
|
||||
DATASTORE="$(/usr/libexec/one/vgpu "DATASTORE" "$deploy_id")"
|
||||
|
||||
virsh --connect $LIBVIRT_URI --readonly dominfo $deploy_id > /dev/null 2>&1 || return 0
|
||||
|
||||
virsh --connect $LIBVIRT_URI destroy $deploy_id
|
||||
|
||||
# Destroy vGPU (only if suported by node)
|
||||
(sudo -l | grep -q vgpu) && sudo /var/tmp/one/vgpu "DELETE" "$DATASTORE/vm.xml"
|
||||
(sudo -l | grep -q vgpu) && sudo /usr/libexec/one/vgpu "DELETE" "$DATASTORE/vm.xml"
|
||||
|
||||
virsh --connect $LIBVIRT_URI --readonly dominfo $deploy_id > /dev/null 2>&1
|
||||
[ "x$?" != "x0" ]
|
||||
|
||||
@@ -87,7 +87,7 @@ fi
|
||||
# Create vGPU following NVIDIA official guide:
|
||||
# https://docs.nvidia.com/grid/latest/pdf/grid-vgpu-user-guide.pdf
|
||||
#-------------------------------------------------------------------------------
|
||||
(sudo -l | grep -q vgpu) && sudo /var/tmp/one/vgpu "CREATE" "$DEP_FILE_LOCATION/vm.xml"
|
||||
(sudo -l | grep -q vgpu) && sudo /usr/libexec/one/vgpu "CREATE" "$DEP_FILE_LOCATION/vm.xml"
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Recover vTPM directory
|
||||
@@ -104,7 +104,7 @@ fi
|
||||
# If there's a saved TPM, copy it to libvirt's directory
|
||||
if [ -d "$DEP_FILE_LOCATION/tpm" ]; then
|
||||
DOM_UUID=$(xmllint --xpath '/domain/uuid/text()' "$DEP_FILE")
|
||||
(sudo -l | grep -q vtpm_setup) && sudo /var/tmp/one/vtpm_setup recover "$DOM_UUID" "$DEP_FILE_LOCATION"
|
||||
(sudo -l | grep -q vtpm_setup) && sudo /usr/libexec/one/vtpm_setup recover "$DOM_UUID" "$DEP_FILE_LOCATION"
|
||||
fi
|
||||
|
||||
DATA=`virsh --connect $LIBVIRT_URI create $DEP_FILE`
|
||||
|
||||
@@ -27,7 +27,7 @@ count=0
|
||||
deploy_id=$1
|
||||
|
||||
# Get datastore path to get vm.xml
|
||||
VMDIR="$(/var/tmp/one/vgpu "DATASTORE" "$deploy_id")"
|
||||
VMDIR="$(/usr/libexec/one/vgpu "DATASTORE" "$deploy_id")"
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Back up vTPM directory from libvirt to /tpm in VM dir
|
||||
@@ -35,7 +35,7 @@ VMDIR="$(/var/tmp/one/vgpu "DATASTORE" "$deploy_id")"
|
||||
domxml="$(virsh --connect $LIBVIRT_URI dumpxml "$deploy_id")"
|
||||
if echo "$domxml" | "$XPATH" -t '/domain/devices/tpm/backend[@type="emulator"]' > /dev/null 2>&1; then
|
||||
DOM_UUID=$(echo "$domxml" | "$XPATH" '/domain/uuid')
|
||||
(sudo -l | grep -q vtpm_setup) && sudo /var/tmp/one/vtpm_setup backup "$DOM_UUID" "$VMDIR"
|
||||
(sudo -l | grep -q vtpm_setup) && sudo /usr/libexec/one/vtpm_setup backup "$DOM_UUID" "$VMDIR"
|
||||
fi
|
||||
|
||||
shutdown_command="virsh --connect $LIBVIRT_URI shutdown $deploy_id"
|
||||
@@ -86,7 +86,7 @@ force_shutdown "$deploy_id" \
|
||||
"virsh --connect $LIBVIRT_URI destroy $deploy_id"
|
||||
|
||||
# Destroy vGPU. Only if supported by node
|
||||
(sudo -l | grep -q vgpu) && sudo /var/tmp/one/vgpu "DELETE" "$VMDIR/vm.xml"
|
||||
(sudo -l | grep -q vgpu) && sudo /usr/libexec/one/vgpu "DELETE" "$VMDIR/vm.xml"
|
||||
|
||||
# Compact memory
|
||||
if [ "x$CLEANUP_MEMORY_ON_STOP" = "xyes" ]; then
|
||||
|
||||
@@ -109,7 +109,7 @@ function vgpuctl() {
|
||||
}
|
||||
|
||||
function update_pci_info() {
|
||||
PID_FILE="/var/tmp/one_db/.monitor_client.pid"
|
||||
PID_FILE="/var/lib/one-remotes-db/.monitor_client.pid"
|
||||
|
||||
if [[ -s "$PID_FILE" ]]; then
|
||||
PID=$(cat "$PID_FILE")
|
||||
@@ -130,10 +130,12 @@ ACTION=${1,,}
|
||||
# datastore -> vm deploy ID
|
||||
VM="$2"
|
||||
|
||||
XPATH="$(dirname $0)/datastore/xpath.rb --stdin"
|
||||
REMOTES_DIR="/var/lib/one-remotes"
|
||||
|
||||
source "$(dirname $0)/etc/vmm/kvm/kvmrc"
|
||||
source "$(dirname $0)/scripts_common.sh"
|
||||
XPATH="$REMOTES_DIR/datastore/xpath.rb --stdin"
|
||||
|
||||
source "$REMOTES_DIR/etc/vmm/kvm/kvmrc"
|
||||
source "$REMOTES_DIR/scripts_common.sh"
|
||||
|
||||
case "$ACTION" in
|
||||
"create")
|
||||
|
||||
@@ -33,7 +33,7 @@ module VirtualMachineManagerKVM
|
||||
# Default locations for kvmrc file on the front-end (local) or
|
||||
# hypervisor (remote)
|
||||
KVMRC_LOCAL = '/var/lib/one/remotes/etc/vmm/kvm/kvmrc'
|
||||
KVMRC_REMOTE = '/var/tmp/one/etc/vmm/kvm/kvmrc'
|
||||
KVMRC_REMOTE = '/var/lib/one-remotes/etc/vmm/kvm/kvmrc'
|
||||
|
||||
# Loads env from the default local (front-end) path
|
||||
def load_local_env
|
||||
|
||||
@@ -54,7 +54,7 @@ class LXCConfiguration < Hash
|
||||
|
||||
# Configuration attributes that are not customizable
|
||||
FIXED_CONFIGURATION = {
|
||||
:profiles_location => '/var/tmp/one/etc/vmm/lxc/profiles',
|
||||
:profiles_location => '/var/lib/one-remotes/etc/vmm/lxc/profiles',
|
||||
:id_map => 600100001, # First id for mapping
|
||||
:max_map => 65536 # Max id for mapping
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
# Default log level for the proxy process.
|
||||
# Logs are located on hypervisor hosts at /var/log/one_tproxy*.log.
|
||||
# The proxy processes can be reloaded or restarted on demand (as root):
|
||||
# `/var/tmp/one/vnm/tproxy reload` or `/var/tmp/one/vnm/tproxy restart`.
|
||||
# `/usr/libexec/one/tproxy reload` or `/usr/libexec/one/tproxy restart`.
|
||||
#:tproxy_debug_level: 2 # 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG
|
||||
|
||||
# Each entry in the :tproxy array is a definition of a proxy instance:
|
||||
|
||||
@@ -43,7 +43,7 @@ require 'CommandManager'
|
||||
template64 = STDIN.read
|
||||
hostname = ARGV[0]
|
||||
|
||||
remote_clean ="/var/tmp/one/vnm/elastic/remote_clean #{hostname}"
|
||||
remote_clean ="/var/lib/one-remotes/vnm/elastic/remote_clean #{hostname}"
|
||||
|
||||
begin
|
||||
drv = ElasticDriver.from_base64(template64, hostname)
|
||||
|
||||
@@ -44,7 +44,7 @@ template64 = STDIN.read
|
||||
deploy_id = ARGV[0]
|
||||
hostname = ARGV[1]
|
||||
|
||||
remote_post ="/var/tmp/one/vnm/elastic/remote_post #{deploy_id} #{hostname}"
|
||||
remote_post ="/var/lib/one-remotes/vnm/elastic/remote_post #{deploy_id} #{hostname}"
|
||||
|
||||
begin
|
||||
drv = ElasticDriver.from_base64(template64, hostname, deploy_id)
|
||||
|
||||
@@ -37,8 +37,8 @@ module VNMMAD
|
||||
:lsmod => 'lsmod',
|
||||
:ipset => 'sudo -n ipset',
|
||||
:nft => 'sudo -n nft',
|
||||
:tproxy => 'sudo -n /var/tmp/one/vnm/tproxy',
|
||||
:ip_netns_exec => 'sudo -n --preserve-env=NETNS /var/tmp/one/vnm/ip_netns_exec',
|
||||
:tproxy => 'sudo -n /usr/libexec/one/tproxy',
|
||||
:ip_netns_exec => 'sudo -n --preserve-env=NETNS /usr/libexec/one/ip_netns_exec',
|
||||
:bridge => 'sudo -n bridge',
|
||||
:devlink => 'sudo -n devlink',
|
||||
:ethtool => 'sudo -n ethtool'
|
||||
|
||||
@@ -29,7 +29,7 @@ RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
|
||||
GEMS_LOCATION = '/usr/share/one/gems'
|
||||
LOG_LOCATION = '/var/log'
|
||||
RUN_LOCATION = '/var/run'
|
||||
REMOTES_LOCATION = '/var/tmp/one'
|
||||
REMOTES_LOCATION = '/var/lib/one-remotes'
|
||||
CONFIGURATION_FILE = REMOTES_LOCATION + '/etc/vnm/OpenNebulaNetwork.conf'
|
||||
|
||||
# %%RUBYGEMS_SETUP_BEGIN%%
|
||||
|
||||
@@ -26,7 +26,7 @@ module VNMMAD
|
||||
# Module to handle transparent proxies.
|
||||
module TProxy
|
||||
|
||||
LOCK_FILE = '/tmp/onevnm-tproxy-lock'
|
||||
LOCK_FILE = '/var/lock/one/onevnm-tproxy-lock'
|
||||
|
||||
# Return the hypervisor facing veth device
|
||||
def self.veth(nic)
|
||||
|
||||
@@ -61,12 +61,14 @@ module VNMMAD
|
||||
end
|
||||
|
||||
# Locking function to serialized driver operations if needed. Similar
|
||||
# to flock. File is created as /tmp/onevnm-<driver>-lock
|
||||
# to flock. File is created as /var/lock/one/onevnm-<driver>-lock
|
||||
def lock
|
||||
return unless @locking
|
||||
|
||||
driver_name = self.class.name.downcase
|
||||
@locking_file = File.open("/tmp/onevnm-#{driver_name}-lock", 'w')
|
||||
@locking_file = File.open(
|
||||
"/var/lock/one/onevnm-#{driver_name}-lock", 'w'
|
||||
)
|
||||
@locking_file.flock(File::LOCK_EX)
|
||||
end
|
||||
|
||||
@@ -368,7 +370,7 @@ module VNMMAD
|
||||
hostname = args[0]
|
||||
|
||||
cmd = "run-parts #{$PROGRAM_NAME}.d".gsub('/var/lib/one/remotes',
|
||||
'/var/tmp/one')
|
||||
'/var/lib/one-remotes')
|
||||
args.each {|arg| cmd << " --arg=\"#{arg}\"" }
|
||||
|
||||
SSHCommand.run(cmd, hostname, nil, stdin, 60)
|
||||
|
||||
Reference in new issue
Block a user