summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2019-05-23 10:22:35 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2019-05-23 10:22:35 +0800
commit3e5e393882d6c7b2cf1252d6b2ae4944efb7fe85 (patch)
tree38f2f2dacb09330cc6afeea44f499a24bb29cf8e
parent2052a0b4e79f6e470f70d181780803efd42b97a3 (diff)
update portid in when create vm1.3.1
Change-Id: I330ccfae97f0f1494d432b87a15dcd1567034327 Issue-ID: VFC-1306 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r--lcm/lcm/nf/biz/common.py6
-rw-r--r--lcm/lcm/pub/vimapi/adaptor.py1
2 files changed, 7 insertions, 0 deletions
diff --git a/lcm/lcm/nf/biz/common.py b/lcm/lcm/nf/biz/common.py
index 212c74c8..bd8411d4 100644
--- a/lcm/lcm/nf/biz/common.py
+++ b/lcm/lcm/nf/biz/common.py
@@ -145,3 +145,9 @@ def vm_save(job_id, nf_inst_id, ret):
is_predefined=ignore_case_get(ret, "returnCode"),
instid=nf_inst_id,
vmid=vm_id)
+ for portid in ignore_case_get(ret, "ports"):
+ PortInstModel.objects.filter(
+ resourceid=portid
+ ).update(
+ vmid=ignore_case_get(ret, "id")
+ )
diff --git a/lcm/lcm/pub/vimapi/adaptor.py b/lcm/lcm/pub/vimapi/adaptor.py
index 27b64336..83727f2d 100644
--- a/lcm/lcm/pub/vimapi/adaptor.py
+++ b/lcm/lcm/pub/vimapi/adaptor.py
@@ -391,6 +391,7 @@ def create_vm(vim_cache, res_cache, data, vm, do_notify, res_type):
set_opt_val(param, "serverGroup", "") # TODO the ServerGroup for anti-affinity and affinity
ret = api.create_vm(vim_id, tenant_id, param)
+ ret["ports"] = [nic.get("portId") for nic in param["nicArray"]]
do_notify(res_type, ret)
vm_id = ret["id"]
if ignore_case_get(ret, "name"):