set_opt_val(param, "subnetId", subnet_id)
set_opt_val(param, "macAddress", ignore_case_get(port["properties"], "mac_address"))
ip_address = []
set_opt_val(param, "subnetId", subnet_id)
set_opt_val(param, "macAddress", ignore_case_get(port["properties"], "mac_address"))
ip_address = []
for one_protocol_data in port["properties"]["protocol_data"]:
l3_address_data = one_protocol_data["address_data"]["l3_address_data"] # l3 is not 13
fixed_ip_address = ignore_case_get(l3_address_data, "fixed_ip_address")
ip_address.extend(fixed_ip_address)
for one_virtual_network_interface in port["properties"].get("virtual_network_interface_requirements", []):
for one_protocol_data in port["properties"]["protocol_data"]:
l3_address_data = one_protocol_data["address_data"]["l3_address_data"] # l3 is not 13
fixed_ip_address = ignore_case_get(l3_address_data, "fixed_ip_address")
ip_address.extend(fixed_ip_address)
for one_virtual_network_interface in port["properties"].get("virtual_network_interface_requirements", []):
- interfaceTypeString = one_virtual_network_interface["network_interface_requirements"]["interfaceType"]
- interfaceType = json.loads(interfaceTypeString)["configurationValue"]
+ network_interface_requirements = one_virtual_network_interface["network_interface_requirements"]
+ interfaceTypeString = ignore_case_get(network_interface_requirements, "interfaceType")
+ interfaceType = ""
+ if interfaceTypeString != "":
+ interfaceType = json.loads(interfaceTypeString)["configurationValue"]
vnic_type = ignore_case_get(port["properties"], "vnic_type")
if vnic_type == "":
if interfaceType == "SR-IOV":
vnic_type = ignore_case_get(port["properties"], "vnic_type")
if vnic_type == "":
if interfaceType == "SR-IOV":
param["nicArray"].append({
"portId": get_res_id(res_cache, RES_PORT, cp_id)
})
param["nicArray"].append({
"portId": get_res_id(res_cache, RES_PORT, cp_id)
})
logger.debug("contextArray:%s", param["contextArray"])
for vol_data in ignore_case_get(vm, "volume_storages"):
vol_id = vol_data["volume_storage_id"]
logger.debug("contextArray:%s", param["contextArray"])
for vol_data in ignore_case_get(vm, "volume_storages"):
vol_id = vol_data["volume_storage_id"]
ret = api.create_vm(vim_id, tenant_id, param)
ret["ports"] = [nic.get("portId") for nic in param["nicArray"]]
ret = api.create_vm(vim_id, tenant_id, param)
ret["ports"] = [nic.get("portId") for nic in param["nicArray"]]
}
ret = api.create_vm_port(vim_id, tenant_id, vm_id, param)
ret["nodeId"] = port["cp_id"]
}
ret = api.create_vm_port(vim_id, tenant_id, vm_id, param)
ret["nodeId"] = port["cp_id"]
def delete_port_of_vm(vim_cache, res_cache, data, port, do_notify, res_type):
def delete_port_of_vm(vim_cache, res_cache, data, port, do_notify, res_type):