projects
/
osm
/
RO.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Migrate to Pyone and refactor
[osm/RO.git]
/
osm_ro
/
vim_thread.py
diff --git
a/osm_ro/vim_thread.py
b/osm_ro/vim_thread.py
index
8ed570c
..
7b197da
100644
(file)
--- a/
osm_ro/vim_thread.py
+++ b/
osm_ro/vim_thread.py
@@
-63,7
+63,7
@@
The task content is (M: stored at memory, D: stored at database):
vim_status: VIM status of the element. Stored also at database in the instance_XXX
vim_info: Detailed information of a vm/net from the VIM. Stored at database in the instance_XXX but not at
vim_wim_actions
vim_status: VIM status of the element. Stored also at database in the instance_XXX
vim_info: Detailed information of a vm/net from the VIM. Stored at database in the instance_XXX but not at
vim_wim_actions
- M depends: dict with task_index(from depends_on) to
vim_id
+ M depends: dict with task_index(from depends_on) to
dependency task
M params: same as extra[params]
MD error_msg: descriptive text upon an error.Stored also at database instance_XXX
MD created_at: task creation time. The task of creation must be the oldest
M params: same as extra[params]
MD error_msg: descriptive text upon an error.Stored also at database instance_XXX
MD created_at: task creation time. The task of creation must be the oldest
@@
-86,6
+86,8
@@
import vimconn_aws
import vimconn_opennebula
import vimconn_openstack
import vimconn_vmware
import vimconn_opennebula
import vimconn_openstack
import vimconn_vmware
+import vimconn_fos
+import vimconn_azure
import yaml
from db_base import db_base_Exception
from lib_osm_openvim.ovim import ovimException
import yaml
from db_base import db_base_Exception
from lib_osm_openvim.ovim import ovimException
@@
-100,6
+102,8
@@
vim_module = {
"opennebula": vimconn_opennebula,
"openstack": vimconn_openstack,
"vmware": vimconn_vmware,
"opennebula": vimconn_opennebula,
"openstack": vimconn_openstack,
"vmware": vimconn_vmware,
+ "fos": vimconn_fos,
+ "azure": vimconn_azure,
}
}
@@
-532,9
+536,8
@@
class vim_thread(threading.Thread):
task_dependency["instance_action_id"], task_dependency["task_index"],
task_dependency["action"], task_dependency["item"], task_dependency.get("error_msg")))
task_dependency["instance_action_id"], task_dependency["task_index"],
task_dependency["action"], task_dependency["item"], task_dependency.get("error_msg")))
- task["depends"]["TASK-"+str(task_index)] = task_dependency["vim_id"]
- task["depends"]["TASK-{}.{}".format(task["instance_action_id"], task_index)] =\
- task_dependency["vim_id"]
+ task["depends"]["TASK-"+str(task_index)] = task_dependency
+ task["depends"]["TASK-{}.{}".format(task["instance_action_id"], task_index)] = task_dependency
if dependency_not_completed:
# Move this task to the time dependency is going to be modified plus 10 seconds.
self.db.update_rows("vim_wim_actions", modified_time=dependency_modified_at + 10,
if dependency_not_completed:
# Move this task to the time dependency is going to be modified plus 10 seconds.
self.db.update_rows("vim_wim_actions", modified_time=dependency_modified_at + 10,
@@
-704,9
+707,12
@@
class vim_thread(threading.Thread):
UPDATE={("number_failed" if task["status"] == "FAILED" else "number_done"): {"INCREMENT": 1}},
WHERE={"uuid": task["instance_action_id"]})
if database_update:
UPDATE={("number_failed" if task["status"] == "FAILED" else "number_done"): {"INCREMENT": 1}},
WHERE={"uuid": task["instance_action_id"]})
if database_update:
+ where_filter = {"related": task["related"]}
+ if task["item"] == "instance_nets" and task["datacenter_vim_id"]:
+ where_filter["datacenter_tenant_id"] = task["datacenter_vim_id"]
self.db.update_rows(table=task["item"],
UPDATE=database_update,
self.db.update_rows(table=task["item"],
UPDATE=database_update,
- WHERE=
{"related": task["related"]}
)
+ WHERE=
where_filter
)
except db_base_Exception as e:
self.logger.error("task={} Error updating database {}".format(task_id, e), exc_info=True)
except db_base_Exception as e:
self.logger.error("task={} Error updating database {}".format(task_id, e), exc_info=True)
@@
-808,7
+814,7
@@
class vim_thread(threading.Thread):
net_list = params[5]
for net in net_list:
if "net_id" in net and is_task_id(net["net_id"]): # change task_id into network_id
net_list = params[5]
for net in net_list:
if "net_id" in net and is_task_id(net["net_id"]): # change task_id into network_id
- network_id = task["depends"][net["net_id"]]
+ network_id = task["depends"][net["net_id"]]
.get("vim_id")
if not network_id:
raise VimThreadException(
"Cannot create VM because depends on a network not created or found: " +
if not network_id:
raise VimThreadException(
"Cannot create VM because depends on a network not created or found: " +
@@
-1055,7
+1061,8
@@
class vim_thread(threading.Thread):
dep_id = "TASK-" + str(task["extra"]["depends_on"][0])
task_id = task["instance_action_id"] + "." + str(task["task_index"])
error_text = ""
dep_id = "TASK-" + str(task["extra"]["depends_on"][0])
task_id = task["instance_action_id"] + "." + str(task["task_index"])
error_text = ""
- interfaces = task.get("depends").get(dep_id).get("extra").get("interfaces")
+ interfaces = task["depends"][dep_id]["extra"].get("interfaces")
+
ingress_interface_id = task.get("extra").get("params").get("ingress_interface_id")
egress_interface_id = task.get("extra").get("params").get("egress_interface_id")
ingress_vim_interface_id = None
ingress_interface_id = task.get("extra").get("params").get("ingress_interface_id")
egress_interface_id = task.get("extra").get("params").get("egress_interface_id")
ingress_vim_interface_id = None