From 267114125bbc193845abf8e3f2d2bd8c8bef5afe Mon Sep 17 00:00:00 2001 From: Phu Tran <22720475+phudtran@users.noreply.github.com> Date: Wed, 9 Mar 2022 11:55:21 -0800 Subject: [PATCH] Fix cluster startup errors (#645) * Always get veth-index before get mac * InitializeInterfaces: wait for veth index non-negative * Fix runtime size change error * Change retry timeout to 60 minutes * Additional logging for endpoint creation * Fix pod label delete key error * EP create wait for bouncer * log veth to ifindex information * Log transitd output * Service wait for net provisioned --- mizar/common/constants.py | 4 +- mizar/common/rpc.py | 7 +-- mizar/daemon/app.py | 2 +- mizar/daemon/interface_service.py | 17 +++--- .../operators/bouncers/bouncers_operator.py | 15 ++++-- .../operators/dividers/dividers_operator.py | 8 +-- .../operators/endpoints/endpoints_operator.py | 10 +++- mizar/dp/mizar/workflows/bouncers/create.py | 2 - .../mizar/workflows/bouncers/provisioned.py | 4 ++ .../mizar/workflows/builtins/pods/create.py | 4 ++ .../workflows/builtins/services/create.py | 2 + .../mizar/workflows/droplets/provisioned.py | 2 +- mizar/dp/mizar/workflows/endpoints/create.py | 12 ++++- mizar/dp/mizar/workflows/nets/create.py | 2 +- mizar/dp/mizar/workflows/nets/provisioned.py | 2 +- mizar/obj/endpoint.py | 2 + mizar/store/operator_store.py | 9 ++-- src/dmn/trn_agent_xdp_usr.c | 3 +- src/dmn/trn_rpc_protocol_handlers_1.c | 54 ++++++++++--------- src/dmn/trn_transit_xdp_usr.c | 2 +- 20 files changed, 103 insertions(+), 60 deletions(-) diff --git a/mizar/common/constants.py b/mizar/common/constants.py index 253294ee..aa3e1482 100644 --- a/mizar/common/constants.py +++ b/mizar/common/constants.py @@ -125,8 +125,8 @@ class OBJ_DEFAULTS: mizar_ep_vpc_annotation = "mizar.com/vpc" mizar_ep_subnet_annotation = "mizar.com/subnet" - # 15 minutes of retries - kopf_max_retries = 60 + # 60 minutes of retries + kopf_max_retries = 240 kopf_retry_delay = 15 diff --git a/mizar/common/rpc.py b/mizar/common/rpc.py index 583b1d29..dd2cda3c 100644 --- a/mizar/common/rpc.py +++ b/mizar/common/rpc.py @@ -118,7 +118,7 @@ def update_agent_substrate_ep(self, ep, ip, mac, task): logger.info("update_agent_substrate_ep: {}".format(cmd)) returncode, text = run_cmd(cmd) logger.info( - "update_agent_substrate_ep {} returns {} {}".format(cmd, text, returncode)) + "update_agent_substrate_ep {} {} returns {} {}".format(ep.name, cmd, text, returncode)) if (CONSTANTS.RPC_ERROR_CODE in text or CONSTANTS.RPC_FAILED_CODE in text or CONSTANTS.RPC_FATAL_CODE in text): @@ -173,7 +173,8 @@ def update_ep(self, ep, task): cmd = f'''{self.trn_cli_update_ep} \'{jsonconf}\'''' logger.info("update_ep: {}".format(cmd)) returncode, text = run_cmd(cmd) - logger.info("update_ep {} returns {} {}".format(cmd, text, returncode)) + logger.info("update_ep {} {} returns {} {}".format( + ep.name, cmd, text, returncode)) if (CONSTANTS.RPC_ERROR_CODE in text or CONSTANTS.RPC_FAILED_CODE in text or CONSTANTS.RPC_FATAL_CODE in text): @@ -235,7 +236,7 @@ def update_agent_metadata(self, ep, task): logger.info("update_agent_metadata: {}".format(cmd)) returncode, text = run_cmd(cmd) logger.info( - "update_agent_metadata {} returns {} {}".format(cmd, text, returncode)) + "update_agent_metadata ep {} {} returns {} {}".format(ep.name, cmd, text, returncode)) if (CONSTANTS.RPC_ERROR_CODE in text or CONSTANTS.RPC_FAILED_CODE in text or CONSTANTS.RPC_FATAL_CODE in text): diff --git a/mizar/daemon/app.py b/mizar/daemon/app.py index 0492fe17..e2be251c 100644 --- a/mizar/daemon/app.py +++ b/mizar/daemon/app.py @@ -77,7 +77,7 @@ def init(benchmark=False): output = r.stdout.read().decode().strip() logging.info("Removed existing XDP program: {}".format(output)) - cmd = "nsenter -t 1 -m -u -n -i /trn_bin/transitd &" + cmd = "nsenter -t 1 -m -u -n -i /trn_bin/transitd >transitd.log &" r = subprocess.Popen(cmd, shell=True) logging.info("Running transitd") time.sleep(1) diff --git a/mizar/daemon/interface_service.py b/mizar/daemon/interface_service.py index 59a6ce52..db9253dc 100644 --- a/mizar/daemon/interface_service.py +++ b/mizar/daemon/interface_service.py @@ -91,26 +91,30 @@ def _CreateVethInterface(self, interface): try: logger.info("Creating interface {}".format(veth_name)) self.iproute.link('add', ifname=veth_name, - peer=veth_peer, kind='veth') + peer=veth_peer, kind='veth') except Exception as e: if e.code == CONSTANTS.NETLINK_FILE_EXISTS_ERROR: - logger.info("Veth already exists! Continuing") + veth_index = get_iface_index(veth_name, self.iproute) + logger.info( + "Veth already exists! veth index is {} Continuing".format(veth_index)) pass - else: logger.info( "Unknown exception occured when creating veth {}".format(e)) - veth_index = get_iface_index(veth_name, self.iproute) else: logger.info("Interface {} already exists!".format(veth_name)) + veth_index = get_iface_index(veth_name, self.iproute) + mac_address = "" + if veth_index != -1: + mac_address = get_iface_mac(veth_index, self.iproute) # Update the mac address with the interface address address = InterfaceAddress( version=interface.address.version, ip_address=interface.address.ip_address, ip_prefix=interface.address.ip_prefix, gateway_ip=interface.address.gateway_ip, - mac=get_iface_mac(veth_index, self.iproute), + mac=mac_address, tunnel_id=interface.address.tunnel_id ) interface.address.CopyFrom(address) @@ -189,7 +193,8 @@ def _ConfigureTransitAgent(self, interface): update the agent metadata and endpoint. """ pod_name = get_pod_name(interface.interface_id.pod_id) - logger.info("Loading transit agent and configuring for pod {}".format(pod_name)) + logger.info( + "Loading transit agent and configuring for pod {}".format(pod_name)) self.rpc.load_transit_agent_xdp(interface) for bouncer in interface.bouncers: diff --git a/mizar/dp/mizar/operators/bouncers/bouncers_operator.py b/mizar/dp/mizar/operators/bouncers/bouncers_operator.py index 5ade5022..5ab9929d 100644 --- a/mizar/dp/mizar/operators/bouncers/bouncers_operator.py +++ b/mizar/dp/mizar/operators/bouncers/bouncers_operator.py @@ -69,31 +69,38 @@ def store_update(self, b): def set_bouncer_provisioned(self, bouncer): bouncer.set_status(OBJ_STATUS.bouncer_status_provisioned) + self.store_update(bouncer) bouncer.update_obj() def update_bouncers_with_divider(self, div, task): bouncers = self.store.get_bouncers_of_vpc(div.vpc) - for b in bouncers.values(): + for b in list(bouncers.values()): b.update_vpc(set([div]), task) def delete_divider_from_bouncers(self, div, task): bouncers = self.store.get_bouncers_of_vpc(div.vpc) - for b in bouncers.values(): + for b in list(bouncers.values()): b.update_vpc(set([div]), task, False) def update_endpoint_with_bouncers(self, ep, task): + self.update_endpoint_obj_with_bouncers(ep) bouncers = self.store.get_bouncers_of_net(ep.net) + if not bouncers: + task.raise_temporary_error( + "Provisiond EP {}: Bouncers not yet ready!".format(ep.name)) eps = set([ep]) - for key in bouncers: + for key in list(bouncers): bouncers[key].update_eps(eps, task) + def update_endpoint_obj_with_bouncers(self, ep): + bouncers = self.store.get_bouncers_of_net(ep.net) if ep.type == OBJ_DEFAULTS.ep_type_simple or ep.type == OBJ_DEFAULTS.ep_type_host: ep.update_bouncers_list(bouncers) def delete_endpoint_from_bouncers(self, ep): bouncers = self.store.get_bouncers_of_net(ep.net) eps = set([ep]) - for key in bouncers: + for key in list(bouncers): bouncers[key].delete_eps(eps) self.store.update_bouncers_of_net(ep.net, bouncers) if ep.type == OBJ_DEFAULTS.ep_type_simple: diff --git a/mizar/dp/mizar/operators/dividers/dividers_operator.py b/mizar/dp/mizar/operators/dividers/dividers_operator.py index cce28fce..04f7f4cd 100644 --- a/mizar/dp/mizar/operators/dividers/dividers_operator.py +++ b/mizar/dp/mizar/operators/dividers/dividers_operator.py @@ -73,23 +73,23 @@ def set_divider_provisioned(self, div): def update_divider_with_bouncers(self, bouncer, net, task): dividers = self.store.get_dividers_of_vpc(bouncer.vpc).values() - for d in dividers: + for d in list(dividers): d.update_net(net, task) def delete_bouncer_from_dividers(self, bouncer, net, task): dividers = self.store.get_dividers_of_vpc(bouncer.vpc).values() - for d in dividers: + for d in list(dividers): d.update_net(net, task, False) def update_net(self, net, task, dividers=None): if not dividers: dividers = self.store.get_dividers_of_vpc(net.vpc).values() - for d in dividers: + for d in list(dividers): d.update_net(net, task) def delete_net(self, net): dividers = self.store.get_dividers_of_vpc(net.vpc).values() - for d in dividers: + for d in list(dividers): d.delete_net(net) def delete_nets_from_divider(self, nets, divider): diff --git a/mizar/dp/mizar/operators/endpoints/endpoints_operator.py b/mizar/dp/mizar/operators/endpoints/endpoints_operator.py index 7bd7484c..78ac6809 100644 --- a/mizar/dp/mizar/operators/endpoints/endpoints_operator.py +++ b/mizar/dp/mizar/operators/endpoints/endpoints_operator.py @@ -271,7 +271,7 @@ def delete_endpoints_from_bouncers(self, bouncer): def delete_bouncer_from_endpoints(self, bouncer, task): eps = self.store.get_eps_in_net(bouncer.net).values() - for ep in eps: + for ep in list(eps): if ep.type == OBJ_DEFAULTS.ep_type_simple or ep.type == OBJ_DEFAULTS.ep_type_host: ep.update_bouncers({bouncer.name: bouncer}, task, False) @@ -454,7 +454,13 @@ def init_simple_endpoint_interfaces(self, worker_ip, spec, task): # allocate the mac addresses for us. logger.info("init_simple_endpoint_interface on {} for {}".format( worker_ip, spec['name'])) - return InterfaceServiceClient(worker_ip).InitializeInterfaces(interfaces, task) + interfaces = InterfaceServiceClient( + worker_ip).InitializeInterfaces(interfaces, task) + for interface in interfaces.interfaces: + if not interface.address.mac: + task.raise_temporary_error( + "Veth did not come up in time for pod {} interface {}".format(pod_id, interface)) + return interfaces return None def init_host_endpoint_interfaces(self, droplet, ifname, veth_name, peer_name, task): diff --git a/mizar/dp/mizar/workflows/bouncers/create.py b/mizar/dp/mizar/workflows/bouncers/create.py index a664decd..25c3e8b5 100644 --- a/mizar/dp/mizar/workflows/bouncers/create.py +++ b/mizar/dp/mizar/workflows/bouncers/create.py @@ -71,8 +71,6 @@ def run(self): net.bouncers[bouncer.name] = bouncer dividers_opr.update_divider_with_bouncers(bouncer, net, self) - endpoints_opr.update_bouncer_with_endpoints(bouncer, self) - endpoints_opr.update_endpoints_with_bouncers(bouncer, self) bouncer.load_transit_xdp_pipeline_stage(self) bouncers_opr.set_bouncer_provisioned(bouncer) self.finalize() diff --git a/mizar/dp/mizar/workflows/bouncers/provisioned.py b/mizar/dp/mizar/workflows/bouncers/provisioned.py index 5c1082ba..3b5ba111 100644 --- a/mizar/dp/mizar/workflows/bouncers/provisioned.py +++ b/mizar/dp/mizar/workflows/bouncers/provisioned.py @@ -24,12 +24,14 @@ from mizar.dp.mizar.operators.bouncers.bouncers_operator import * from mizar.dp.mizar.operators.droplets.droplets_operator import * from mizar.dp.mizar.operators.vpcs.vpcs_operator import * +from mizar.dp.mizar.operators.endpoints.endpoints_operator import * logger = logging.getLogger() bouncers_opr = BouncerOperator() vpcs_opr = VpcOperator() droplets_opr = DropletOperator() +endpoints_opr = EndpointOperator() class BouncerProvisioned(WorkflowTask): @@ -44,5 +46,7 @@ def run(self): self.param.name, self.param.spec) bouncer.set_vni(vpcs_opr.store.get_vpc(bouncer.vpc).vni) bouncer.droplet_obj = droplets_opr.store.get_droplet(bouncer.droplet) + endpoints_opr.update_bouncer_with_endpoints(bouncer, self) + endpoints_opr.update_endpoints_with_bouncers(bouncer, self) bouncers_opr.store_update(bouncer) self.finalize() diff --git a/mizar/dp/mizar/workflows/builtins/pods/create.py b/mizar/dp/mizar/workflows/builtins/pods/create.py index 003b4b90..59902cc9 100644 --- a/mizar/dp/mizar/workflows/builtins/pods/create.py +++ b/mizar/dp/mizar/workflows/builtins/pods/create.py @@ -95,6 +95,10 @@ def run(self): "VPC {} has no subnets to allocate pod {}!".format(vpc_name, self.param.name)) spec['vpc'] = vpc_name spec['subnet'] = subnet_name + else: + if not COMPUTE_PROVIDER.k8s: + self.raise_temporary_error( + "VPC for pod {} not yet created!".format(self.param.name)) spec['vni'] = vpc_opr.store_get(spec['vpc']).vni spec['droplet'] = droplet_opr.store_get_by_main_ip(spec['hostIP']) diff --git a/mizar/dp/mizar/workflows/builtins/services/create.py b/mizar/dp/mizar/workflows/builtins/services/create.py index 67c685e5..304a2891 100644 --- a/mizar/dp/mizar/workflows/builtins/services/create.py +++ b/mizar/dp/mizar/workflows/builtins/services/create.py @@ -82,6 +82,8 @@ def run(self): if not net: self.raise_temporary_error( "Task: {} Net not yet created.".format(self.__class__.__name__)) + if not net.vni: + self.raise_temporary_error("k8sServiceCreate: Net {} does not yet have a vni!".format(net.name)) logger.info("Creating scaled endpoint in subnet: {}.".format(net.name)) ep = endpoints_opr.create_scaled_endpoint( self.param.name, name, self.param.spec, net, self.param.extra, self.param.body['metadata']['namespace']) diff --git a/mizar/dp/mizar/workflows/droplets/provisioned.py b/mizar/dp/mizar/workflows/droplets/provisioned.py index 806b4a64..3e6d8c2d 100644 --- a/mizar/dp/mizar/workflows/droplets/provisioned.py +++ b/mizar/dp/mizar/workflows/droplets/provisioned.py @@ -43,7 +43,7 @@ def run(self): logger.info("Run {task}".format(task=self.__class__.__name__)) droplet = droplets_opr.get_droplet_stored_obj( self.param.name, self.param.spec) - for vpc in vpcs_opr.store.get_all_vpcs(): + for vpc in list(vpcs_opr.store.get_all_vpcs()): if droplet.name not in droplets_opr.store.vpc_droplet_store[vpc.name]: if vpc.name not in nets_opr.store.nets_vpc_store: self.raise_temporary_error( diff --git a/mizar/dp/mizar/workflows/endpoints/create.py b/mizar/dp/mizar/workflows/endpoints/create.py index 527c641e..abec7f6f 100644 --- a/mizar/dp/mizar/workflows/endpoints/create.py +++ b/mizar/dp/mizar/workflows/endpoints/create.py @@ -52,8 +52,18 @@ def run(self): self.raise_temporary_error( "Task: {} Endpoint: {} Droplet Object {} not ready. ".format(self.__class__.__name__, ep.name, ep.droplet)) vpc = vpcs_opr.store.get_vpc(ep.vpc) + # EP create wait for bouncer + net_bouncer = list( + bouncers_opr.store.get_bouncers_of_net(ep.net).values()) + if not net_bouncer: + self.raise_temporary_error( + "EP create {}: bouncers not yet ready for net {}".format(ep.name, ep.net)) + if net_bouncer[0].status != OBJ_STATUS.bouncer_status_provisioned: + self.raise_temporary_error( + "EP create {}: bouncers not yet ready for net {}".format(ep.name, ep.net)) nets_opr.allocate_endpoint(ep, vpc) - bouncers_opr.update_endpoint_with_bouncers(ep, self) + bouncers_opr.update_endpoint_obj_with_bouncers(ep) + if ep.type == OBJ_DEFAULTS.ep_type_simple or ep.type == OBJ_DEFAULTS.ep_type_host: if ep.type == OBJ_DEFAULTS.ep_type_host: logger.info("Activate host interface for vpc {} on droplet {}".format( diff --git a/mizar/dp/mizar/workflows/nets/create.py b/mizar/dp/mizar/workflows/nets/create.py index 87db937f..af2c84eb 100644 --- a/mizar/dp/mizar/workflows/nets/create.py +++ b/mizar/dp/mizar/workflows/nets/create.py @@ -62,7 +62,7 @@ def run(self): if len(dividers_opr.store.get_dividers_of_vpc(n.vpc)) < 1: self.raise_temporary_error( "Task: {} Net: {} Dividers not available".format(self.__class__.__name__, n.name)) - logger.info("NetCreate Net ip is {}".format(n.ip)) + logger.info("NetCreate Net ip is {}, VNI is {}".format(n.ip, n.vni)) nets_opr.create_net_bouncers(n, n.n_bouncers) nets_opr.store_update(n) ep = endpoints_opr.create_gw_endpoint( diff --git a/mizar/dp/mizar/workflows/nets/provisioned.py b/mizar/dp/mizar/workflows/nets/provisioned.py index ac840440..05c51a59 100644 --- a/mizar/dp/mizar/workflows/nets/provisioned.py +++ b/mizar/dp/mizar/workflows/nets/provisioned.py @@ -52,7 +52,7 @@ def run(self): if d[0] == 'change': self.process_change(net=net, field=d[1], old=d[2], new=d[3]) vpc = vpcs_opr.store.get_vpc(net.vpc) - for droplet in droplets_opr.store.get_all_droplets(): + for droplet in list(droplets_opr.store.get_all_droplets()): logger.info("Net: Available droplets for vpc {}: {}".format( vpc.name, droplets_opr.store.droplets_store.keys())) if vpc.name not in droplets_opr.store_get_vpc_to_droplet(droplet): diff --git a/mizar/obj/endpoint.py b/mizar/obj/endpoint.py index 1650d9e7..6fbb3244 100644 --- a/mizar/obj/endpoint.py +++ b/mizar/obj/endpoint.py @@ -261,6 +261,8 @@ def set_vpc_prefix(self, vpc_prefix): def update_bouncers(self, bouncers, task, add=True): for bouncer in bouncers.values(): if add: + logger.info("endpoint obj: update_bouncer: ep {} update agent with bouncer {}".format( + self.name, bouncer.name)) self.bouncers[bouncer.name] = bouncer self.update_agent_substrate(self, bouncer, task) else: diff --git a/mizar/store/operator_store.py b/mizar/store/operator_store.py index 5bf21e97..ef62e45d 100644 --- a/mizar/store/operator_store.py +++ b/mizar/store/operator_store.py @@ -439,11 +439,12 @@ def update_pod_namespace_store(self, pod_name, namespace_name): self.update_namespace_pod_store(namespace_name, pod_name) def delete_pod_namespace_store(self, pod_name): - ns = self.pod_namespace_store[pod_name] - if ns in self.namespace_pod_store and pod_name in self.namespace_pod_store[ns]: - self.namespace_pod_store[ns].remove(pod_name) if pod_name in self.pod_namespace_store: - del self.pod_namespace_store[pod_name] + ns = self.pod_namespace_store[pod_name] + if ns in self.namespace_pod_store and pod_name in self.namespace_pod_store[ns]: + self.namespace_pod_store[ns].remove(pod_name) + if pod_name in self.pod_namespace_store: + del self.pod_namespace_store[pod_name] def update_droplet(self, droplet): self.droplets_store[droplet.name] = droplet diff --git a/src/dmn/trn_agent_xdp_usr.c b/src/dmn/trn_agent_xdp_usr.c index 59cf4cba..25705b13 100644 --- a/src/dmn/trn_agent_xdp_usr.c +++ b/src/dmn/trn_agent_xdp_usr.c @@ -521,7 +521,7 @@ static int _trn_bpf_agent_prog_load_xattr(struct agent_user_metadata_t *md, _REUSE_MAP_IF_PINNED(conn_track_cache); _REUSE_MAP_IF_PINNED(ing_pod_label_policy_map); _REUSE_MAP_IF_PINNED(ing_namespace_label_policy_map); - _REUSE_MAP_IF_PINNED(ing_pod_and_namespace_label_policy_map); + _REUSE_MAP_IF_PINNED(ing_pod_and_namespace_label_policy_map); _REUSE_MAP_IF_PINNED(tx_stats_map); /* Only one prog is supported */ @@ -625,6 +625,7 @@ int trn_agent_metadata_init(struct agent_user_metadata_t *md, char *itf, TRN_LOG_ERROR("Error retrieving index of interface"); return 1; } + TRN_LOG_DEBUG("trn_agent_metadata_init: mapped hosted_interface:%s to index %d", itf, md->ifindex); if (_trn_bpf_agent_prog_load_xattr(md, &prog_load_attr, &md->obj, &md->prog_fd)) { diff --git a/src/dmn/trn_rpc_protocol_handlers_1.c b/src/dmn/trn_rpc_protocol_handlers_1.c index a10fb61e..420727bf 100644 --- a/src/dmn/trn_rpc_protocol_handlers_1.c +++ b/src/dmn/trn_rpc_protocol_handlers_1.c @@ -253,6 +253,7 @@ int *update_ep_1_svc(rpc_trn_endpoint_t *ep, struct svc_req *rqstp) if (strcmp(ep->hosted_interface, "") != 0) { epval.hosted_iface = if_nametoindex(ep->hosted_interface); + TRN_LOG_DEBUG("update_ep: mapped hosted_interface:%s to index %d", ep->hosted_interface, epval.hosted_iface); } else { epval.hosted_iface = -1; } @@ -854,6 +855,7 @@ int *update_agent_ep_1_svc(rpc_trn_endpoint_t *ep, struct svc_req *rqstp) if (strcmp(ep->hosted_interface, "") != 0) { epval.hosted_iface = if_nametoindex(ep->hosted_interface); + TRN_LOG_DEBUG("update_agent_md: mapped hosted_interface:%s to index %d", ep->hosted_interface, epval.hosted_iface); } else { epval.hosted_iface = -1; } @@ -1014,7 +1016,7 @@ int *update_packet_metadata_1_svc(rpc_trn_packet_metadata_t *packet_metadata, st goto error; } - memcpy(key.tunip, &packet_metadata->tunid, sizeof(packet_metadata->tunid)); + memcpy(key.tunip, &packet_metadata->tunid, sizeof(packet_metadata->tunid)); key.tunip[2] = packet_metadata->ip; value.pod_label_value = packet_metadata->pod_label_value; value.namespace_label_value = packet_metadata->namespace_label_value; @@ -1412,7 +1414,7 @@ int *update_transit_network_policy_1_svc(rpc_trn_vsip_cidr_t *policy, struct svc cidr.prefixlen = policy->cidr_prefixlen + 96; cidr.local_ip = policy->local_ip; cidr.remote_ip = policy->cidr_ip; - TRN_LOG_INFO("policy: tunnel_id %ld; local ip 0x%x; cidr ip 0x%x\n", + TRN_LOG_INFO("policy: tunnel_id %ld; local ip 0x%x; cidr ip 0x%x\n", policy->tunid, policy->local_ip, policy->cidr_ip); if (type == PRIMARY) { @@ -1468,7 +1470,7 @@ int *update_agent_network_policy_1_svc(rpc_trn_vsip_cidr_t *policy, struct svc_r cidr.prefixlen = policy->cidr_prefixlen + 96; cidr.local_ip = policy->local_ip; cidr.remote_ip = policy->cidr_ip; - TRN_LOG_INFO("policy: tunnel_id %ld; local ip 0x%x; cidr ip 0x%x \n", + TRN_LOG_INFO("policy: tunnel_id %ld; local ip 0x%x; cidr ip 0x%x \n", policy->tunid, policy->local_ip, policy->cidr_ip); if (type == PRIMARY) { @@ -1523,7 +1525,7 @@ int *delete_transit_network_policy_1_svc(rpc_trn_vsip_cidr_key_t *policy_key, st cidr.prefixlen = policy_key->cidr_prefixlen + 96; cidr.local_ip = policy_key->local_ip; cidr.remote_ip = policy_key->cidr_ip; - TRN_LOG_INFO("policy: tunnel_id %ld; local ip 0x%x; cidr ip 0x%x\n", + TRN_LOG_INFO("policy: tunnel_id %ld; local ip 0x%x; cidr ip 0x%x\n", policy_key->tunid, policy_key->local_ip, policy_key->cidr_ip); if (type == PRIMARY) { @@ -1578,7 +1580,7 @@ int *delete_agent_network_policy_1_svc(rpc_trn_vsip_cidr_key_t *policy_key, stru cidr.prefixlen = policy_key->cidr_prefixlen + 96; cidr.local_ip = policy_key->local_ip; cidr.remote_ip = policy_key->cidr_ip; - TRN_LOG_INFO("policy: tunnel_id %ld; local ip 0x%x; cidr ip 0x%x\n", + TRN_LOG_INFO("policy: tunnel_id %ld; local ip 0x%x; cidr ip 0x%x\n", policy_key->tunid, policy_key->local_ip, policy_key->cidr_ip); if (type == PRIMARY) { @@ -1762,7 +1764,7 @@ int *update_transit_network_policy_protocol_port_1_svc(rpc_trn_vsip_ppo_t *ppo, static int result = -1; int rc; char *itf = ppo->interface; - + TRN_LOG_INFO("update_transit_network_policy_protocol_port_1_svc service"); struct vsip_ppo_t policy; struct user_metadata_t *md = trn_itf_table_find(itf); @@ -1776,7 +1778,7 @@ int *update_transit_network_policy_protocol_port_1_svc(rpc_trn_vsip_ppo_t *ppo, policy.local_ip = ppo->local_ip; policy.proto = ppo->proto; policy.port = ppo->port; - TRN_LOG_INFO("ppo: tunnel_id %ld; local ip 0x%x; protocol %d; port %d\n", + TRN_LOG_INFO("ppo: tunnel_id %ld; local ip 0x%x; protocol %d; port %d\n", ppo->tunid, ppo->local_ip, ppo->proto, ppo->port); rc = trn_update_transit_network_policy_protocol_port_map(md, &policy, ppo->bit_val); @@ -1814,7 +1816,7 @@ int *update_agent_network_policy_protocol_port_1_svc(rpc_trn_vsip_ppo_t *ppo, st policy.local_ip = ppo->local_ip; policy.proto = ppo->proto; policy.port = ppo->port; - TRN_LOG_INFO("ppo: tunnel_id %ld; local ip 0x%x; protocol %d; port %d\n", + TRN_LOG_INFO("ppo: tunnel_id %ld; local ip 0x%x; protocol %d; port %d\n", ppo->tunid, ppo->local_ip, ppo->proto, ppo->port); rc = trn_update_agent_network_policy_protocol_port_map(md, &policy, ppo->bit_val); @@ -1838,7 +1840,7 @@ int *delete_transit_network_policy_protocol_port_1_svc(rpc_trn_vsip_ppo_key_t *p static int result = -1; int rc; char *itf = ppo_key->interface; - + TRN_LOG_INFO("delete_transit_network_policy_protocol_port_1 service"); struct vsip_ppo_t policy; struct user_metadata_t *md = trn_itf_table_find(itf); @@ -1852,7 +1854,7 @@ int *delete_transit_network_policy_protocol_port_1_svc(rpc_trn_vsip_ppo_key_t *p policy.local_ip = ppo_key->local_ip; policy.proto = ppo_key->proto; policy.port = ppo_key->port; - TRN_LOG_INFO("ppo: tunnel_id %ld; local ip 0x%x; protocol %d; port %d\n", + TRN_LOG_INFO("ppo: tunnel_id %ld; local ip 0x%x; protocol %d; port %d\n", ppo_key->tunid, ppo_key->local_ip, ppo_key->proto, ppo_key->port); rc = trn_delete_transit_network_policy_protocol_port_map(md, &policy); @@ -1891,7 +1893,7 @@ int *delete_agent_network_policy_protocol_port_1_svc(rpc_trn_vsip_ppo_key_t *ppo policy.proto = ppo_key->proto; policy.port = ppo_key->port; - TRN_LOG_INFO("ppo: tunnel_id %ld; local ip 0x%x; protocol %d; port %d \n", + TRN_LOG_INFO("ppo: tunnel_id %ld; local ip 0x%x; protocol %d; port %d \n", ppo_key->tunid, ppo_key->local_ip, ppo_key->proto, ppo_key->port); rc = trn_delete_agent_network_policy_protocol_port_map(md, &policy); @@ -1915,7 +1917,7 @@ int *update_transit_pod_label_policy_1_svc(rpc_trn_pod_label_policy_t *rpc_obj, static int result = -1; int rc; char *itf = rpc_obj->interface; - + TRN_LOG_INFO("update_transit_pod_label_policy_1_svc service"); struct pod_label_policy_t policy; struct user_metadata_t *md = trn_itf_table_find(itf); @@ -1924,10 +1926,10 @@ int *update_transit_pod_label_policy_1_svc(rpc_trn_pod_label_policy_t *rpc_obj, result = RPC_TRN_ERROR; goto error; } - + policy.tunnel_id = rpc_obj->tunid; policy.pod_label_value = rpc_obj->pod_label_value; - TRN_LOG_INFO("rpc_obj: pod_label_value %d\n", + TRN_LOG_INFO("rpc_obj: pod_label_value %d\n", rpc_obj->pod_label_value); rc = trn_update_transit_pod_label_policy_map(md, &policy, rpc_obj->bit_val); @@ -1951,7 +1953,7 @@ int *delete_transit_pod_label_policy_1_svc(rpc_trn_pod_label_policy_key_t *key, static int result = -1; int rc; char *itf = key->interface; - + TRN_LOG_INFO("delete_transit_network_policy_protocol_port_1 service"); struct pod_label_policy_t policy; struct user_metadata_t *md = trn_itf_table_find(itf); @@ -1963,7 +1965,7 @@ int *delete_transit_pod_label_policy_1_svc(rpc_trn_pod_label_policy_key_t *key, policy.tunnel_id = key->tunid; policy.pod_label_value = key->pod_label_value; - TRN_LOG_INFO("key: pod_label_value %d\n", + TRN_LOG_INFO("key: pod_label_value %d\n", key->pod_label_value); rc = trn_delete_transit_pod_label_policy_map(md, &policy); @@ -1987,7 +1989,7 @@ int *update_transit_namespace_label_policy_1_svc(rpc_trn_namespace_label_policy_ static int result = -1; int rc; char *itf = rpc_obj->interface; - + TRN_LOG_INFO("update_transit_namespace_label_policy_1_svc service"); struct namespace_label_policy_t policy; struct user_metadata_t *md = trn_itf_table_find(itf); @@ -1996,10 +1998,10 @@ int *update_transit_namespace_label_policy_1_svc(rpc_trn_namespace_label_policy_ result = RPC_TRN_ERROR; goto error; } - + policy.tunnel_id = rpc_obj->tunid; policy.namespace_label_value = rpc_obj->namespace_label_value; - TRN_LOG_INFO("rpc_obj: namespace_label_value %d\n", + TRN_LOG_INFO("rpc_obj: namespace_label_value %d\n", rpc_obj->namespace_label_value); rc = trn_update_transit_namespace_label_policy_map(md, &policy, rpc_obj->bit_val); @@ -2023,7 +2025,7 @@ int *delete_transit_namespace_label_policy_1_svc(rpc_trn_namespace_label_policy_ static int result = -1; int rc; char *itf = key->interface; - + TRN_LOG_INFO("delete_transit_network_policy_protocol_port_1 service"); struct namespace_label_policy_t policy; struct user_metadata_t *md = trn_itf_table_find(itf); @@ -2035,7 +2037,7 @@ int *delete_transit_namespace_label_policy_1_svc(rpc_trn_namespace_label_policy_ policy.tunnel_id = key->tunid; policy.namespace_label_value = key->namespace_label_value; - TRN_LOG_INFO("key: namespace_label_value %d\n", + TRN_LOG_INFO("key: namespace_label_value %d\n", key->namespace_label_value); rc = trn_delete_transit_namespace_label_policy_map(md, &policy); @@ -2059,7 +2061,7 @@ int *update_transit_pod_and_namespace_label_policy_1_svc(rpc_trn_pod_and_namespa static int result = -1; int rc; char *itf = rpc_obj->interface; - + TRN_LOG_INFO("update_transit_pod_and_namespace_label_policy_1_svc service"); struct pod_and_namespace_label_policy_t policy; struct user_metadata_t *md = trn_itf_table_find(itf); @@ -2068,11 +2070,11 @@ int *update_transit_pod_and_namespace_label_policy_1_svc(rpc_trn_pod_and_namespa result = RPC_TRN_ERROR; goto error; } - + policy.tunnel_id = rpc_obj->tunid; policy.pod_label_value = rpc_obj->pod_label_value; policy.namespace_label_value = rpc_obj->namespace_label_value; - TRN_LOG_INFO("rpc_obj: pod_label_value %d namespace_label_value %d\n", + TRN_LOG_INFO("rpc_obj: pod_label_value %d namespace_label_value %d\n", rpc_obj->pod_label_value, rpc_obj->namespace_label_value); rc = trn_update_transit_pod_and_namespace_label_policy_map(md, &policy, rpc_obj->bit_val); @@ -2096,7 +2098,7 @@ int *delete_transit_pod_and_namespace_label_policy_1_svc(rpc_trn_pod_and_namespa static int result = -1; int rc; char *itf = key->interface; - + TRN_LOG_INFO("delete_transit_network_policy_protocol_port_1 service"); struct pod_and_namespace_label_policy_t policy; struct user_metadata_t *md = trn_itf_table_find(itf); @@ -2109,7 +2111,7 @@ int *delete_transit_pod_and_namespace_label_policy_1_svc(rpc_trn_pod_and_namespa policy.tunnel_id = key->tunid; policy.pod_label_value = key->pod_label_value; policy.namespace_label_value = key->namespace_label_value; - TRN_LOG_INFO("key: pod_label_value %d namespace_label_value %d\n", + TRN_LOG_INFO("key: pod_label_value %d namespace_label_value %d\n", key->pod_label_value, key->namespace_label_value); rc = trn_delete_transit_pod_and_namespace_label_policy_map(md, &policy); diff --git a/src/dmn/trn_transit_xdp_usr.c b/src/dmn/trn_transit_xdp_usr.c index 7e371e8e..e69cfa78 100644 --- a/src/dmn/trn_transit_xdp_usr.c +++ b/src/dmn/trn_transit_xdp_usr.c @@ -566,7 +566,7 @@ int trn_user_metadata_init(struct user_metadata_t *md, char *itf, TRN_LOG_ERROR("if_nametoindex"); return 1; } - + TRN_LOG_DEBUG("trn_user_metadata_init: mapped hosted_interface:%s to index %d", itf, md->ifindex); md->eth.ip = trn_get_interface_ipv4(md->ifindex); md->eth.iface_index = md->ifindex;