v0.4.58 fixed getting VIM ip_address issue when several scenario network are mapped...
authortierno <alfonso.tiernosepulveda@telefonica.com>
Mon, 26 Sep 2016 15:12:15 +0000 (15:12 +0000)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Mon, 26 Sep 2016 15:12:15 +0000 (15:12 +0000)
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
nfvo.py
openmanod.py

diff --git a/nfvo.py b/nfvo.py
index cc2ed7f..dd3eb55 100644 (file)
--- a/nfvo.py
+++ b/nfvo.py
@@ -2085,7 +2085,7 @@ def refresh_instance(mydb, nfvo_tenant, instanceDict, datacenter=None, vim_tenan
                     if iface["type"]=="mgmt":
                         has_mgmt_iface = True
                 if vm_dict[vm_id]['status'] == "ACTIVE:NoMgmtIP" and not has_mgmt_iface:
-                        vm_dict[vm_id]['status'] = "ACTIVE"
+                    vm_dict[vm_id]['status'] = "ACTIVE"
                 if vm['status'] != vm_dict[vm_id]['status'] or vm.get('error_msg')!=vm_dict[vm_id].get('error_msg') or vm.get('vim_info')!=vm_dict[vm_id].get('vim_info'):
                     vm['status']    = vm_dict[vm_id]['status']
                     vm['error_msg'] = vm_dict[vm_id].get('error_msg')
@@ -2101,16 +2101,16 @@ def refresh_instance(mydb, nfvo_tenant, instanceDict, datacenter=None, vim_tenan
                 # 2.2. Update in openmano DB the interface VMs
                 for interface in interfaces:
                     #translate from vim_net_id to instance_net_id
-                    network_id=None
+                    network_id_list=[]
                     for net in instanceDict['nets']:
                         if net["vim_net_id"] == interface["vim_net_id"]:
-                            network_id = net["uuid"]
-                            break
-                    if not network_id:
+                            network_id_list.append(net["uuid"])
+                    if not network_id_list:
                         continue
                     del interface["vim_net_id"]
-                    try: 
-                        mydb.update_rows('instance_interfaces', UPDATE=interface, WHERE={'instance_vm_id':vm["uuid"], "instance_net_id":network_id})
+                    try:
+                        for network_id in network_id_list:
+                            mydb.update_rows('instance_interfaces', UPDATE=interface, WHERE={'instance_vm_id':vm["uuid"], "instance_net_id":network_id})
                     except db_base_Exception as e:
                         logger.error( "nfvo.refresh_instance error with vm=%s, interface_net_id=%s", vm["uuid"], network_id)        
         
index 02c51c8..2becccf 100755 (executable)
@@ -33,7 +33,7 @@ It loads the configuration file and launches the http_server thread that will li
 '''
 __author__="Alfonso Tierno, Gerardo Garcia, Pablo Montes"
 __date__ ="$26-aug-2014 11:09:29$"
-__version__="0.4.57-r499"
+__version__="0.4.58-r501"
 version_date="Sep 2016"
 database_version="0.14"      #expected database schema version