summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2004-05-26 11:36:27 +0000
committerpjd <pjd@FreeBSD.org>2004-05-26 11:36:27 +0000
commit4a04a3b0074cff6df372ea64435cdfaa51dd6835 (patch)
treeeadb9891f67e46eab311aeefbb0b247a60b9b6e2
parentff1f6d8a76071de2ae9e0605e4f8f839a95ac0d2 (diff)
downloadFreeBSD-src-4a04a3b0074cff6df372ea64435cdfaa51dd6835.zip
FreeBSD-src-4a04a3b0074cff6df372ea64435cdfaa51dd6835.tar.gz
Dump some more informations:
- device state - list of used providers - total number of disks - number of disks online Prodded by: Alex Deiter <tiamat@komi.mts.ru>
-rw-r--r--sys/geom/concat/g_concat.c45
-rw-r--r--sys/geom/stripe/g_stripe.c48
2 files changed, 57 insertions, 36 deletions
diff --git a/sys/geom/concat/g_concat.c b/sys/geom/concat/g_concat.c
index 43c99de..768e2cb 100644
--- a/sys/geom/concat/g_concat.c
+++ b/sys/geom/concat/g_concat.c
@@ -804,26 +804,37 @@ g_concat_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
{
struct g_concat_softc *sc;
+ g_topology_assert();
sc = gp->softc;
- if (sc == NULL)
+ if (sc == NULL || pp == NULL)
return;
- if (pp == NULL && cp == NULL) {
- sbuf_printf(sb, "%s<id>%u</id>\n", indent, (u_int)sc->sc_id);
- switch (sc->sc_type) {
- case G_CONCAT_TYPE_AUTOMATIC:
- sbuf_printf(sb, "%s<type>%s</type>\n", indent,
- "automatic");
- break;
- case G_CONCAT_TYPE_MANUAL:
- sbuf_printf(sb, "%s<type>%s</type>\n", indent,
- "manual");
- break;
- default:
- sbuf_printf(sb, "%s<type>%s</type>\n", indent,
- "unknown");
- break;
- }
+ sbuf_printf(sb, "%s<id>%u</id>\n", indent, (u_int)sc->sc_id);
+ switch (sc->sc_type) {
+ case G_CONCAT_TYPE_AUTOMATIC:
+ sbuf_printf(sb, "%s<type>%s</type>\n", indent, "automatic");
+ break;
+ case G_CONCAT_TYPE_MANUAL:
+ sbuf_printf(sb, "%s<type>%s</type>\n", indent, "manual");
+ break;
+ default:
+ sbuf_printf(sb, "%s<type>%s</type>\n", indent, "unknown");
+ break;
}
+ sbuf_printf(sb, "%s<providers>", indent);
+ LIST_FOREACH(cp, &gp->consumer, consumer) {
+ if (cp->provider == NULL)
+ continue;
+ sbuf_printf(sb, "%s", cp->provider->name);
+ if (LIST_NEXT(cp, consumer) != NULL)
+ sbuf_printf(sb, " ");
+ }
+ sbuf_printf(sb, "</providers>\n");
+ sbuf_printf(sb, "%s<status>total=%u, online=%u</status>\n", indent,
+ sc->sc_ndisks, g_concat_nvalid(sc));
+ if (pp->error == 0)
+ sbuf_printf(sb, "%s<state>UP</state>\n", indent);
+ else
+ sbuf_printf(sb, "%s<state>DOWN</state>\n", indent);
}
DECLARE_GEOM_CLASS(g_concat_class, g_concat);
diff --git a/sys/geom/stripe/g_stripe.c b/sys/geom/stripe/g_stripe.c
index 3b596b0..1d87a49 100644
--- a/sys/geom/stripe/g_stripe.c
+++ b/sys/geom/stripe/g_stripe.c
@@ -874,27 +874,37 @@ g_stripe_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
struct g_stripe_softc *sc;
sc = gp->softc;
- if (sc == NULL)
+ if (sc == NULL || pp == NULL)
return;
- if (gp != NULL) {
- sbuf_printf(sb, "%s<id>%u</id>\n", indent, (u_int)sc->sc_id);
- sbuf_printf(sb, "%s<stripesize>%u</stripesize>\n", indent,
- (u_int)sc->sc_stripesize);
- switch (sc->sc_type) {
- case G_STRIPE_TYPE_AUTOMATIC:
- sbuf_printf(sb, "%s<type>%s</type>\n", indent,
- "automatic");
- break;
- case G_STRIPE_TYPE_MANUAL:
- sbuf_printf(sb, "%s<type>%s</type>\n", indent,
- "manual");
- break;
- default:
- sbuf_printf(sb, "%s<type>%s</type>\n", indent,
- "unknown");
- break;
- }
+ sbuf_printf(sb, "%s<id>%u</id>\n", indent, (u_int)sc->sc_id);
+ sbuf_printf(sb, "%s<stripesize>%u</stripesize>\n", indent,
+ (u_int)sc->sc_stripesize);
+ switch (sc->sc_type) {
+ case G_STRIPE_TYPE_AUTOMATIC:
+ sbuf_printf(sb, "%s<type>%s</type>\n", indent, "automatic");
+ break;
+ case G_STRIPE_TYPE_MANUAL:
+ sbuf_printf(sb, "%s<type>%s</type>\n", indent, "manual");
+ break;
+ default:
+ sbuf_printf(sb, "%s<type>%s</type>\n", indent, "unknown");
+ break;
}
+ sbuf_printf(sb, "%s<providers>", indent);
+ LIST_FOREACH(cp, &gp->consumer, consumer) {
+ if (cp->provider == NULL)
+ continue;
+ sbuf_printf(sb, "%s", cp->provider->name);
+ if (LIST_NEXT(cp, consumer) != NULL)
+ sbuf_printf(sb, " ");
+ }
+ sbuf_printf(sb, "</providers>\n");
+ sbuf_printf(sb, "%s<status>total=%u, online=%u</status>\n", indent,
+ sc->sc_ndisks, g_stripe_nvalid(sc));
+ if (pp->error == 0)
+ sbuf_printf(sb, "%s<state>UP</state>\n", indent);
+ else
+ sbuf_printf(sb, "%s<state>DOWN</state>\n", indent);
}
DECLARE_GEOM_CLASS(g_stripe_class, g_stripe);
OpenPOWER on IntegriCloud