mgmt_lib.c revision cee0fb94c0d4227de0a00efc162fb2739844b641
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include "mms_mgmt.h"
#include "mgmt_acsls.h"
#include "mmp_defs.h"
#include "mgmt_library.h"
#include "mgmt_sym.h"
#include "mgmt_util.h"
/*
* Cannot set to online during create
* {O_ONLINE, "LibraryOnline", "true", B_FALSE, val_truefalse},
*/
static mms_mgmt_setopt_t libopts[] = {
};
static mms_mgmt_setopt_t lmopts[] = {
};
/*
* Cannot set to online during create
* {O_ONLINE, "DriveOnline", "true", B_FALSE, val_truefalse},
*/
static mms_mgmt_setopt_t driveopts[] = {
};
/*
* Note that O_DEVCONN (string array) is required for DM. Add a DM
* for each host specified in the array.
*/
static mms_mgmt_setopt_t dmopts[] = {
};
static mms_mgmt_setopt_t drvgrpopts[] = {
};
/*
* Note that O_APPS (string array) is required for DriveGroupApplication.
* Add a DGA for each application specified in the array.
* {O_APPS, "ApplicationName", NULL, B_FALSE, NULL},
*/
static mms_mgmt_setopt_t drvgrpappopts[] = {
};
static int
static int
static int
static int
static int
/*
* mms_mgmt_discover_libraries()
*
* Finds ACSLS libraries, and optionally associated drives.
*/
int
{
int st;
return (MMS_MGMT_NOARG);
}
if (st != 0) {
return (st);
}
if (st == 0) {
(void) mms_goodbye(session, 0);
}
if (st != 0) {
return (st);
}
continue;
}
continue;
}
if (getdrives) {
break;
}
break;
}
mdrv) {
continue;
}
break;
}
}
}
break;
}
}
return (0);
}
/*
* The mms_get_library() function lists all the libraries that are controlled
* by MM. The LM(s) and the drives in each library alongwith the the respective
* DM(s) information for each drive are also obtained.
*
* The session argument should be provided if an existing connection to the
* MM server is to be reused. If this argument is NULL, a new connection to
* MM will be created and destroyed before returning.
*
* PARAM
* session - IN - MM session information
* get_drives - IN - whether the drives should also be returned
* acslib_list - OUT - list of mms_acslib_t
*
* RETURN
* Upon successful completion, a value of 0 is returned. If errors are
* encountered, an appropriate error number is returned
*
*/
int
void *session,
{
void *response;
int st;
char cmd[1024];
char tid[64];
if (st != 0) {
return (st);
}
}
(void) mms_gen_taskid(tid);
/*
* generate command to query the MM for all the libraries and their
* associated LM(s)
*/
"show task['%s'] report[LIBRARY] reportmode[namevalue];", tid);
if (st != 0) {
goto done;
}
/* Get the LMs for each library */
if (st != 0) {
break;
}
/* Get the drives in the each library */
if (get_drives) {
if (st != 0) {
break;
}
}
}
done:
if (sess) {
(void) mms_goodbye(sess, 0);
}
return (st);
}
/*
* The mms_get_lm() function gets information about all the LM(s) for a
* particular library. The LM name and hostname are filled in the structure
* mms_lm_t
*/
int
{
void *response;
int st;
char tid[64];
char cmd[8192];
return (MMS_MGMT_NOARG);
}
(void) mms_gen_taskid(tid);
"show task['%s'] match[ streq(LM.'LibraryName' '%s')]"
if (st == 0) {
}
return (st);
}
/*
* The mms_get_dm() function gets information about all the dms for a
* particular drive. The DM name, drive path, hostname and status are
* filled in the structure mms_dm_t
*
*/
int
{
void *response;
int st;
char tid[64];
char cmd[8192];
return (MMS_MGMT_NOARG);
}
(void) mms_gen_taskid(tid);
/* why not just a standard report? */
"show task['%s'] match[ streq(DM.'DriveName' '%s')] "
"report[DM] reportmode[namevalue];",
if (st == 0) {
}
return (st);
}
/*
* The mms_get_drives_for_lib() function returns information about the
* drives hosted by a particular library (in the MM configuration)
*
* PARAM
* session - IN - connection to MM
* libname - IN - name of library
* drive_list - OUT - A list of drives in the given library
*
* RETURN
* upon successful completion, a value of 0 is returned to indicate success and
* drives is updated with a list of drives
* If the request cannot be completed, an appropriate error number is returned
* to signify the error
*
* MMS_ERR
* MMS Connection errors
*/
int
{
void *response;
int st;
char tid[64];
char cmd[8192];
return (MMS_MGMT_NOARG);
}
(void) mms_gen_taskid(tid);
/* this command is suspect too, if there's a drive but no DM */
"show task['%s'] match[ streq(DRIVE.'LibraryName' '%s')]"
" report[DRIVE DM] reportmode[namevalue];",
cmd);
&response);
if (st == 0) {
}
"mms_get_drives_for_lib() completed, return[%d]", st);
return (st);
}
int
{
void *response;
int st;
char tid[64];
char cmd[8192];
return (MMS_MGMT_NOARG);
}
if (!session) {
if (st != 0) {
return (st);
}
}
(void) mms_gen_taskid(tid);
/* this command is suspect too, if there's a drive but no DM */
"show task['%s'] match[ streq(DRIVE.'DriveName' '%s')]"
" report[DRIVE DM] reportmode[namevalue];",
&response);
if (st == 0) {
}
if (sess) {
(void) mms_goodbye(sess, 0);
}
if (st == 0) {
}
return (st);
}
/*
* The mms_add_library() function is used to add a library to the MM
* configuration. The following steps are taken:
*
* 1. A Library object is created and associated with its network IP (ACSLS)
* 2. the Library object is associated with a Library Manager
* 3. Library is brought online
*
* ARGUMENTS:
* session MM session information. If this argument is
* NULL, a new session is created.
* lib library attributes
*
* RETURN VALUES:
* 0 Success
* >0 Failure
*
* ERRORS
* MMS_MGMT_NOARG One or more required arguments is missing
* ENOENT One or more required options is missing
* ENOMEM Out of memory
* TBD Could not communicate with MM
* TBD Other MMP errors
*
* Notes:
* MMS defines a Library Manager(LM) to manage each Library object.
* While the MMS spec supports a library to be managed by multiple
* LMs (without any upper limit), multiple LMs are only required for
* switchover or failover purposes. As such, for the first release of
* the MMS api, the hostname of the LM is defaulted to the MM host.
*
* If not specified, the library name is derived from library type and
* serial number.
*/
int
{
void *response;
int st;
char tid[64];
char cmd[8192];
char buf[1024];
char libname[1024];
char *val;
char *cmdp;
void *sess;
if (!lib) {
return (MMS_MGMT_NOARG);
}
if (!mgmt_chk_auth("solaris.mms.create")) {
return (EACCES);
}
/* type is required */
if (st != 0) {
return (st);
}
if (st != 0) {
return (st);
}
}
/*
* special case for additional disk libraries - just pass it
* off to the disk archiving functions.
*/
return (st);
}
/* Create library name */
if (st != 0) {
return (st);
}
}
/* Create LM name */
/*
* MMS defines a Library Manager(LM) to manage each Library object.
* While the MMS spec supports a library to be managed by multiple LMs
* (without any upper limit), multiple LMs are only required for
* switchover or failover purposes. As such, for the first release of
* the MMS api, the hostname of the LM for ACSLS libraries defaults to
* the hostname running MM.
*/
#ifdef MGMT_VAR_CFG
if (st != 0) {
return (st);
}
if (st != 0) {
return (MMS_MGMT_NO_MMHOST);
}
}
#else
/* always set to this host */
if (st != 0) {
return (st);
}
#endif /* MGMT_VAR_CFG */
/* create LIBRARY object */
if (st != 0) {
return (st);
}
if (!session) {
if (st != 0) {
return (st);
}
}
if (st != 0) {
if (sess) {
(void) mms_goodbye(sess, 0);
}
return (st);
}
/* move ahead in the cmdbuf */
/* Build the LM object */
if (st == 0) {
&response);
}
/* online the library */
if (st == 0) {
}
}
if (st != 0) {
}
if (sess) {
(void) mms_goodbye(sess, 0);
}
return (st);
}
int
{
int st;
char buf[2048];
char *val;
char drvnm[1024];
char *namep;
int count = 0;
char hostbuf[1024];
int i;
if (!nvl) {
return (MMS_MGMT_NOARG);
}
if (!mgmt_chk_auth("solaris.mms.create")) {
return (EACCES);
}
if (st != 0) {
return (st);
}
/* Library asssociation and connection are required */
return (st);
}
#ifdef MMS_VAR_CFG
return (st);
}
#else
/* must always be the same as MM server */
if (st == 0) {
if (st != 0) {
return (st);
}
} else {
}
#endif /* MMS_VAR_CFG */
if (st == 0) {
/* name provided */
} else {
return (st);
}
if (st != 0) {
return (st);
}
}
/* create the Drive Group Name */
if (st != 0) {
return (st);
}
}
/*
* Ready to create the objects. On failure, unwind the list and
* remove what was added. Order is DRIVEGROUP, DRIVE,
* foreach host add DM, foreach app add DRIVEGROUPAPPLICATION.
*/
/* create DRIVEGROUP */
if (st != 0) {
goto done;
}
/* Create DRIVE */
if (st != 0) {
goto done;
}
/* For each host specified in O_DEVCONN, create a DM */
/* should never happen since we checked earlier */
goto done;
}
for (i = 0; i < count; i++) {
/* create DM Name */
if (st != 0) {
break;
}
}
/* put back the original array */
if (st != 0) {
goto done;
}
/* For each application in O_APPS, create a DRIVEGROUPAPPLICATION */
/* nothing to do */
goto done;
}
for (i = 0; i < count; i++) {
if (!saved[i]) {
continue;
}
/*
* special case 'all' and 'none'.
* 'all' is meant to mean all currently defined apps
* + all future ones, but no way to specify in MMS today.
* 'none' just means set no apps, so do nothing.
*/
continue;
}
if (st != 0) {
/*
* Failure on this particular bit is ok, just note
* the failure as a warning
*/
st = 0;
}
}
/* put back the original list */
/* online the drive */
if (st == 0) {
}
}
done:
if (st != 0) {
}
if (sess) {
(void) mms_goodbye(sess, 0);
}
return (st);
}
void
free_acslib_list(void *arg)
{
return;
}
}
}
void
free_drive_list(void *arg)
{
return;
}
}
}
int
{
int st;
char *val;
void *response;
char cmd[8192];
char tid[64];
if (!lib) {
return (MMS_MGMT_NOARG);
}
if (!mgmt_chk_auth("solaris.mms.delete")) {
return (EACCES);
}
if (st != 0) {
return (st);
}
if (!session) {
if (st != 0) {
return (st);
}
}
/* TODO: Add checks for library dependencies in cartridgegroups */
/* TODO: Add checks for drives in this library */
(void) mms_gen_taskid(tid);
if (st == 0) {
"delete task['%s'] type[LIBRARY] "
"match[streq (LIBRARY.'%s' '%s')];",
cmd);
&response);
}
if (sess) {
(void) mms_goodbye(sess, 0);
}
if (st != 0) {
}
return (st);
}
static int
{
int st;
char cmd[2048];
char tid[64];
void *response;
if (!libname) {
return (MMS_MGMT_NOARG);
}
(void) mms_gen_taskid(tid);
"delete task['%s'] type[LM] match[streq (LM.'%s' '%s')];",
if (!session) {
if (st != 0) {
return (st);
}
}
if (sess) {
(void) mms_goodbye(sess, 0);
}
return (st);
}
static int
{
int st;
char tid[64];
char cmd[1024];
if (!dgname) {
return (MMS_MGMT_NOARG);
}
/*
* remove DRIVEGROUPAPPLICATIONs associated with this
* DRIVEGROUP too.
*/
(void) mms_gen_taskid(tid);
"delete task['%s'] type[DRIVEGROUPAPPLICATION]"
" match[streq (DRIVEGROUP.'DriveGroupName' '%s')];",
if (!session) {
if (st != 0) {
return (st);
}
}
if (st == 0) {
(void) mms_gen_taskid(tid);
"delete task['%s'] type[DRIVEGROUP] "
"match[streq(DRIVEGROUP.'DriveGroupName' '%s')];",
&response);
}
if (sess) {
(void) mms_goodbye(sess, 0);
}
return (st);
}
static int
{
int st;
char *drive;
char tid[64];
char cmd[1024];
if (!nvl) {
return (MMS_MGMT_NOARG);
}
if (st != 0) {
return (st);
}
if (!session) {
if (st != 0) {
return (st);
}
}
/* Find the list of DMs to be removed */
if (st != 0) {
if (sess) {
(void) mms_goodbye(sess, 0);
}
return (st);
}
(void) mms_gen_taskid(tid);
"delete task['%s'] type[DM] "
"match[streq (DM.'%s' '%s')];",
&response);
if (st != 0) {
break;
}
}
if (sess) {
(void) mms_goodbye(sess, 0);
}
return (st);
}
int
{
int st;
char *drivename;
char tid[64];
char cmd[1024];
if (!nvl) {
return (MMS_MGMT_NOARG);
}
if (!mgmt_chk_auth("solaris.mms.delete")) {
return (EACCES);
}
if (st != 0) {
return (st);
}
if (!session) {
if (st != 0) {
return (st);
}
}
if (st == 0) {
(void) mms_gen_taskid(tid);
"delete task['%s'] "
"type[DRIVE] match[streq (DRIVE.'%s' '%s')];",
&response);
}
if (st == 0) {
}
if (sess) {
(void) mms_goodbye(sess, 0);
}
return (st);
}
/* MODIFY functions */
int
{
int st;
char *fnam = "mms_modify_library()";
char *libname;
char tid[64];
char cmd[8192];
char lmcmd[8192];
int count = 0;
int lmcount = 0;
char *carray[LIBOPT_COUNT];
char *lmarray[LMOPT_COUNT];
if (!mgmt_chk_auth("solaris.mms.modify")) {
return (EACCES);
}
/* get existing attrs for LIBRARY, LM */
/* see what changed, if anything */
/* update the objects */
if (!nvl) {
return (MMS_MGMT_NOARG);
}
if (st != 0) {
return (st);
}
/* see if there are LIBRARY attrs to be changed. Skip over O_NAME. */
errs);
if (st != 0) {
return (st);
}
(void) mms_gen_taskid(tid);
"show task['%s'] match[streq (LIBRARY.'%s' '%s')] "
"reportmode[namevalue] report[LIBRARY];", tid,
"LibraryName", libname);
/*
* see if there are LM attrs to be changed.
* Skip over O_NAME and O_LMNAME.
*/
errs);
if (st != 0) {
return (st);
}
(void) mms_gen_taskid(tid);
"show task['%s'] match[streq (LM.'%s' '%s')] "
/* nothing to do */
return (MMS_MGMT_NOARG);
}
if (!session) {
if (st != 0) {
return (st);
}
}
if (count > 0) {
if (st == 0) {
&libattrs);
}
if (st == 0) {
if (st == 0) {
}
} else {
goto done;
}
}
if (lmcount > 0) {
if (st == 0) {
&libattrs);
}
if (st != 0) {
goto done;
}
if (nvp) {
} else {
/* something is very wrong. no LM returned */
lmcount = 0;
}
}
/* if we have any attrs left to set, do it */
if (count > 0) {
(void) mms_gen_taskid(tid);
"attribute task['%s'] "
"match[streq (LIBRARY.'LibraryName' '%s')] ",
if (st != 0) {
goto done;
}
}
if (lmcount > 0) {
(void) mms_gen_taskid(tid);
"attribute task['%s'] "
"match[streq (LM.'LibraryName' '%s')] ",
}
done:
if (sess) {
(void) mms_goodbye(sess, 0);
}
return (st);
}
int
{
int st;
char *fnam = "mms_modify_drive()";
char *drvname;
char tid[64];
char cmd[8192];
char dmcmd[8192];
char dgcmd[8192];
char dgacmd[8192];
int count = 0;
int dgcount = 0;
int dmcount = 0;
char *carray[DRVOPT_COUNT];
char *dgarray[DGOPT_COUNT];
char *dmarray[DMOPT_COUNT];
int numdms = 0;
int numdga = 0;
if (!mgmt_chk_auth("solaris.mms.modify")) {
return (EACCES);
}
if (!nvl) {
return (MMS_MGMT_NOARG);
}
if (st != 0) {
}
/* only get the DRIVEGROUP if we need it */
}
/* see if there are DRIVE attrs to be changed. */
(void) mms_gen_taskid(tid);
/* figure out what things are changing */
errs);
if (st != 0) {
return (st);
}
"show task['%s'] match[streq (DRIVE.'%s' '%s')] "
/* DM */
errs);
if (st != 0) {
return (st);
}
(void) mms_gen_taskid(tid);
/* need to make sure we've got info about all the DMs */
"show task['%s'] "
"match[streq(DM.'DriveName' '%s')] "
dmcount++;
}
if (st != 0) {
return (st);
}
/* connect to MM */
if (!session) {
if (st != 0) {
return (st);
}
}
/* fetch the drive attributes */
if (st == 0) {
&drvattrs);
}
if (st != 0) {
goto done;
}
/* DRIVEGROUP */
if (dodg) {
/* uh oh */
} else {
if (st == 0) {
&dgname);
}
}
if (st != 0) {
goto done;
}
(void) mms_gen_taskid(tid);
"show task['%s'] "
"match[streq(DRIVEGROUP.'DriveGroupName' '%s')] "
}
if (dodga) {
/*
* get all of them. We need to make sure all apps
* in O_APPS are represented.
*/
(void) mms_gen_taskid(tid);
"show task['%s'] report[DRIVEGROUPAPPLICATION] "
"match[streq(DRIVEGROUPAPPLICATION.'DriveGroupName' '%s')]"
}
/* nothing to do */
goto done;
}
if (dodg) {
if (st == 0) {
}
if (st != 0) {
goto done;
}
}
if (dmcount > 0) {
if (st == 0) {
&dmattrs);
}
if (st != 0) {
goto done;
}
}
if (dodga) {
if (st == 0) {
}
if (st != 0) {
goto done;
}
}
if (st == 0) {
if (count > 0) {
(void) mms_gen_taskid(tid);
"attribute task['%s'] "
"match[streq (DRIVE.'DriveName' '%s')] ",
sizeof (cmd));
&response);
if (st != 0) {
goto done;
}
}
}
if (st == 0) {
if (dgcount > 0) {
(void) mms_gen_taskid(tid);
"attribute task['%s'] "
"match[streq (DRIVEGROUP.'DriveGroupName' '%s')] ",
sizeof (dgcmd));
&response);
if (st != 0) {
goto done;
}
}
}
if (!nva) {
continue;
}
/* be more robust here. If it > 2, that's surprising */
if (numdms < 10) {
}
}
/* Update the DMs */
if (st != 0) {
goto done;
}
continue;
}
/*
* For DRIVEGROUPAPPLICATION, need to check
* current DGAs. Remove any not reflected in
* app list, add new
*/
if (numdga < 10) {
}
}
/* Update the DriveGroupApplications */
done:
if (sess) {
(void) mms_goodbye(sess, 0);
}
if (drvattrs) {
}
if (dmattrs) {
}
if (dgattrs) {
}
if (dgaattrs) {
}
return (st);
}
static int
{
int st;
int vcount;
int i;
int j;
char *val;
char cmd[8192];
char tid[64];
void *response;
int rst = 0;
return (MMS_MGMT_NOARG);
}
vcount = 0;
for (i = 0; i < count; i++) {
if (!val) {
continue;
}
for (j = 0; j < vcount; j++) {
if (!varray[j]) {
continue;
}
/* match, keep this one */
break;
}
}
if (j == vcount) {
/* Remove this DGA */
(void) mms_gen_taskid(tid);
"delete task['%s'] type[DRIVEGROUPAPPLICATION] "
"match[ and ("
"streq(DRIVEGROUPAPPLICATION.'DriveGroupName' "
"'%s') "
"streq(DRIVEGROUPAPPLICATION.'ApplicationName' "
"'%s')"
&response);
if (st != 0) {
if (rst == 0) {
}
}
}
}
/* add any remaining */
for (i = 0; i < vcount; i++) {
continue;
}
(void) mms_gen_taskid(tid);
"create task['%s'] type[DRIVEGROUPAPPLICATION] "
"set[DRIVEGROUPAPPLICATION.'DriveGroupName' '%s'] "
"set[DRIVEGROUPAPPLICATION.'ApplicationName' '%s'];",
&response);
if (st != 0) {
if (rst == 0) {
}
}
}
return (rst);
}
static int
{
int st;
int rst = 0;
int i;
int j;
int vcount;
char cmd[8192];
char tid[64];
int highid = 0;
char buf[1024];
char *bufp;
return (MMS_MGMT_NOARG);
}
vcount = 0;
if (!session) {
if (st != 0) {
return (st);
}
}
for (i = 0; i < count; i++) {
/* save away existing values in case we need to add a DM */
if (!msglevel) {
&msglevel);
}
if (!trclevel) {
&trclevel);
}
if (!trcsz) {
&trcsz);
}
for (j = 0; j < vcount; j++) {
if (!varray[j]) {
continue;
}
continue;
}
/* this DM can stay. */
}
st = 0;
}
break;
}
/* This DM needs to be removed */
if (st != 0) {
if (rst == 0) {
}
continue;
}
(void) mms_gen_taskid(tid);
"delete task['%s'] type[DM] "
"match[ streq(DM.'DMName' '%s')];",
&response);
if (st != 0) {
if (rst == 0) {
}
continue;
}
}
}
/*
* unused DMs are gone. Add any new ones, and update all with
* new values if any
*/
for (i = 0; i < vcount; i++) {
if (!varray[i]) {
continue;
}
(void) mms_gen_taskid(tid);
"create task['%s'] type[DM] "
"set[DM.'DMName' 'DM_%s_%d'] "
"set[DM.'DriveName' '%s'] "
"set[DM.'DMTargetHost' '%s'] ",
&response);
if (st != 0) {
if (rst == 0) {
}
}
}
/* done with the new DMs */
/* update any existing DMs with the new values, if any */
(void) mms_gen_taskid(tid);
"attribute task['%s'] "
if (msglevel) {
" set[DM.'DMMessageLevel' '%s']", msglevel);
}
if (trclevel) {
" set[DM.'TraceLevel' '%s']", trclevel);
}
if (trcsz) {
" set[DM.'TraceFileSize' '%s']", trcsz);
}
if (updated) {
&response);
if (st != 0) {
if (rst == 0) {
}
}
}
if (sess) {
(void) mms_goodbye(sess, 0);
}
return (rst);
}
int
{
int st;
char *fnam = "mms_mgmt_set_state()";
char *otype;
char *name;
char cmd[8192];
char tid[64];
char *val;
char buf[1024];
if (!nvl) {
return (MMS_MGMT_NOARG);
}
if (!mgmt_chk_auth("solaris.mms.device.state")) {
return (EACCES);
}
if (st == 0) {
otype = "drive";
}
}
if (st != 0) {
return (st);
}
if (st == 0) {
}
}
if (st != 0) {
return (st);
}
if (st != 0) {
return (st);
}
/* get LM or DM names */
(void) mms_gen_taskid(tid);
if (*otype == 'l') {
key = "LMName";
"show task['%s'] reportmode[namevalue] "
"match[streq(LM.'LibraryName' '%s')] "
"report[LM.'LMName'];",
} else {
key = "DMName";
"show task['%s'] reportmode[namevalue] "
"match[streq(DM.'DriveName' '%s')] "
"report[DM.'DMName' DM.'DMTargetHost'];",
}
if (!session) {
if (st != 0) {
return (st);
}
}
if (st == 0) {
}
if (st != 0) {
if (sess) {
(void) mms_goodbye(sess, 0);
}
return (st);
}
(void) mms_gen_taskid(tid);
/* LM required for lib online, but must not be sent for offline */
if (st != 0) {
continue;
}
if (st == 0) {
" '%s'", val);
}
}
st = 0;
}
/* not a failure if already in requested state */
if ((st == MMS_ELIBALREADYONLINE) ||
(st == MMS_EDRIVEALREADYONLINE) ||
(st == MMS_ELIBALREADYOFFLINE) ||
(st == MMS_EDRIVEALREADYOFFLINE)) {
st = 0;
}
if (sess) {
(void) mms_goodbye(sess, 0);
}
return (st);
}
int
{
int st;
char tid[64];
char cmd[8192];
char *val;
char *dval;
int i;
int count = 0;
char buf[2048];
if (!drvs) {
return (MMS_MGMT_NOARG);
}
if (st != 0) {
return (st);
}
}
if (!session) {
if (st != 0) {
return (st);
}
}
/* primary filter on name */
(void) mms_gen_taskid(tid);
"show task['%s'] report[DRIVE] reportmode[namevalue]", tid);
if (count == 1) {
" match[streq(DRIVE.'DriveName' '%s')]",
varray[0]);
} else if (count > 1) {
for (i = 0; i < count; i++) {
if (!varray[i]) {
continue;
}
"streq(DRIVE.'DriveName' '%s') ",
varray[i]);
}
}
if (st == 0) {
}
if (st != 0) {
goto done;
}
if (st != 0) {
/* should never happen */
continue;
}
if (st != 0) {
/* bad response from MM */
continue;
}
(void) mms_gen_taskid(tid);
"show task['%s'] report[DM] reportmode[namevalue] "
&response);
if (st != 0) {
continue;
}
i = 0;
if (st != 0) {
continue;
}
if (st == 0) {
}
&dval);
if (st == 0) {
dval);
}
}
&dval);
if (st == 0) {
(void) nvlist_add_string(drv,
O_TRACELEVEL, dval);
}
}
}
cmd[0] = '\0';
while (i > 0) {
if (!first) {
} else {
}
}
(void) mms_gen_taskid(tid);
"show task['%s'] reportmode[namevalue] "
"report[DRIVEGROUPAPPLICATION.'ApplicationName'] "
&response);
if (st == 0) {
}
if (st != 0) {
continue;
}
i = 0;
continue;
}
}
cmd[0] = '\0';
while (i > 0) {
if (!first) {
} else {
}
}
}
/* filter before returning */
/* reset status */
st = 0;
done:
if (sess) {
(void) mms_goodbye(sess, 0);
}
return (st);
}
int
{
int st;
char tid[64];
char cmd[8192];
char *val;
char *lval;
int count = 0;
int i;
char buf[2048];
if (!libs) {
return (MMS_MGMT_NOARG);
}
if (st != 0) {
return (st);
}
}
if (!session) {
if (st != 0) {
return (st);
}
}
/* primary filter on name */
(void) mms_gen_taskid(tid);
"show task['%s'] report[LIBRARY] reportmode[namevalue]", tid);
if (count == 1) {
" match[streq(LIBRARY.'LibraryName' '%s')]",
varray[0]);
} else if (count > 1) {
for (i = 0; i < count; i++) {
if (!varray[i]) {
continue;
}
"streq(LIBRARY.'LibraryName' '%s') ",
varray[i]);
}
}
if (st == 0) {
}
if (st != 0) {
goto done;
}
if (st != 0) {
/* should never happen */
continue;
}
if (st != 0) {
/* bad response from MM */
continue;
}
(void) mms_gen_taskid(tid);
"show task['%s'] report[LM] reportmode[namevalue] "
&response);
if (st != 0) {
continue;
}
if (st != 0) {
continue;
}
&lval);
if (st == 0) {
lval);
}
}
&lval);
if (st == 0) {
(void) nvlist_add_string(lib,
O_TRACELEVEL, lval);
}
}
&lval);
if (st == 0) {
(void) nvlist_add_string(lib,
O_MSGLEVEL, lval);
}
}
}
}
/* filter before returning */
/* reset status */
st = 0;
done:
if (sess) {
(void) mms_goodbye(sess, 0);
}
return (st);
}