X7ROOT File Manager
Current Path:
/var/VMOptimizationToolsLinux
var
/
VMOptimizationToolsLinux
/
📁
..
📄
LinuxUpdate.XML
(645 B)
📄
SangforVMSTool
(3.11 KB)
📄
SangforVMSTool.service
(194 B)
📄
action_common.sh
(13.34 KB)
📄
busybox_cmd_ln.sh
(2.24 KB)
📄
collect_test_data.sh
(1.16 KB)
📄
common_config.sh
(278 B)
📄
data_test_tool.sh
(12.59 KB)
📄
debian_vmconfig.sh
(10.74 KB)
📄
guest_system_config.sh
(1.82 KB)
📄
log.sh
(1.36 KB)
📄
mod_test.sh
(3.69 KB)
📄
mod_test1.sh
(914 B)
📄
net_common.sh
(915 B)
📄
redhat_vmconfig.sh
(11.14 KB)
📄
sangfor_guest_datareport
(21.66 KB)
📄
sangfor_heartalive.sh
(2.37 KB)
📄
sangfor_module_update
(28.11 KB)
📄
sangfor_set_network.sh
(504 B)
📄
sangfor_sfping
(3.85 KB)
📄
sangfor_sshkey_gen
(1.29 KB)
📄
sangfor_update_ipc_callback
(5.29 KB)
📄
sangfor_vm_proxyd
(3.45 KB)
📄
sangfor_vm_proxyd_r
(4.4 KB)
📄
sangfor_vm_proxyd_w
(1.32 KB)
📄
sangfor_vmconfig
(2.4 KB)
📄
sangfor_vmconfig_common
(27.99 KB)
📄
sangfor_vmconfig_ipc_callback
(4.75 KB)
📄
sangfor_watchdog
(3.95 KB)
📄
sfping.c
(15.68 KB)
📄
sfping.pl
(6.15 KB)
📄
startall
(1.78 KB)
📄
stopall
(1.11 KB)
📄
suse_vmconfig.sh
(6.19 KB)
📁
tools_x64
📁
tools_x86
📄
uni_test.sh
(2.59 KB)
📄
update_common_func
(4.35 KB)
📄
update_common_header
(4.86 KB)
📄
update_config
(2.89 KB)
📄
update_install
(28.84 KB)
📄
virtio_nic_attr_set.sh
(2.42 KB)
📄
virtio_nic_compat.sh
(5.28 KB)
📄
vm_ip_recover.sh
(16.66 KB)
📄
vm_ipc.sh
(9.06 KB)
📄
vmconfig_common_func
(10.76 KB)
📄
vmconfig_common_header
(3.37 KB)
📄
vmconfig_config
(805 B)
📄
vmtools-install.sh
(31.16 KB)
📄
watch_test.sh
(313 B)
📄
watchdog.sh
(1.39 KB)
📁
x64
📁
x86
Editing: sangfor_vmconfig_ipc_callback
#!/bin/bash shell_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) . "${shell_dir}/vmconfig_config" . "${shell_dir}/vm_ipc.sh" . "${shell_dir}/vmconfig_common_header" . "${shell_dir}/update_common_func" . "${shell_dir}/watchdog.sh" declare g_current_directory="" declare g_temp_directory="" # generate vmconfig file,decode datafile # param $1: datafile from host # return 0 is success and 1 is failed generate_vmconfig_file(){ local datafile=${1} local use_time=0 local time_out=${g_time_out} local data_str="" test -z "${g_temp_directory}" && return 1 test -z "${g_save_file_temp_name}" && return 1 if [ ! -e "${datafile}" ];then log_error "datafile::${datafile} is not exist" return 1 fi log_debug "## begin generate vmconfig file." # The file saved must be deleted. while [ -e "${g_temp_directory}/${g_get_file_flag}" ] do if [ ${use_time} -ge ${time_out} ];then # timeout log_debug "wait vmconfig module handle file timeout." break fi sleep 1 use_time=$((use_time+1)) done if [ -e "${g_temp_directory}/${g_get_file_flag}" ];then log_error "generate_vmconfig_file:${g_temp_directory}/${g_get_file_flag} is exist! remove it!!" rm -f "${g_temp_directory}/${g_get_file_flag}" 2>/dev/null if [ $? -ne 0 ];then log_error "generate_vmconfig_file:remove ${g_temp_directory}/${g_get_file_flag} failed!" fi fi log_debug "remove tmp file:${g_save_file_temp_name}" # Decode the data by base64. rm -f "${g_temp_directory}/${g_save_file_temp_name}" if [ $? -ne 0 ];then log_warn "generate_vmconfig_file:remove ${g_temp_directory}/${g_save_file_temp_name} failed!" fi data_str=$(grep -oP '(?<="data":")[^"]+' "${datafile}" 2>/dev/null) if [ -z "$data_str" ];then data_str=$(sed -n 's/.*\"data\":"\(.*\)".*/\1/p' "${datafile}" 2>/dev/null) fi echo "$data_str" | base64 -d > "${g_temp_directory}/${g_save_file_temp_name}" if [ $? -ne 0 ];then log_error "generate_vmconfig_file:sed to save file failed!" else log_debug "generate_vmconfig_file:sed to save file success." fi if [ -e "${g_temp_directory}/${g_save_file_temp_name}" ];then log_debug "generate_vmconfig_file:${g_temp_directory}/${g_save_file_temp_name} exist." echo "success" > "${g_temp_directory}/${g_get_file_flag}" 2>/dev/null return 0 else log_error "generate_vmconfig_file:${g_temp_directory}/${g_save_file_temp_name} is not exist." rm -f "${g_temp_directory}/${g_get_file_flag}" 2>/dev/null if [ $? -ne 0 ];then log_warn "generate_vmconfig_file:remove ${g_temp_directory}/${g_get_file_flag} failed!" fi return 1 fi } # response callback func # param $1: module id # param $2: instance id # param $3: data file # return 0 is success and 1 is failed response_callback(){ local modid=${1} local instid=${2} local datafile=${3} local msg_type=0 log_debug "respond callback,modid:${modid},instid:${instid},datafile:${datafile}" if [ ! -e "${datafile}" ];then log_error "response_callback:datafile::${datafile} is not exist" return 1 fi msg_type=`grep -oP '(?<="type":)[0-9]+' "${datafile}" 2>/dev/null` if [ -z "$msg_type" ];then msg_type=$(sed -n 's/.*\"type\":\(.*\),\"number\":.*/\1/p' "${datafile}" 2>/dev/null) fi log_debug "response_callback:msg_type:${msg_type}" if [ x"${msg_type}" = x"${MESSAGE_GET_FILEDATA_REP_LINUX}" ];then generate_vmconfig_file "${datafile}" fi return 0 } main(){ #init environment set_log_filepath "${g_sangfor_log_dir}/${g_vmconfig_callback_shell_file}.log" kill_process "${g_vmconfig_callback_shell_file}" #watch watchdog_reg_proccess "${g_vmconfig_callback_shell_file}" g_current_directory="${shell_dir}" if [ x"${g_current_directory}" = x"" ];then log_error "get current dir failed!" return 1 fi g_temp_directory="$( cd "${g_current_directory}/../" && pwd )/${g_temp_dir_name}" log_info "cur dir:${g_current_directory},tmp dir:${g_temp_directory}" test -z "${g_current_directory}" && return 1 test -z "${g_temp_directory}" && return 1 log_info "vmconfig ipc init,modid:${g_mode_id},instid:${g_instance_id}" vm_ipc_init ${g_mode_id} ${g_instance_id} if [ $? -ne 0 ]; then log_error "vm_ipc_init() failed! modid='${g_mode_id}' instid='${g_instance_id}'" return 1 fi set_log_filepath "${g_sangfor_log_dir}/${g_vmconfig_callback_shell_file}.log" vm_ipc_reg_callback 103 response_callback while true do vm_ipc_event_loop_once watchdog_check_once sleep 1 done } main exit $?
Upload File
Create Folder