From c248e6209bfbc109fbf47fd9325b27bd2b53d235 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 24 Jun 2013 21:51:22 +0000 Subject: [PATCH] mogadm: do not warn about drain unless drain is specified Unnecessarily displaying the warning about "drain" is potentially confusing and scary to new users, especially if they've never used MogileFS before. --- mogadm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mogadm b/mogadm index 0cf47f5..8e24840 100755 --- a/mogadm +++ b/mogadm @@ -769,10 +769,17 @@ sub cmd_device_add { ok('Device added.'); } +sub warn_on_drain { + my $args = shift; + if ($args->{status} && $args->{status} eq 'drain') { + print "***NOTE***: As of server version 2.40 'drain' has changed. See docs/wiki\n"; + } +} + sub cmd_device_mark { my $args = shift; - print "***NOTE***: As of server version 2.40 'drain' has changed. See docs/wiki\n"; + warn_on_drain($args); my $mogadm = mogadm(); $mogadm->change_device_state($args->{hostname}, $args->{devid}, @@ -789,7 +796,7 @@ sub cmd_device_modify { my $hostname = delete $args->{hostname}; my $devid = delete $args->{devid}; - print "***NOTE***: As of server version 2.40 'drain' has changed. See docs/wiki\n"; + warn_on_drain($args); my $mogadm = mogadm(); $mogadm->update_device($hostname, $devid, $args);