summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaibin Huang <haibin.huang@intel.com>2018-11-15 09:43:07 +0000
committerHuang Haibin <haibin.huang@intel.com>2018-11-15 11:16:22 +0000
commit73c793eb77bb833dd5f8cdd68fe6ca350016b5be (patch)
treee34857835920779ef8625ab894743dfdcdb438a4
parentc7acf67de4d2930a817ebda03c4cef0c409c665a (diff)
Encode base64 for user data
Change-Id: Icc536d45d5e2d9b364e4a7f08e3e55dc481a8410 Issue-ID: VFC-1188 Signed-off-by: Haibin Huang <haibin.huang@intel.com> (cherry picked from commit 0424858cefb1c6b8b06796304b04eff4af487937)
-rw-r--r--lcm/lcm/pub/vimapi/adaptor.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lcm/lcm/pub/vimapi/adaptor.py b/lcm/lcm/pub/vimapi/adaptor.py
index a7a0fd3d..3b959c45 100644
--- a/lcm/lcm/pub/vimapi/adaptor.py
+++ b/lcm/lcm/pub/vimapi/adaptor.py
@@ -16,6 +16,7 @@ import logging
import time
import json
import os
+import base64
from lcm.pub.utils.values import ignore_case_get, set_opt_val
from lcm.pub.msapi.aai import get_flavor_info
@@ -251,7 +252,7 @@ def create_port(vim_cache, res_cache, data, port, do_notify, res_type):
subnet_id = get_res_id(res_cache, RES_SUBNET, port["vl_id"])
param = {
"networkId": network_id,
- "name": port["cp_id"]
+ "name": port["properties"].get("name", "")
}
set_opt_val(param, "subnetId", subnet_id)
set_opt_val(param, "macAddress", ignore_case_get(port["properties"], "mac_address"))
@@ -400,8 +401,9 @@ def create_vm(vim_cache, res_cache, data, vm, do_notify, res_type):
"volumeId": get_res_id(res_cache, RES_VOLUME, vol_id)
})
+ user_data = base64.encodestring(ignore_case_get(vm["properties"], "user_data"))
set_opt_val(param, "availabilityZone", ignore_case_get(location_info, "availability_zone"))
- set_opt_val(param, "userdata", ignore_case_get(vm["properties"], "user_data"))
+ set_opt_val(param, "userdata", user_data)
set_opt_val(param, "metadata", ignore_case_get(vm["properties"], "meta_data"))
set_opt_val(param, "securityGroups", "") # TODO List of names of security group
set_opt_val(param, "serverGroup", "") # TODO the ServerGroup for anti-affinity and affinity