meta_metad.c revision da83352438a4a62b87fcb6fd1583e3a70aa31bb8
/*
* 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"
/*
* Just in case we're not in a build environment, make sure that
* TEXT_DOMAIN gets set to something.
*/
#if !defined(TEXT_DOMAIN)
#define TEXT_DOMAIN "SYS_TEST"
#endif
#include <meta.h>
#include <metad.h>
#include <devid.h>
#define CL_DEF_TMO 30L
/*
* Convert an old style mddrivename_t into a new style
* mddrivename_t. Meant to be used *ONLY* by rpc.metad
*/
void
)
{
int sliceno;
/* fields that haven't changed */
/* geometry information */
/* controller information */
/* vtoc information */
}
/* The new style vtoc has 17 partitions */
/* partition information */
/*
* We speculate that if cname for a particular
* partition does not exist, the other fields
* don't exist either. In such a case, we don't
* need to do anything for that partition.
*/
}
}
/* We don't care about the rest of the fields */
}
/*
* Convert a new style mddrivename_t into an old style
* mddrivename_t. Meant to be used *ONLY* by rpc.metad
*/
void
)
{
int sliceno;
/* fields that haven't changed */
/* geometry information */
/* controller information */
/* vtoc information */
}
/* partition information */
/*
* We speculate that if cname for a particular
* partition does not exist then the rest of
* the fields a partition don't exist either.
* In such a case, we don't need to do anything
* for that partition.
*/
}
}
/* We don't care about the rest of the fields */
}
/*
* Convert an old style md_drive_desc_t into a new style
* md_drive_desc_t. Meant to be used *ONLY* by rpc.metad
*/
void
)
{
}
}
/*
* Convert an new style md_drive_desc_t into a old style
* md_drive_desc_t. Meant to be used *ONLY* by rpc.metad
*/
void
)
{
}
}
/*
* Allocate memory for v1 drive descriptor
* depending upon the number of drives in the
* v2 drive descriptor
*/
void
)
{
}
}
/*
* Allocate memory for v2 drive descriptor
* depending upon the number of drives in the
* v1 drive descriptor
*/
void
)
{
}
}
void
)
{
}
}
void
)
{
}
}
/*
* Return the device id for a given device
*/
char *
char *rname
)
{
int fd;
return (NULL);
return (NULL);
}
}
return (dup_enc_devid);
}
/*
* Add side names for the diskset drive records
* NOTE: these go into the local set's namespace.
*/
int
char *hostname,
char *this_host,
int node_c,
char **node_v,
)
{
int rval;
int version;
int i, j;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
/*
* If the server is local, we call the v2 procedure
*/
} else {
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
/* build args */
/* set descriptor */
for (i = 0; i < MD_MAXSIDES; i++) {
for (j = 0; j < MD_MAX_NODENAME_PLUS_1; j ++)
}
if (rval != RPC_SUCCESS)
"metad add drive sidenames"));
else
} else { /* version 2 */
if (rval != RPC_SUCCESS)
"metad add drive sidenames"));
else
}
}
return (-1);
return (0);
}
/*
* Adding drives via metaimport to disksets. Some of the drives may
* not be available so we need more information than the basic clnt_adddrvs
* offers us.
*/
int
char *hostname,
)
{
int rval;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
/*
* If the server is local, we call the v1 procedure
*/
} else {
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
/*
* If the client is version 1, return error
* otherwise, make the remote procedure call.
*/
return (-1);
} else {
if (rval != RPC_SUCCESS)
"metad imp add drives"));
else
}
}
return (-1);
return (0);
}
/*
* Add drives to disksets.
*/
int
char *hostname,
)
{
int rval;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
/*
* If the server is local, we call the v2 procedure
*/
} else {
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
/* build args */
if (rval != RPC_SUCCESS)
else
} else { /* version 2 */
if (rval != RPC_SUCCESS)
else
}
}
return (-1);
return (0);
}
/*
* Add hosts to disksets.
*/
int
char *hostname,
int node_c,
char **node_v,
)
{
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
/*
* Check the client handle for the version and invoke
* the appropriate version of the remote procedure
*/
else
} else {
else
}
}
return (-1);
return (0);
}
/*
* Create disksets.
*/
int
char *hostname,
)
{
int i;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
for (i = 0; i < MD_MAXSIDES; i++)
/* do it */
int bool;
} else {
return (-1);
/*
* Check the client handle for the version and invoke
* the appropriate version of the remote procedure
*/
else
} else {
else
}
}
return (-1);
return (0);
}
/*
* Create MN disksets.
*/
int
char *hostname,
int master_nodeid,
)
{
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
/*
* Check the client handle for the version
*/
/*
* If the client is version 1, return error
* otherwise, make the remote procedure call.
*/
return (-1);
} else {
!= RPC_SUCCESS)
else
}
}
return (-1);
return (0);
}
/*
* Join MN set
*/
int
char *hostname,
int flags,
)
{
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
/*
* Check the client handle for the version
*/
/*
* If the client is version 1, return error
* otherwise, make the remote procedure call.
*/
return (-1);
} else {
!= RPC_SUCCESS)
else
}
}
return (-1);
return (0);
}
/*
* Withdraw from MN set
*/
int
char *hostname,
)
{
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
/*
* Check the client handle for the version
*/
/*
* If the client is version 1, return error
* otherwise, make the remote procedure call.
*/
return (-1);
} else {
!= RPC_SUCCESS)
"metad withdraw set"));
else
}
}
return (-1);
return (0);
}
/*
* Delete side names for the diskset drive records
* NOTE: these are removed from the local set's namespace.
*/
int
char *hostname,
)
{
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
return (-1);
mdclrerror(ep);
}
/*
* Check the client handle for the version and invoke
* the appropriate version of the remote procedure
*/
"metad delete drive sidenames"));
else
} else {
"metad delete drive sidenames"));
else
}
}
return (-1);
return (0);
}
/*
* delete drives from the set
*/
int
char *hostname,
)
{
int rval;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
/*
* If the server is local, we call the v2 procedure
*/
} else {
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
/* build args */
if (rval != RPC_SUCCESS)
"metad delete drives"));
else
} else { /* version 2 */
if (rval != RPC_SUCCESS)
"metad delete drives"));
else
}
}
return (-1);
return (0);
}
/*
* delete host(s) from a set.
*/
int
char *hostname,
int node_c,
char **node_v,
)
{
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
else
} else {
else
}
}
return (-1);
return (0);
}
/*
* Delete diskset.
*/
int
char *hostname,
)
{
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
else
} else {
else
}
}
return (-1);
return (0);
}
/*
* return remote device info
*/
int
char *hostname,
)
{
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
/*
* If the server is local, we call the v2 procedure.
*/
} else {
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of
* the remote procedure.
*/
Zalloc(sizeof (o_mddrivename_t));
Zalloc((sizeof (o_mdname_t)) *
/* build args */
/*
* Convert v2 arguments to v1 arguments
* before sending over the wire.
*/
if (rval != RPC_SUCCESS)
else
} else { /* version 2 */
if (rval != RPC_SUCCESS)
else
}
}
/* do something with the results */
rval = 0;
if (version == METAD_VERSION)
else
}
if (ret_timestamp != NULL) {
if (version == METAD_VERSION)
else
}
}
if (version == METAD_VERSION)
else
return (rval);
}
/*
* return remote device info
*/
int
char *hostname,
char **ret_encdevid,
)
{
int rval;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
/*
* If the server is local, we call the v2 procedure.
*/
} else {
return (-1);
/*
* Check the client handle for the version
*/
/*
* If the client is version 1, return error
* otherwise, make the remote procedure call.
*/
} else { /* version 2 */
if (rval != RPC_SUCCESS)
else
}
}
/* do something with the results */
rval = 0;
if (ret_encdevid != NULL)
}
return (rval);
}
/*
* Get the device information of a disk on a remote host. The information
* retrieved is the device's name, the associated driver and the dev_t.
* The lookup is performed by using the devid of the disk as this is
* unique to the disk. The device name on the originating node is passed
* in. If that devname is found when doing the devid to namelist translation
* then that value is used to make the device names as consistent as possible
* across the nodes.
*
* An attempt is made to retrieve this information by calling
* mdrpc_devinfo_by_devid_name_2_svc. Locally this call should always
* succeed. In the case where a call is made through a CLIENT handle,
* it is possible that the function hasn't been implemented on the called
* node. If this is the case fall back to mdrpc_devinfo_by_devidstr_2_svc.
*
* Returns:
* -1 Error
* ENOTSUP Operation not supported i.e. procedure not supported on
* the remote node
* 0 Success
*/
int
char *hostname,
char *devidstr,
char *orig_devname,
char **ret_devname,
char **ret_driver,
)
{
int rval;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
int bool;
/*
* We are calling this locally so call the function
* directly.
*/
} else {
/* open connection */
return (-1);
}
return (ENOTSUP);
}
if (rval != RPC_SUCCESS) {
/* try falling back to devidstr_2_svc */
if (rval != RPC_SUCCESS) {
"metad devinfo by devid"));
} else {
}
} else {
}
}
rval = 0;
}
return (-1);
return (0);
}
/*
* return status of whether driver is used, mount
*/
int
char *hostname,
)
{
int rval;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
/*
* If the server is local, we call the v2 procedure
*/
} else {
/* open connection */
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
Zalloc(sizeof (o_mddrivename_t));
Zalloc((sizeof (o_mdname_t)) *
/* build args */
/* Convert v2 args to v1 args */
if (rval != RPC_SUCCESS)
else
} else { /* version 2 */
if (rval != RPC_SUCCESS)
else
}
}
return (-1);
return (0);
}
void
{
if (md_in_daemon)
return;
/*
* dummy up a result struct, to do a deep free of the (mn)sr.
* (A deep free means that the xdr_free code will free the
* linked list of drive records for the sr and will also free
* the linked list of node records for the mnsr.)
*/
if (MD_MNSET_REC(sr)) {
} else {
}
}
void
)
{
else
}
void
)
{
else
if (MD_MNSET_REC(sr)) {
} else {
}
}
static int
{
return (metad_isautotakebyname(setname));
else
return (metad_isautotakebynum(setno));
}
/*
* return the diskset record, and drive records.
* If record is a MNdiskset record, then only the first md_set_record
* bytes were copied from the daemon.
*/
int
char *hostname,
char *setname,
)
{
int rval = -1;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
} else {
/*
* This has to work during the boot up before the rpc.metad can
* run. Check to see if we can handle this as a strictly local
* diskset.
*/
mdclrerror(ep);
} else {
return (-1);
}
} else {
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
else
} else {
else
}
}
}
rval = 0;
else
if (! md_in_daemon)
}
return (rval);
}
/*
* return the multi-node diskset record, drive records and node records.
*/
int
char *hostname,
char *setname,
)
{
int rval = -1;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
} else {
return (-1);
/*
* Check the client handle for the version
*/
/*
* If the client is version 1, return error
* otherwise, make the remote procedure call.
*/
return (-1);
} else {
!= RPC_SUCCESS)
else
}
}
/* If no ep error and no version mismatch - rpc call worked ok */
rval = 0;
else
if (! md_in_daemon)
}
return (rval);
}
/*
* Set master nodeid and nodename in multi-node set record.
*/
int
char *hostname,
int master_nodeid,
)
{
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
return (-1);
/*
* Check the client handle for the version
*/
/*
* If the client is version 1, return error
* otherwise, make the remote procedure call.
*/
return (-1);
} else {
else
}
return (-1);
return (0);
}
/*
* Get the MH timeout values.
*/
int
char *hostname,
)
{
int rval = -1;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
else
} else {
else
}
}
/* do something with the results */
rval = 0;
/* copy md_mhiargs_t */
if (ret_mhiargs != NULL)
}
return (rval);
}
/*
* get real hostname from remote host
*/
int
char *hostname,
char **ret_hostname,
)
{
int rval = -1;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
else
}
/* do something with the results */
rval = 0;
if (ret_hostname != NULL)
}
return (rval);
}
/*
* NULLPROC - just returns a response
*/
int
char *hostname,
)
{
/* initialize */
mdclrerror(ep);
/* do it */
int bool;
} else {
return (-1);
}
return (-1);
return (0);
}
/*
* does host own the set?
*/
int
char *hostname,
int *ret_bool,
)
{
int rval = -1;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
/*
* This has to work in the code path from libpreen which is
* running within fsck before the rpc.metad can run. Check
* to see if we should handle this as an auto-take diskset.
*/
/* Can't call mdrpc_ownset_2_svc since not in daemon */
mdclrerror(ep);
else
} else {
return (-1);
}
} else {
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
else
} else {
else
}
}
}
/* do something with the results */
rval = 0;
}
return (rval);
}
/*
* Valid set name.
*/
int
char *hostname,
int *ret_bool,
)
{
int rval = -1;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
else
} else {
else
}
}
/* do something with the results */
rval = 0;
}
return (rval);
}
/*
* Is set number in-use?
*/
int
char *hostname,
int *ret_bool,
)
{
int rval = -1;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
else
} else {
else
}
}
/* do something with the results */
rval = 0;
}
return (rval);
}
/*
* Set the timeout values used into the drive records.
*/
int
char *hostname,
)
{
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
else
} else {
else
}
}
return (-1);
return (0);
}
/*
* update drive records
*/
int
char *hostname,
)
{
int rval;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
/*
* If the server is local, we call the v2 procedure
*/
} else {
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
/* build args */
if (rval != RPC_SUCCESS)
"metad update drive dbinfo"));
else
} else { /* version 2 */
if (rval != RPC_SUCCESS)
"metad update drive dbinfo"));
else
}
}
return (-1);
return (0);
}
/*
* update dr_flags field of drive record.
*/
int
char *hostname,
)
{
int rval;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
/*
* If the server is local, we call the v2 procedure
*/
} else {
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
/* build args */
if (rval != RPC_SUCCESS)
"metad update drive flags"));
else
} else { /* version 2 */
if (rval != RPC_SUCCESS)
"metad update drive flags"));
else
}
}
if (! mdanyrpcerror(ep))
return (-1);
return (-1);
mdclrerror(ep);
}
return (0);
}
/*
* update set record flags
* This replaces all of the sr_flags with the new_flags. It relies on the
* caller to "do the right thing" to preserve the existing flags that should
* not be reset.
*/
static int
char *hostname,
)
{
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
else
} else {
else
}
}
if (! mdanyrpcerror(ep))
return (-1);
return (-1);
mdclrerror(ep);
}
return (0);
}
/*
* Enable bits in the set record flags field. This just turns on the specified
* bits and leaves the other bits alone.
*/
int
char *hostname,
)
{
mdclrerror(ep);
/* Get the flags from the current set */
return (-1);
/* Turn on the specified bits */
/* do it */
}
/*
* Disable bits in the set record flags field. This just turns off the
* specified bits and leaves the other bits alone.
*/
int
char *hostname,
)
{
mdclrerror(ep);
/* Get the flags from the current set */
return (-1);
/* Turn off the specified bits */
/* do it */
}
/*
* Assign the flags as the new value(s) for the MD_SR_STATE_FLAGS within the
* set record flags field. This actually can set any bits but only clears
* the bits within the MD_SR_STATE_FLAGS subfield and leaves any other
* bits turned on. It can be used to clear (state) and set bits all in one
* rpc call.
*/
int
char *hostname,
)
{
mdclrerror(ep);
/* Get the flags from the current set */
return (-1);
/* clear the existing state flags */
/* Or in the new value */
/* do it */
}
{
} else {
}
return (my_cl_sk);
}
void
{
return;
}
}
/* get here, if set called before get */
}
}
/*
* Unlock the set after operation is complete.
*/
int
char *hostname,
)
{
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
else
}
if (! mdanyrpcerror(ep))
return (-1);
return (-1);
mdclrerror(ep);
}
return (0);
}
/*
* Lock set so that only operators with valid keys are allowed in the daemon.
*/
int
char *hostname,
)
{
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
else
}
if (! mdanyrpcerror(ep))
return (-1);
return (-1);
mdclrerror(ep);
}
return (0);
}
/*
* Add mediator hosts to disksets.
*/
int
char *hostname,
)
{
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
else
} else {
else
}
}
return (-1);
return (0);
}
/*
* update nr_flags field of node records based
* on given action.
*/
int
char *hostname,
)
{
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
/*
* Check the client handle for the version
*/
/*
* If the client is version 1, return error
* otherwise, make the remote procedure call.
*/
return (-1);
} else {
!= RPC_SUCCESS)
"metad set node flags"));
else
}
}
if (! mdanyrpcerror(ep))
return (-1);
return (-1);
mdclrerror(ep);
}
return (0);
}
/*
* Clear set locks for all MN disksets.
* Used during reconfig cycle to recover from failed nodes.
*/
int
char *hostname,
)
{
int version;
/* initialize */
mdclrerror(ep);
/* do it */
return (-1);
/*
* Check the client handle for the version
*/
/*
* If the client is version 1, return error
* otherwise, make the remote procedure call.
*/
return (-1);
} else {
else
}
return (-1);
return (0);
}
/*
* Calls to suspend, resume or reinit the rpc.mdcommd daemon.
* This allows a node to remotely suspend, reinit and resume the
* rpc.mdcommd daemon on the given hostname node. Used by libmeta
* to lock out class 1 messages (metainit, etc) on all nodes when running
* metaset and metadb commands on this node.
*
* When suspending the commd, the suspend request will fail until all
* messages have been drained from the rpc.mdcommd. This routine will
* spin sending the suspend request until the rpc.mdcommd is drained
* or until rpc.mdcommd returns a failure other than MDMNE_SET_NOT_DRAINED.
*
* Also used to send the rpc.mdcommd daemon a new nodelist by draining all
* messages from the mdcommd and sending a reinit command to have mdcommd
* get the new nodelist from rpc.metad. Used when nodelist is changed
* during:
* - addition or deletion of host from diskset
* - join or withdrawal of host from diskset
* - addition of first disk to diskset (joins all nodes)
* - removal of last disk from diskset (withdraws all nodes)
*/
int
char *hostname,
int flag_action,
)
{
int version;
int suspend_spin = 0;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
/*
* Call v2 procedure directly if rpc.metad on this node is
* sending message to itself.
*/
if (flag_action == COMMDCTL_SUSPEND) {
suspend_spin = 1;
while (suspend_spin) {
suspend_spin = 0;
NULL);
/*
* If set not yet drained, wait a second
* and try again.
*/
/* Wait a second and try again */
(void) sleep(1);
suspend_spin = 1;
}
}
} else {
}
} else {
return (-1);
/*
* Check the client handle for the version
*/
/*
* If the client is version 1, return error
* otherwise, make the remote procedure call.
*/
return (-1);
}
if (flag_action == COMMDCTL_SUSPEND) {
suspend_spin = 1;
while (suspend_spin) {
suspend_spin = 0;
clntp) != RPC_SUCCESS) {
"metad commd control"));
} else {
/*
* If set not yet drained,
* wait a second and
* and try again.
*/
(void) sleep(1);
suspend_spin = 1;
} else {
(void) mdstealerror(ep,
}
}
}
} else {
!= RPC_SUCCESS)
"metad commd control"));
else
}
}
if (! mdanyrpcerror(ep))
return (-1);
return (-1);
mdclrerror(ep);
}
return (0);
}
/*
* Is owner node stale?
*/
int
char *hostname,
int *ret_bool,
)
{
int rval = -1;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
/*
* Call v2 procedure directly if rpc.metad on this node is
* sending message to itself.
*/
} else {
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
/*
* If the client is version 1, return error
* otherwise, make the remote procedure call.
*/
return (-1);
} else {
else
}
}
/* do something with the results */
rval = 0;
}
return (rval);
}
/*
* Free md_drive_desc linked list of drive descriptors that was alloc'd
* from a call to the RPC routine clnt_getdrivedesc. Drive descriptors
* are from another node.
*/
void
{
/*
* dummy up a result struct, to do a deep free of the dd.
* (A deep free means that the xdr_free code will free the
* linked list of drive descs.)
*/
}
/*
* Get a partially filled in drive desc from remote node. Used in MN
* disksets during the reconfig cycle to get the diskset drive
* information from another host in order to sync up all nodes.
* Used when the drive record information isn't good enough
* since the drive record doesn't give the name of
* the drive, but just a key into that other node's nodespace.
* Returned drive desc has the drive name filled in but no other strings
* in the drivename structure.
*
* Returns a 0 if RPC was successful, 1 otherwise.
*/
int
char *hostname,
)
{
int version;
int rval = -1;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
/*
* Check the client handle for the version
*/
/*
* If the client is version 1, return error
* otherwise, make the remote procedure call.
*/
return (-1);
} else {
!= RPC_SUCCESS)
"metad get drive desc set"));
else
}
}
/* If no ep error and no version mismatch - rpc call worked ok */
rval = 0;
else
}
return (rval);
}
/*
* update dr_flags field of drive record.
* Also sync up genid of drive descriptors and make set
* record and node records match the genid.
*
* Returns a 0 if RPC was successful, 1 otherwise.
*/
int
char *hostname,
)
{
int rval;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
/*
* If the server is local, we call the v2 procedure
*/
} else {
return (-1);
/*
* Check the client handle for the version
*/
/*
* If the client is version 1, return error
* otherwise, make the remote procedure call.
*/
return (-1);
} else {
if (rval != RPC_SUCCESS)
"metad update drive reconfig"));
else
}
}
if (! mdanyrpcerror(ep))
return (-1);
return (-1);
mdclrerror(ep);
}
return (0);
}
/*
* Reset mirror owner(s) if mirror owner(s) is in the list of
* node's specified in the array of nodeids.
* This is called when a node has been deleted or withdrawn
* from the diskset.
*/
int
char *hostname,
int node_c,
int node_id[],
)
{
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
} else {
return (-1);
/*
* Check the client handle for the version
* and invoke the appropriate version of the
* remote procedure
*/
/*
* If the client is version 1, return error
* otherwise, make the remote procedure call.
*/
return (-1);
} else {
!= RPC_SUCCESS)
"metad reset mirror owner"));
else
}
}
return (-1);
return (0);
}
/*
* Call to suspend and resume I/O for given diskset(s).
* This allows a node to remotely suspend and resume I/O on
* a MN diskset. A diskset number of 0 represents all MN disksets.
*/
int
char *hostname,
int cmd,
)
{
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
/*
* Call v2 procedure directly if rpc.metad on this node is
* sending message to itself.
*/
} else {
return (-1);
/*
* Check the client handle for the version
*/
/*
* If the client is version 1, return error
* otherwise, make the remote procedure call.
*/
return (-1);
} else {
!= RPC_SUCCESS)
"metad mn_susp_res_io control"));
else
}
}
if (! mdanyrpcerror(ep))
return (-1);
return (-1);
mdclrerror(ep);
}
return (0);
}
/*
* Resnarf the set after the set has been imported
*
* We should never be making this procedure call
* over the wire, it's sole purpose is to snarf
* the imported set on the localhost.
*/
int
char *hostname,
)
{
int rval = -1;
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
return (-1);
/* Check the client handle for the version */
/* If the client is version 1, return error */
} else {
if (rval != RPC_SUCCESS)
else
}
} else {
}
rval = 0;
return (rval);
}
/*
* Call to start a resync for a given diskset.
* Used when a node has been added to a diskset.
* Should be called after rpc.mdcommd is resumed.
*/
int
char *hostname,
)
{
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/* do it */
int bool;
/*
* Call v2 procedure directly if rpc.metad on this node is
* sending message to itself.
*/
} else {
return (-1);
/*
* Check the client handle for the version
*/
/*
* If the client is version 1, return error
* otherwise, make the remote procedure call.
*/
return (-1);
} else {
!= RPC_SUCCESS)
"metad mn_mirror_resync_all"));
else
}
}
if (! mdanyrpcerror(ep))
return (-1);
return (-1);
mdclrerror(ep);
}
return (0);
}
/*
* Call to update the ABR state for all soft partitions.
* Used when a node has been added to a diskset.
* Should be called after rpc.mdcommd is resumed.
*/
int
char *hostname,
)
{
int version;
/* initialize */
mdclrerror(ep);
/* build args */
/*
* No need to call function if adding local node as ABR cannot
* be set.
*/
return (-1);
/*
* Check the client handle for the version
*/
/*
* If the client is version 1, return error
* otherwise, make the remote procedure call.
*/
return (-1);
} else {
!= RPC_SUCCESS)
"metad mn_sp_update_abr"));
else
}
}
if (! mdanyrpcerror(ep))
return (-1);
mdclrerror(ep);
}
return (0);
}