X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Fportals.c;h=ca2eb34630f10cac43ab1c633f023aa80044571a;hb=3b0094779b58c162e5dc553f6d7cdff1910d0c3b;hp=9349b6b32f9f5d7788c3f357ed81193a57274a70;hpb=5c17777d97bd20cde68771c6186320b5eae90e62;p=fs%2Flustre-release.git diff --git a/lustre/utils/portals.c b/lustre/utils/portals.c index 9349b6b..ca2eb34 100644 --- a/lustre/utils/portals.c +++ b/lustre/utils/portals.c @@ -3,7 +3,7 @@ * * Copyright (c) 2013, 2017, Intel Corporation. * - * This file is part of Lustre, https://wiki.hpdd.intel.com/ + * This file is part of Lustre, https://wiki.whamcloud.com/ * * Portals is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -1383,6 +1383,8 @@ fault_simul_rule_add(__u32 opc, char *name, int argc, char **argv) { .name = "portal", .has_arg = required_argument, .val = 'p' }, { .name = "message", .has_arg = required_argument, .val = 'm' }, { .name = "health_error", .has_arg = required_argument, .val = 'e' }, + { .name = "local_nid", .has_arg = required_argument, .val = 'o' }, + { .name = "drop_all", .has_arg = no_argument, .val = 'x' }, { .name = NULL } }; if (argc == 1) { @@ -1391,7 +1393,7 @@ fault_simul_rule_add(__u32 opc, char *name, int argc, char **argv) return -1; } - optstr = opc == LNET_CTL_DROP_ADD ? "s:d:r:i:p:m:e:n" : "s:d:r:l:p:m:"; + optstr = opc == LNET_CTL_DROP_ADD ? "s:d:o:r:i:p:m:e:nx" : "s:d:o:r:l:p:m:"; memset(&attr, 0, sizeof(attr)); while (1) { char c = getopt_long(argc, argv, optstr, opts, NULL); @@ -1400,6 +1402,11 @@ fault_simul_rule_add(__u32 opc, char *name, int argc, char **argv) break; switch (c) { + case 'o': + rc = fault_attr_nid_parse(optarg, &attr.fa_local_nid); + if (rc != 0) + goto getopt_failed; + break; case 's': /* source NID/NET */ rc = fault_attr_nid_parse(optarg, &attr.fa_src); if (rc != 0) @@ -1428,6 +1435,11 @@ fault_simul_rule_add(__u32 opc, char *name, int argc, char **argv) } break; + case 'x': + if (opc == LNET_CTL_DROP_ADD) + attr.u.drop.da_drop_all = true; + break; + case 'n': if (opc == LNET_CTL_DROP_ADD) attr.u.drop.da_random = true; @@ -1502,6 +1514,9 @@ fault_simul_rule_add(__u32 opc, char *name, int argc, char **argv) return -1; } + if (attr.fa_local_nid == 0) + attr.fa_local_nid = LNET_NID_ANY; + data.ioc_flags = opc; data.ioc_inllen1 = sizeof(attr); data.ioc_inlbuf1 = (char *)&attr;