/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* replace mirror component
*/
#include <meta.h>
#include <sdssc.h>
/*
* print usage message
*/
static void
int eval
)
{
usage: %s [-s setname] mirror component-old component-new\n\
%s [-s setname] -e mirror component\n\
%s [-s setname] [-f] RAID component-old component-new\n\
%s [-s setname] [-f] -e RAID component\n"),
}
/*
* online replace a physical disk in a metamirror
*/
int
main(
int argc,
char *argv[]
)
{
int eflag = 0;
int c;
int error;
char *cp;
/*
* Get the locale set up before calling any other routines
* with messages to ouput. Just in case we're not in a build
* environment, make sure that TEXT_DOMAIN gets set to
* something.
*/
#if !defined(TEXT_DOMAIN)
#endif
(void) textdomain(TEXT_DOMAIN);
if (sdssc_bind_library() == SDSSC_OKAY)
&error) == SDSSC_PROXY_DONE)
} else {
}
/* initialize */
meta_check_root(ep) != 0) {
}
/* parse arguments */
optind = 1;
opterr = 1;
switch (c) {
case 'h':
break;
case 's':
break;
case 'e':
++eflag;
break;
case 'f':
options |= MDCMD_FORCE;
break;
case 'n':
if (called_thru_rpc == TRUE) {
options &= ~MDCMD_DOIT;
} else {
}
break;
case '?':
if (optopt == '?')
/*FALLTHROUGH*/
default:
break;
}
}
}
}
/* get device */
if (argc < 1)
}
}
if ((called_thru_rpc == FALSE) &&
/*
* If we are dealing with a MN set and we were not
* called thru an rpc call, we are just to send this
* command string to the master of the set and let it
* deal with it.
* Note that if sp is NULL, meta_is_mn_name() derives sp
* from argv[0] which is the metadevice arg
*/
int i;
int newargc;
int result;
char *miscname;
char **newargv;
}
newargv[0] = "metareplace";
newargc = 2;
}
/* If we've found a problem don't do it for real */
if (result != 0) {
}
/*
* Do it for real now. Remove "-n" from the arguments and
* MD_DRYRUN from the flags. If this fails, the master must
* panic as the mddbs may be inconsistent.
*/
/*
* if the metareplace command succeeds for a mirror, send a
* resync starting message for the metadevice
*/
!= 0)
}
}
/* grab set lock */
}
/* check for ownership */
}
if (eflag) { /* enable component */
if (argc != 1)
}
!= 0) {
}
} else { /* replace component */
if (argc != 2)
}
}
}
}
/* update md.cf */
}
/*NOTREACHED*/
return (0);
}