From bdf76e727695cfe0487589139fc2ff71b29b4d2e Mon Sep 17 00:00:00 2001 From: Anoop Date: Fri, 5 Oct 2018 10:24:26 -0400 Subject: [PATCH 1/2] CHanged refernces of vlab to vital user for consistency --- scripts/on_xen_startup.sh | 2 +- scripts/xen_course_network_startup.sh | 4 ++-- security_util.py | 4 ++-- xen_api.py | 4 ++-- xen_api_rpc.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/on_xen_startup.sh b/scripts/on_xen_startup.sh index 85791fb..867db74 100755 --- a/scripts/on_xen_startup.sh +++ b/scripts/on_xen_startup.sh @@ -11,4 +11,4 @@ xl sched-credit -d Domain-0 -w 2048 iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT # create bonds for course networks -/home/vlab/source/xen-api/scripts/xen_course_network_startup.sh \ No newline at end of file +/home/vital/source/xen-api/scripts/xen_course_network_startup.sh diff --git a/scripts/xen_course_network_startup.sh b/scripts/xen_course_network_startup.sh index e2f9ba8..74e0249 100755 --- a/scripts/xen_course_network_startup.sh +++ b/scripts/xen_course_network_startup.sh @@ -18,8 +18,8 @@ function add_bridge_if { } # reading from config file -host=$(awk -F ":" '/VITAL_DB_HOST/ {print $2}' /home/vlab/config.ini | tr -d ' ') -pass=$(awk -F ":" '/VITAL_DB_PWD/ {print $2}' /home/vlab/config.ini | tr -d ' ') +host=$(awk -F ":" '/VITAL_DB_HOST/ {print $2}' /home/vital/config.ini | tr -d ' ') +pass=$(awk -F ":" '/VITAL_DB_PWD/ {print $2}' /home/vital/config.ini | tr -d ' ') nets=$(PGPASSWORD=$pass psql -U postgres -d vital_db -h $host -t -c "SELECT c.id from vital_course c join vital_network_configuration n on c.id=n.course_id where c.status='ACTIVE' and n.is_course_net=True") set -f diff --git a/security_util.py b/security_util.py index c47aa40..1685007 100755 --- a/security_util.py +++ b/security_util.py @@ -6,7 +6,7 @@ config = ConfigParser.ConfigParser() # TODO change this to a common config file on a shared location -config.read("/home/vlab/config.ini") +config.read("/home/vital/config.ini") def expose(func): @@ -75,4 +75,4 @@ def is_authorized(func, user, passwd): # all operations need to be authenticated raise Exception('access to method is not supported') finally: - conn.close() \ No newline at end of file + conn.close() diff --git a/xen_api.py b/xen_api.py index 6b07267..bb08195 100755 --- a/xen_api.py +++ b/xen_api.py @@ -16,12 +16,12 @@ config = ConfigParser.ConfigParser() # TODO change this to a common config file on a shared location -config.read("/home/vlab/config.ini") +config.read("/home/vital/config.ini") # TODO change the logging level and file name to be read from config file logger = logging.getLogger('xen api') logger.setLevel(logging.DEBUG) -handler = RotatingFileHandler('/home/vlab/log/xen-api.log', maxBytes=1024*1024*10, backupCount=5) +handler = RotatingFileHandler('/home/vital/log/xen-api.log', maxBytes=1024*1024*10, backupCount=5) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') handler.setFormatter(formatter) logger.addHandler(handler) diff --git a/xen_api_rpc.py b/xen_api_rpc.py index 02082a6..0b9df2a 100755 --- a/xen_api_rpc.py +++ b/xen_api_rpc.py @@ -8,7 +8,7 @@ config = ConfigParser.ConfigParser() # TODO change this to a common config file on a shared location -config.read("/home/vlab/config.ini") +config.read("/home/vital/config.ini") # TODO Security to check if requesting user has privilege and callback security model From 8de6b6f190308d5c88b9ba58913d0a698ed84e01 Mon Sep 17 00:00:00 2001 From: Anoop Date: Mon, 15 Oct 2018 14:39:42 -0400 Subject: [PATCH 2/2] Updated locations * From now on the config files will be stored in a central location with soft links in vital user directory. * Updated all references of vlab to vital. * Added Zmq Master address to be configurable using the config file. --- xen_api.py | 7 ++++--- xen_api_rpc.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/xen_api.py b/xen_api.py index 6b07267..3b4f23b 100755 --- a/xen_api.py +++ b/xen_api.py @@ -16,20 +16,21 @@ config = ConfigParser.ConfigParser() # TODO change this to a common config file on a shared location -config.read("/home/vlab/config.ini") +config.read("/home/vital/config.ini") # TODO change the logging level and file name to be read from config file logger = logging.getLogger('xen api') logger.setLevel(logging.DEBUG) -handler = RotatingFileHandler('/home/vlab/log/xen-api.log', maxBytes=1024*1024*10, backupCount=5) +handler = RotatingFileHandler('/home/vital/log/xen-api.log', maxBytes=1024*1024*10, backupCount=5) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') handler.setFormatter(formatter) logger.addHandler(handler) # Initialize zmq contexts +zmqMaster = config.get("VITAL", "ZMQ_MASTER") ctx = zmq.Context() task_socket = ctx.socket(zmq.PUSH) -task_socket.connect('tcp://Vlab-server:5000') +task_socket.connect('tcp://' + zmqMaster + ':5000') class XenAPI: """ diff --git a/xen_api_rpc.py b/xen_api_rpc.py index 02082a6..0b9df2a 100755 --- a/xen_api_rpc.py +++ b/xen_api_rpc.py @@ -8,7 +8,7 @@ config = ConfigParser.ConfigParser() # TODO change this to a common config file on a shared location -config.read("/home/vlab/config.ini") +config.read("/home/vital/config.ini") # TODO Security to check if requesting user has privilege and callback security model