meta_med.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 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
/*
* Mediator functions
*/
#include <meta.h>
#include <metamed.h>
#include <dlfcn.h>
#include <sdssc.h>
/*
* There are too many external factors that affect the timing of the
* operations, so we set the timeout to a very large value, in this
* case 1 day, which should handle HW timeouts, large configurations,
* and other potential delays.
*/
/*
* RPC handle
*/
typedef struct {
char *hostname;
} med_handle_t;
/*
* Data to be sent from med_clnt_create_timed to med_create_helper via
* meta_client_create_retry.
*/
typedef struct {
char *mcd_nettype; /* Type of network to use for RPC */
/*
* Perform the work of actually doing the clnt_create for
* meta_client_create_retry.
*/
static CLIENT *
{
}
static
char *hostname,
char *nettype,
const md_timeval32_t *tp
)
{
}
/*
* Set the timeout value for this client handle.
*/
static int
char *hostname,
long time_out,
)
{
return (0);
}
/*
* close RPC connection
*/
static void
)
{
}
}
}
/*
* open RPC connection to rpc.medd
*/
static med_handle_t *
char *hostname,
long time_out,
)
{
/* default to local host */
/* open RPC connection */
"medd med_clnt_create_timed");
return (NULL);
} else {
}
return (NULL);
/* return connection */
return (hp);
}
/*
* steal and convert med_err_t
*/
int
md_error_t *ep,
)
{
char *p = buf;
char *emsg;
int rval = -1;
/* no error */
/* assert(medep->name == NULL); */
rval = 0;
goto out;
}
/* steal error */
}
}
else
} else {
else
}
/* cleanup, return success */
out:
return (rval);
}
static med_handle_t *
long time_out,
)
{
int i;
char *hnm;
/* Loop through the hosts listed */
for (; i >= 0; i--) {
if (mdanyrpcerror(ep) && i != 0) {
mdclrerror(ep);
continue;
}
}
return (hp);
}
return (NULL);
}
static int
{
int i;
size_t alloc_size = 0;
int err = 0;
goto out;
}
goto out;
goto out;
}
goto out;
}
for (i = 0; i < tp->med_tp_nents; i++) {
md_perror("setup_med_transtab(): stat():");
} else {
}
}
out:
return (err);
}
/*
* Externals
*/
/*
* NULLPROC - just returns a response
*/
int
char *hostname,
)
{
/* initialize */
mdclrerror(ep);
/* do it */
return (-1);
close_medd(hp);
return (-1);
return (0);
}
/*
* Update the mediator information on the mediator.
* *** This is not normally called from user code, the kernel does this! ***
*/
int
)
{
/* initialize */
mdclrerror(ep);
/* build args */
return (-1);
if (MD_MNSET_DESC(sd))
/*
* In the MN diskset, use a generic nodename, multiowner, as
* the node initiating the RPC request. This allows
* any node to access mediator information.
*
* MN diskset reconfig cycle forces consistent
* in the MN diskset. This allows the relaxation of
* node name checking in rpc.metamedd for MN disksets.
*
* In the traditional diskset, only a calling node that is
* in the mediator record's diskset nodelist can access
* mediator data.
*/
else
/* do it */
return (-1);
else
close_medd(hp);
return (-1);
return (0);
}
/*
* Get the mediator data for this client from the mediator
*/
int
)
{
int rval = -1;
/* initialize */
mdclrerror(ep);
/* build args */
return (-1);
if (MD_MNSET_DESC(sd))
/*
* In the MN diskset, use a generic nodename, multiowner, as
* the node initiating the RPC request. This allows
* any node to access mediator information.
*
* MN diskset reconfig cycle forces consistent
* in the MN diskset. This allows the relaxation of
* node name checking in rpc.metamedd for MN disksets.
*
* In the traditional diskset, only a calling node that is
* in the mediator record's diskset nodelist can access
* mediator data.
*/
else
/* do it */
return (-1);
else
close_medd(hp);
/* do something with the results */
rval = 0;
}
return (rval);
}
/*
* Update the mediator record on the mediator.
*/
int
)
{
/* initialize */
mdclrerror(ep);
/* build args */
return (-1);
if (MD_MNSET_DESC(sd))
/*
* In the MN diskset, use a generic nodename, multiowner, as
* the node initiating the RPC request. This allows
* any node to access mediator information.
*
* MN diskset reconfig cycle forces consistent
* in the MN diskset. This allows the relaxation of
* node name checking in rpc.metamedd for MN disksets.
*
* In the traditional diskset, only a calling node that is
* in the mediator record's diskset nodelist can access
* mediator data.
*/
else
/* do it */
return (-1);
else
close_medd(hp);
return (-1);
return (0);
}
/*
* Get the mediator record for this client from the mediator
*/
int
)
{
int rval = -1;
/* initialize */
mdclrerror(ep);
/* build args */
return (-1);
if (MD_MNSET_DESC(sd))
/*
* In the MN diskset, use a generic nodename, multiowner, as
* the node initiating the RPC request. This allows
* any node to access mediator information.
*
* MN diskset reconfig cycle forces consistent
* in the MN diskset. This allows the relaxation of
* node name checking in rpc.metamedd for MN disksets.
*
* In the traditional diskset, only a calling node that is
* in the mediator record's diskset nodelist can access
* mediator data.
*/
else
/* do it */
return (-1);
else
close_medd(hp);
/* do something with the results */
rval = 0;
}
return (rval);
}
/*
* Get the name of the host from the mediator daemon.
*/
int
char *hostname,
char **ret_hostname,
)
{
int rval = -1;
/* initialize */
mdclrerror(ep);
/* No args */
/* do it */
return (-1);
else
close_medd(hp);
/* do something with the results */
rval = 0;
if (ret_hostname != NULL)
}
return (rval);
}
int
{
int i, j;
int max_meds;
return (-1);
for (i = 0; i < max_meds; i++) {
/* See if this is the local host */
/*
* Cluster nodename support
*
* See if the clustering code can give us an IP addr
* for the stored name. If not, find it the old way
* which will use the public interface.
*/
SDSSC_OKAY) {
hnm));
/* We only do INET addresses */
hnm));
/* We take the first address only */
if (*hp->h_addr_list) {
*hp->h_addr_list,
sizeof (struct in_addr));
} else
hnm));
}
}
}
return (0);
}
int
{
int i, j;
int max_meds;
return (-1);
for (i = 0; i < max_meds; i++) {
continue;
}
return (0);
}
int
{
int i, j;
int max_meds;
return (-1);
for (i = 0; i < max_meds; i++) {
continue;
}
return (0);
}
int
int force,
)
{
int i;
int max_meds;
if (metaislocalset(sp))
return (0);
return (-1);
if (setup_med_transtab(ep))
return (-1);
return (-1);
/* Make sure the ip addresses are current */
return (-1);
if (force)
return (0);
return (-1);
/* Make sure metamedd still running on host - only chk nodename */
for (i = 0; i < max_meds; i++) {
char *hostname;
char *hnm;
continue;
}
return (0);
}