When importing, CPT was read from tunables field but in fact, it is in
the same level in the YAML file generated during export.
Test-parameters: trivial testlist=sanity-lnet
Signed-off-by: Cyril Bordage <cbordage@whamcloud.com>
Change-Id: Iea7b6189ad1a25b95ae6416d75ee2cbe4dca2fbf
Reviewed-on: https://review.whamcloud.com/46541
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
static bool
yaml_extract_cmn_tunables(struct cYAML *tree,
static bool
yaml_extract_cmn_tunables(struct cYAML *tree,
- struct lnet_ioctl_config_lnd_cmn_tunables *tunables,
- struct cfs_expr_list **global_cpts)
+ struct lnet_ioctl_config_lnd_cmn_tunables *tunables)
- struct cYAML *tun, *item, *smp;
- int rc;
+ struct cYAML *tun, *item;
tun = cYAML_get_object_item(tree, "tunables");
if (tun != NULL) {
tun = cYAML_get_object_item(tree, "tunables");
if (tun != NULL) {
item = cYAML_get_object_item(tun, "credits");
if (item != NULL)
tunables->lct_max_tx_credits = item->cy_valueint;
item = cYAML_get_object_item(tun, "credits");
if (item != NULL)
tunables->lct_max_tx_credits = item->cy_valueint;
- smp = cYAML_get_object_item(tun, "CPT");
- if (smp != NULL) {
- rc = cfs_expr_list_parse(smp->cy_valuestring,
- strlen(smp->cy_valuestring),
- 0, UINT_MAX, global_cpts);
- if (rc != 0)
- *global_cpts = NULL;
- }
static bool
yaml_extract_tunables(struct cYAML *tree,
struct lnet_ioctl_config_lnd_tunables *tunables,
static bool
yaml_extract_tunables(struct cYAML *tree,
struct lnet_ioctl_config_lnd_tunables *tunables,
- struct cfs_expr_list **global_cpts,
__u32 net_type)
{
bool rc;
__u32 net_type)
{
bool rc;
- rc = yaml_extract_cmn_tunables(tree, &tunables->lt_cmn,
- global_cpts);
+ rc = yaml_extract_cmn_tunables(tree, &tunables->lt_cmn);
+static void
+yaml_extract_cpt(struct cYAML *tree,
+ struct cfs_expr_list **global_cpts)
+{
+ int rc;
+ struct cYAML *smp;
+
+ smp = cYAML_get_object_item(tree, "CPT");
+ if (smp != NULL) {
+ rc = cfs_expr_list_parse(smp->cy_valuestring,
+ strlen(smp->cy_valuestring),
+ 0, UINT_MAX, global_cpts);
+ if (rc != 0)
+ *global_cpts = NULL;
+ }
+}
+
/*
* net:
* - net type: <net>[<NUM>]
/*
* net:
* - net type: <net>[<NUM>]
- found = yaml_extract_tunables(tree, &tunables, &global_cpts,
+ found = yaml_extract_tunables(tree, &tunables,
LNET_NETTYP(nw_descr.nw_id));
LNET_NETTYP(nw_descr.nw_id));
+ yaml_extract_cpt(tree, &global_cpts);
seq_no = cYAML_get_object_item(tree, "seq_no");
rc = lustre_lnet_config_ni(&nw_descr, global_cpts,
seq_no = cYAML_get_object_item(tree, "seq_no");
rc = lustre_lnet_config_ni(&nw_descr, global_cpts,
- found = yaml_extract_tunables(tree, &tunables, &global_cpts,
+ found = yaml_extract_tunables(tree, &tunables,
LNET_NETTYP(ip2nets.ip2nets_net.nw_id));
LNET_NETTYP(ip2nets.ip2nets_net.nw_id));
+ yaml_extract_cpt(tree, &global_cpts);
rc = lustre_lnet_config_ip2nets(&ip2nets,
(found) ? &tunables : NULL,
rc = lustre_lnet_config_ip2nets(&ip2nets,
(found) ? &tunables : NULL,
(seq_no) ? seq_no->cy_valueint : -1,
err_rc);
(seq_no) ? seq_no->cy_valueint : -1,
err_rc);
+ if (global_cpts != NULL)
+ cfs_expr_list_free(global_cpts);
+
/*
* don't stop because there was no match. Continue processing the
* rest of the rules. If non-match then nothing is configured
/*
* don't stop because there was no match. Continue processing the
* rest of the rules. If non-match then nothing is configured