summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2011-04-29 14:06:37 +0000
committerjhb <jhb@FreeBSD.org>2011-04-29 14:06:37 +0000
commitbcef521d66b1338ea7358d1a0093997a550257dd (patch)
treea9c3ccee3c4d5240acc5130bc626757215c7bda3 /usr.sbin
parent6a4b2fc4dce273251ad9b2b2297a0a53057f6ba2 (diff)
downloadFreeBSD-src-bcef521d66b1338ea7358d1a0093997a550257dd.zip
FreeBSD-src-bcef521d66b1338ea7358d1a0093997a550257dd.tar.gz
Add a 'show progress' command that shows a summary of all in-progress
commands for a given adapter. Specifically, it shows the status of any drive or volume activities currently in progress similar to the 'drive process' and 'volume progress' commands. Reviewed by: emaste MFC after: 1 week
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/mfiutil/mfi_show.c111
-rw-r--r--usr.sbin/mfiutil/mfiutil.88
-rw-r--r--usr.sbin/mfiutil/mfiutil.c1
3 files changed, 118 insertions, 2 deletions
diff --git a/usr.sbin/mfiutil/mfi_show.c b/usr.sbin/mfiutil/mfi_show.c
index b09bed7..22a735d 100644
--- a/usr.sbin/mfiutil/mfi_show.c
+++ b/usr.sbin/mfiutil/mfi_show.c
@@ -572,7 +572,7 @@ show_firmware(int ac, char **av)
u_int i;
if (ac != 1) {
- warnx("show drives: extra arguments");
+ warnx("show firmware: extra arguments");
return (EINVAL);
}
@@ -617,3 +617,112 @@ show_firmware(int ac, char **av)
return (0);
}
MFI_COMMAND(show, firmware, show_firmware);
+
+static int
+show_progress(int ac, char **av)
+{
+ struct mfi_ld_list llist;
+ struct mfi_pd_list *plist;
+ struct mfi_ld_info linfo;
+ struct mfi_pd_info pinfo;
+ int busy, error, fd;
+ u_int i;
+
+ uint16_t device_id;
+ uint8_t target_id;
+
+ if (ac != 1) {
+ warnx("show progress: extra arguments");
+ return (EINVAL);
+ }
+
+ fd = mfi_open(mfi_unit);
+ if (fd < 0) {
+ error = errno;
+ warn("mfi_open");
+ return (error);
+ }
+ busy = 0;
+
+ if (mfi_ld_get_list(fd, &llist, NULL) < 0) {
+ error = errno;
+ warn("Failed to get volume list");
+ return (error);
+ }
+ if (mfi_pd_get_list(fd, &plist, NULL) < 0) {
+ error = errno;
+ warn("Failed to get drive list");
+ return (error);
+ }
+
+ for (i = 0; i < llist.ld_count; i++) {
+ target_id = llist.ld_list[i].ld.v.target_id;
+ if (mfi_ld_get_info(fd, target_id, &linfo, NULL) < 0) {
+ error = errno;
+ warn("Failed to get info for volume %s",
+ mfi_volume_name(fd, target_id));
+ return (error);
+ }
+ if (linfo.progress.active & MFI_LD_PROGRESS_CC) {
+ printf("volume %s ", mfi_volume_name(fd, target_id));
+ mfi_display_progress("Consistency Check",
+ &linfo.progress.cc);
+ busy = 1;
+ }
+ if (linfo.progress.active & MFI_LD_PROGRESS_BGI) {
+ printf("volume %s ", mfi_volume_name(fd, target_id));
+ mfi_display_progress("Background Init",
+ &linfo.progress.bgi);
+ busy = 1;
+ }
+ if (linfo.progress.active & MFI_LD_PROGRESS_FGI) {
+ printf("volume %s ", mfi_volume_name(fd, target_id));
+ mfi_display_progress("Foreground Init",
+ &linfo.progress.fgi);
+ busy = 1;
+ }
+ if (linfo.progress.active & MFI_LD_PROGRESS_RECON) {
+ printf("volume %s ", mfi_volume_name(fd, target_id));
+ mfi_display_progress("Reconstruction",
+ &linfo.progress.recon);
+ busy = 1;
+ }
+ }
+
+ for (i = 0; i < plist->count; i++) {
+ if (plist->addr[i].scsi_dev_type != 0)
+ continue;
+
+ device_id = plist->addr[i].device_id;
+ if (mfi_pd_get_info(fd, device_id, &pinfo, NULL) < 0) {
+ error = errno;
+ warn("Failed to fetch info for drive %u", device_id);
+ return (error);
+ }
+
+ if (pinfo.prog_info.active & MFI_PD_PROGRESS_REBUILD) {
+ printf("drive %u ", device_id);
+ mfi_display_progress("Rebuild", &pinfo.prog_info.rbld);
+ busy = 1;
+ }
+ if (pinfo.prog_info.active & MFI_PD_PROGRESS_PATROL) {
+ printf("drive %u ", device_id);
+ mfi_display_progress("Patrol Read",
+ &pinfo.prog_info.patrol);
+ busy = 1;
+ }
+ if (pinfo.prog_info.active & MFI_PD_PROGRESS_CLEAR) {
+ printf("drive %u ", device_id);
+ mfi_display_progress("Clear", &pinfo.prog_info.clear);
+ busy = 1;
+ }
+ }
+
+ close(fd);
+
+ if (!busy)
+ printf("No activity in progress for adapter mfi%d\n", mfi_unit);
+
+ return (0);
+}
+MFI_COMMAND(show, progress, show_progress);
diff --git a/usr.sbin/mfiutil/mfiutil.8 b/usr.sbin/mfiutil/mfiutil.8
index abb3c65..d5178a0 100644
--- a/usr.sbin/mfiutil/mfiutil.8
+++ b/usr.sbin/mfiutil/mfiutil.8
@@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 5, 2011
+.Dd April 29, 2011
.Dt MFIUTIL 8
.Os
.Sh NAME
@@ -67,6 +67,9 @@
.Cm show patrol
.Nm
.Op Fl u Ar unit
+.Cm show progress
+.Nm
+.Op Fl u Ar unit
.Cm show volumes
.Nm
.Op Fl u Ar unit
@@ -296,6 +299,9 @@ Lists all of the firmware images present on the controller.
Display the various sequence numbers associated with the event log.
.It Cm show patrol
Display the status of the controller's patrol read operation.
+.It Cm show progress
+Report the current progress and estimated completion time for active
+operations on all volumes and drives.
.It Cm show volumes
Lists all of the logical volumes managed by the controller.
.El
diff --git a/usr.sbin/mfiutil/mfiutil.c b/usr.sbin/mfiutil/mfiutil.c
index 7c0a117..1bce79e 100644
--- a/usr.sbin/mfiutil/mfiutil.c
+++ b/usr.sbin/mfiutil/mfiutil.c
@@ -60,6 +60,7 @@ usage(void)
fprintf(stderr, " show firmware - list firmware images\n");
fprintf(stderr, " show volumes - list logical volumes\n");
fprintf(stderr, " show patrol - display patrol read status\n");
+ fprintf(stderr, " show progress - display status of active operations\n");
fprintf(stderr, " fail <drive> - fail a physical drive\n");
fprintf(stderr, " good <drive> - mark a bad physical drive as good\n");
fprintf(stderr, " rebuild <drive> - mark failed drive ready for rebuild\n");
OpenPOWER on IntegriCloud