mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
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>
This commit is contained in:
parent
d57916b1c2
commit
3fb17452b0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=129747
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user