summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorgrog <grog@FreeBSD.org>1999-03-24 00:45:47 +0000
committergrog <grog@FreeBSD.org>1999-03-24 00:45:47 +0000
commit37a06217a969b66e8fd8d79bf8ca158ed70d2c4d (patch)
tree22005da89793e10f998e778d0e7e8acf2b8253f2 /sbin
parent52877fac885a5e64170922cd472dfc9630a8b5a0 (diff)
downloadFreeBSD-src-37a06217a969b66e8fd8d79bf8ca158ed70d2c4d.zip
FreeBSD-src-37a06217a969b66e8fd8d79bf8ca158ed70d2c4d.tar.gz
'start' command: check that the objects in question aren't already up,
and produce an intelligble message if they are.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/vinum/commands.c66
1 files changed, 49 insertions, 17 deletions
diff --git a/sbin/vinum/commands.c b/sbin/vinum/commands.c
index f380473..192f3ac 100644
--- a/sbin/vinum/commands.c
+++ b/sbin/vinum/commands.c
@@ -36,7 +36,7 @@
*
*/
-/* $Id: commands.c,v 1.10 1999/03/23 04:54:59 grog Exp $ */
+/* $Id: commands.c,v 1.6 1999/03/23 03:40:07 grog Exp grog $ */
#include <ctype.h>
#include <errno.h>
@@ -488,24 +488,56 @@ vinum_start(int argc, char *argv[], char *arg0[])
if (type == invalid_object)
fprintf(stderr, "Can't find object: %s\n", argv[index]);
else {
- message->index = object; /* pass object number */
- message->type = type; /* and type of object */
- message->state = object_up;
- message->force = 0; /* don't force it, use a larger hammer */
- ioctl(superdev, VINUM_SETSTATE, message);
- if (reply.error != 0) {
- if ((reply.error == EAGAIN) /* we're reviving */
- &&(type == sd_object))
- continue_revive(object);
+ int doit = 0; /* set to 1 if we pass our tests */
+ switch (type) {
+ case drive_object:
+ fprintf(stderr, "Can't start a drive: %s\n", argv[index]);
+ break;
+
+ case sd_object:
+ if (sd.state == sd_up) /* already up */
+ fprintf(stderr, "%s is already up\n", sd.name);
+ else
+ doit = 1;
+ break;
+
+ case plex_object:
+ if (plex.state == plex_up) /* already up */
+ fprintf(stderr, "%s is already up\n", plex.name);
+ else
+ doit = 1;
+ break;
+
+ case volume_object:
+ if (vol.state == volume_up) /* already up */
+ fprintf(stderr, "%s is already up\n", vol.name);
else
- fprintf(stderr,
- "Can't start %s: %s (%d)\n",
- argv[index],
- reply.msg[0] ? reply.msg : strerror(reply.error),
- reply.error);
+ doit = 1;
+ break;
+
+ default:
+ }
+
+ if (doit) {
+ message->index = object; /* pass object number */
+ message->type = type; /* and type of object */
+ message->state = object_up;
+ message->force = 0; /* don't force it, use a larger hammer */
+ ioctl(superdev, VINUM_SETSTATE, message);
+ if (reply.error != 0) {
+ if ((reply.error == EAGAIN) /* we're reviving */
+ &&(type == sd_object))
+ continue_revive(object);
+ else
+ fprintf(stderr,
+ "Can't start %s: %s (%d)\n",
+ argv[index],
+ reply.msg[0] ? reply.msg : strerror(reply.error),
+ reply.error);
+ }
+ if (Verbose)
+ vinum_li(object, type);
}
- if (Verbose)
- vinum_li(object, type);
}
}
}
OpenPOWER on IntegriCloud