[ $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
}
function downgrade_from_9(){
echo " downgrade database from version 0.9 to version 0.8"
- echo "DELETE FROM schema_version WHERE version_int = '9';" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1
+ 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 = '10';" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1
+}
#TODO ... put funtions here
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
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
#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")
__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