From: tierno Date: Wed, 8 Feb 2017 13:21:28 +0000 (+0100) Subject: Merge branch 'v1.1' X-Git-Tag: v2.0.0~58 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F80%2F1080%2F2;p=osm%2Fopenvim.git Merge branch 'v1.1' Change-Id: I0c27f01914959623bf25905786af9e7dabc141b6 Signed-off-by: tierno --- c1d1d47cee5bd382fd9e2ca4d829aef0f545a0d1 diff --cc database_utils/migrate_vim_db.sh index a8a7741,727a553..362edd3 --- a/database_utils/migrate_vim_db.sh +++ b/database_utils/migrate_vim_db.sh @@@ -175,8 -175,8 +175,9 @@@ DATABASE_TARGET_VER_NUM= [ $OPENVIM_VER_NUM -ge 4001 ] && DATABASE_TARGET_VER_NUM=5 #0.4.1 => 5 [ $OPENVIM_VER_NUM -ge 4002 ] && DATABASE_TARGET_VER_NUM=6 #0.4.2 => 6 [ $OPENVIM_VER_NUM -ge 4005 ] && DATABASE_TARGET_VER_NUM=7 #0.4.5 => 7 -[ $OPENVIM_VER_NUM -ge 4010 ] && DATABASE_TARGET_VER_NUM=8 #0.4.10 => 8 +[ $OPENVIM_VER_NUM -ge 4010 ] && DATABASE_TARGET_VER_NUM=8 #0.4.10 => 8 - [ $OPENVIM_VER_NUM -ge 5002 ] && DATABASE_TARGET_VER_NUM=9 #0.5.2 => 9 + [ $OPENVIM_VER_NUM -ge 5001 ] && DATABASE_TARGET_VER_NUM=9 #0.5.1 => 9 ++[ $OPENVIM_VER_NUM -ge 5002 ] && DATABASE_TARGET_VER_NUM=10 #0.5.2 => 10 #TODO ... put next versions here @@@ -461,10 -462,12 +463,24 @@@ function upgrade_to_9() } function downgrade_from_9(){ echo " downgrade database from version 0.9 to version 0.8" + echo " change length of columns 'path' and 'name' to 100 and 64 in table 'images'" + echo "ALTER TABLE images CHANGE COLUMN path path VARCHAR(100) NOT NULL AFTER uuid, CHANGE COLUMN name name VARCHAR(64) NOT NULL AFTER path;" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 + echo "ALTER TABLE flavors CHANGE COLUMN name name VARCHAR(64) NOT NULL AFTER uuid;" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 + echo "DELETE FROM schema_version WHERE version_int = '9';" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 + } + ++function upgrade_to_10(){ ++ echo " upgrade database from version 0.9 to version 0.10" ++ echo " change types at 'ports'" ++ echo "ALTER TABLE ports CHANGE COLUMN type type ENUM('instance:bridge','instance:data','external','instance:ovs','controller:ovs') NOT NULL DEFAULT 'instance:bridge' AFTER status;" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 ++ echo "INSERT INTO schema_version (version_int, version, openvim_ver, comments, date) VALUES (10, '0.10', '0.5.2', 'change ports type, adding instance:ovs', '2017-02-01');"| $DBCMD || ! echo "ERROR. Aborted!" || exit -1 ++} ++function downgrade_from_10(){ ++ echo " downgrade database from version 0.10 to version 0.9" + echo " change back types at 'ports'" + echo "ALTER TABLE ports CHANGE COLUMN type type ENUM('instance:bridge','instance:data','external') NOT NULL DEFAULT 'instance:bridge' AFTER status;" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 - echo "DELETE FROM schema_version WHERE version_int = '9';" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 ++ echo "DELETE FROM schema_version WHERE version_int = '10';" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1 +} #TODO ... put funtions here diff --cc host_thread.py index c29f79a,b9778af..4da5328 --- a/host_thread.py +++ b/host_thread.py @@@ -39,25 -40,17 +39,23 @@@ from jsonschema import validate as js_v import imp from vim_schema import localinfo_schema, hostinfo_schema import random -#from logging import Logger -#import auxiliary_functions as af +import os + #TODO: insert a logging system +# from logging import Logger +# import auxiliary_functions as af + +# TODO: insert a logging system + - # global lvirt_module - # lvirt_module=None #libvirt module is charged only if not in test mode - class host_thread(threading.Thread): - lvirt_module = None # libvirt module is charged only if not in test mode - def __init__(self, name, host, user, db, db_lock, test, image_path, host_id, version, develop_mode, develop_bridge_iface): + lvirt_module = None + + def __init__(self, name, host, user, db, db_lock, test, image_path, host_id, version, develop_mode, + develop_bridge_iface): '''Init a thread. - Arguments: + Arguments: 'id' number of thead 'name' name of thread 'host','user': host ip or name to manage and user diff --cc httpserver.py index 4062ef1,08ea403..1237fb4 --- a/httpserver.py +++ b/httpserver.py @@@ -26,8 -26,8 +26,8 @@@ This is the thread for the http server Two thread will be launched, with normal and administrative permissions. ''' - __author__ = "Alfonso Tierno, Leonardo Mirabal" - __date__ = "$10-jul-2014 12:07:15$" -__author__="Alfonso Tierno, Gerardo Garcia" ++__author__="Alfonso Tierno, Gerardo Garcia, Leonardo Mirabal" + __date__ ="$10-jul-2014 12:07:15$" import bottle import urlparse @@@ -1911,11 -1712,6 +1944,10 @@@ def http_post_networks() #check valid params net_provider = network.get('provider') net_type = network.get('type') - net_type = network.get('type') + net_enable_dhcp = network.get('enable_dhcp') + if net_enable_dhcp: + net_cidr = network.get('cidr') + net_vlan = network.get("vlan") net_bind_net = network.get("bind_net") net_bind_type= network.get("bind_type") diff --cc openvimd.py index c1a57d9,9cd321c..7c260b9 --- a/openvimd.py +++ b/openvimd.py @@@ -30,9 -30,9 +30,9 @@@ and host controller __author__="Alfonso Tierno" __date__ ="$10-jul-2014 12:07:15$" -__version__="0.5.2-r516" +__version__="0.5.2-r519" version_date="Jan 2017" --database_version="0.9" #expected database schema version ++database_version="0.10" #expected database schema version import httpserver import auxiliary_functions as af