Add files and change path of data_files for RHEL.
Add files for systemctl of RHEL. And change path of data_files in setup.cfg. In the RHEL, it copies in to /usr/etc insted of /etc. Change-Id: Ie3f316c52188f6223c206a28185a0e2d259c2563
This commit is contained in:
parent
7823dcdb29
commit
711b359021
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=OpenStack Neutron NEC NWA Agent
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=neutron
|
||||
ExecStart=/usr/bin/neutron-necnwa-agent --config-file /usr/share/neutron/neutron-dist.conf --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini --log-file /var/log/neutron/necnwa-agent.log
|
||||
PrivateTmp=false
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,76 @@
|
|||
#!/bin/bash
|
||||
|
||||
debug=true
|
||||
interval=300
|
||||
conf=/etc/neutron/neutron.conf
|
||||
logfile=/var/log/neutron/necnwa-cleanup.log
|
||||
keyconf=/etc/keystone/keystone.conf
|
||||
|
||||
while [[ $# > 1 ]]
|
||||
do
|
||||
key="$1"
|
||||
case $key in
|
||||
--config-file)
|
||||
conf="$2"
|
||||
shift
|
||||
;;
|
||||
--log-file)
|
||||
logfile="$2"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
exec 6>&1
|
||||
exec >> $logfile 2>&1
|
||||
|
||||
line=$(sed -n -r 's,^\s*connection\s*=\s*mysql://([^:]?+):([^@]?+)@.*,\1 \2,p' $conf)
|
||||
set -- $line
|
||||
db_user=$1
|
||||
db_password=$2
|
||||
|
||||
if [ -z "$db_user" ]; then
|
||||
echo 1>&2 "Error: db_user is not defined"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$db_password" ]; then
|
||||
echo 1>&2 "Error: db_password is not defined"
|
||||
exit 1
|
||||
fi
|
||||
db_table=neutron
|
||||
mysql="mysql -u$db_user -p$db_password $db_table"
|
||||
|
||||
line=$(sed -n -r 's,^\s*connection\s*=\s*mysql://([^:]?+):([^@]?+)@.*,\1 \2,p' $keyconf)
|
||||
set -- $line
|
||||
key_user=$1
|
||||
key_pass=$2
|
||||
list_cmd="mysql -u$key_user -p$key_pass keystone"
|
||||
|
||||
while true
|
||||
do
|
||||
date=$(date '+%Y-%m-%d %H:%M:%S.000')
|
||||
project_list=$($list_cmd -e 'select * from project;' 2>/dev/null | \
|
||||
egrep -v -e 'id *name' |awk '{print $1;}')
|
||||
queue_list=$($mysql -e 'select * from nwa_tenant_queue;' | \
|
||||
egrep -v -e '\-\-|tenant_id' | awk '{print $1;}')
|
||||
for q in $queue_list; do
|
||||
remove=true
|
||||
for p in $project_list; do
|
||||
if [[ $p == $q ]]; then
|
||||
remove=false
|
||||
break
|
||||
fi
|
||||
done
|
||||
if $remove; then
|
||||
op="delete from nwa_tenant_queue where tenant_id = '$q';"
|
||||
echo "$date $$ INFO $op" >>$logfile 2>&1
|
||||
$mysql -e "$op"
|
||||
fi
|
||||
done
|
||||
sleep $interval
|
||||
done
|
||||
# echo "Now, execute the following command:"
|
||||
# echo " $ sudo systemctl restart neutron-server neutron-necnwa-agent"
|
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=OpenStack Neutron NECNWA Agent Cleanup Queue
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=neutron
|
||||
ExecStart=/usr/bin/neutron-necnwa-cleanup --config-file /etc/neutron/neutron.conf --log-file /var/log/neutron/necnwa-cleanup.log
|
||||
PrivateTmp=false
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue