diff options
author | thomas <thomas@FreeBSD.org> | 2012-08-03 14:55:35 +0000 |
---|---|---|
committer | thomas <thomas@FreeBSD.org> | 2012-08-03 14:55:35 +0000 |
commit | 671119f048de83a67b4dbca3acbbae02f3a6254e (patch) | |
tree | aa5c2e2508c7046f38f5f80faeeb09b148893d62 /sbin/geom/class/multipath/geom_multipath.c | |
parent | 553b28950617d1cb84240453941c4866c5253b82 (diff) | |
download | FreeBSD-src-671119f048de83a67b4dbca3acbbae02f3a6254e.zip FreeBSD-src-671119f048de83a67b4dbca3acbbae02f3a6254e.tar.gz |
New command "gmultipath prefer" to force selection of a specified
provider in an Active/Passive configuration.
Reviewed by: mav
MFC after: 4 weeks
Diffstat (limited to 'sbin/geom/class/multipath/geom_multipath.c')
-rw-r--r-- | sbin/geom/class/multipath/geom_multipath.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sbin/geom/class/multipath/geom_multipath.c b/sbin/geom/class/multipath/geom_multipath.c index a821951..cdf35d0 100644 --- a/sbin/geom/class/multipath/geom_multipath.c +++ b/sbin/geom/class/multipath/geom_multipath.c @@ -49,6 +49,7 @@ uint32_t version = G_MULTIPATH_VERSION; static void mp_main(struct gctl_req *, unsigned int); static void mp_label(struct gctl_req *); static void mp_clear(struct gctl_req *); +static void mp_prefer(struct gctl_req *); struct g_command class_commands[] = { { @@ -87,6 +88,10 @@ struct g_command class_commands[] = { "[-v] name prov" }, { + "prefer", G_FLAG_VERBOSE, mp_main, G_NULL_OPTS, + "[-v] prov ..." + }, + { "fail", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, "[-v] name prov" }, @@ -131,6 +136,8 @@ mp_main(struct gctl_req *req, unsigned int flags __unused) mp_label(req); } else if (strcmp(name, "clear") == 0) { mp_clear(req); + } else if (strcmp(name, "prefer") == 0) { + mp_prefer(req); } else { gctl_error(req, "Unknown command: %s.", name); } @@ -294,3 +301,22 @@ mp_clear(struct gctl_req *req) } } +static void +mp_prefer(struct gctl_req *req) +{ + const char *name, *comp, *errstr; + int nargs; + + nargs = gctl_get_int(req, "nargs"); + if (nargs != 2) { + gctl_error(req, "Usage: prefer GEOM PROVIDER"); + return; + } + name = gctl_get_ascii(req, "arg0"); + comp = gctl_get_ascii(req, "arg1"); + errstr = gctl_issue (req); + if (errstr != NULL) { + fprintf(stderr, "Can't set %s preferred provider to %s: %s.\n", + name, comp, errstr); + } +} |