StorNext API Guide, 6-01375-05, Ver. A, Rel. 2.0, April 2008, Made in USA.
Quantum Corporation provides this publication “as is” without warranty of any kind, either express or implied,
including but not limited to the implied warranties of merchantability or fitness for a particular purpose. Quantum
Corporation may revise this publication from time to time without notice.
COPYRIGHT STATEMENT
Copyright 2008 by Quantum Corporation. All rights reserved.
StorNext copyright (c) 1991-2008 Advanced Digital Information Corporation (ADIC), Redmond, WA, USA. All rights
reserved.
Your right to copy this manual is limited by copyright law. Making copies or adaptations without prior written
authorization of Quantum Corporation is prohibited by law and constitutes a punishable violation of the law.
TRADEMARK STATEMENT
Quantum, DLT, DLTtape, the Quantum logo, and the DLTtape logo are all registered trademarks of Quantum
Corporation.
SDLT and Super DLTtape are trademarks of Quantum Corporation.
Other trademarks may be mentioned herein which belong to other companies.
Contents
Chapter 1Introduction1
About This Guide .............................................................................................. 1
C++ Test Program Example .................................................................. 164
C++ XML Interface Test Program Example........................................ 166
Makefile Example for Linux Platforms................................................ 167
Makefile Example for Solaris Platforms.............................................. 168
StorNext API Guideii
About This Guide
Chapter 1
1Introduction
This guide contains information and instructions necessary to install and
use the StorNext APIs (SNAPI). This guide is intended for system
administrators, programmers, and anyone interested in learning about
installing and using the StorNext APIs.
The StorNext API guide is divided into the following chapters:
• StorNext Storage Manager APIs
• StorNext File System APIs
• File System API Example
• Storage Manager API Example
StorNext API (SNAPI) contains StorNext Storage Manager APIs,
StorNext File System APIs, and Client APIs that can be used to make calls
to third-party applications, resulting in enhanced operations between
third-party applications and StorNext.
StorNext API Guide1
Product Compatibility
The StorNext API (SNAPI) release is compatible with a specific StorNext
release. Please refer to the following compatibility matrix to verify you
are running compatible versions of both products.
The StorNext File System APIs are automatically installed when you
install the StorNext software.
The StorNext Storage Manager APIs on the CD must be installed before
you can call them. For installation instructions, see Installing the APIs
the Storage Manager Host in the chapter StorNext Storage Manager APIs.
on
StorNext API Guide2
Running APIs Remotely
Beginning with SNAPI 2.0, you can now run StorNext Storage Manager
APIs remotely from a client. Functionally, operation from a remote client
is identical to running the APIs locally. If you want to use this feature,
remote clients must be installed and configured as described in Installing
the APIs on a Remote Client and Configuring SNAPI in the chapter
StorNext Storage Manager APIs
StorNext File System APIs continue to run remotely on clients as they
always have.
.
Explanation of Warnings, Cautions and Notes
Chapter 1 Introduction
Running APIs Remotely
The following cautions, and notes appear throughout this document to
highlight important information.
Caution:Indicates a situation that may cause possible damage to
equipment, loss of data, or interference with other
equipment.
Note:Indicates important information that helps you make better
use of your system.
Related Documents You Might Need
The following documents available for StorNext can be found at
www.
quantum.com/manuals.
StorNext API Guide3
Chapter 1 Introduction
Quantum Technical Assistance Center
• StorNext User’s Guide (6-01658-02)
• StorNext File System Quick Reference Guide (6-00361-21)
More information about this product is available on the Customer Service
Center website at www.quantum.com/csc
contains a collection of information, including answers to frequently
asked questions (FAQs). You can also access software, firmware, and
drivers through this site.
Quantum Technical Assistance Center
For further assistance, or if training is desired, contact the Quantum
Technical Assistance Center:
North America:
UK, France and Germany:
EMEA:
Worldwide Web:
1+800-284-5101
00800 4 QUANTUM
+44 1256 848 766
www.quantum.com/support
. The Customer Service Center
StorNext API Guide4
Introduction
Chapter 2
2StorNext Storage Manager APIs
This chapter describes the application programming interfaces (APIs)
available for StorNext Storage Manager.
This chapter contains the following major topics:
• Installing the APIs
• Installing the APIs on a Remote Client
• Configuring SNAPI
• SNAPI Logs and Health Checks
• Use Cases
• API Descriptions and Arguments
Note:Unlike the StorNext File System APIs which are automatically
installed with the StorNext software, you must install the
Storage Manager APIs from the CD by following the
installation instructions in Installing the APIs
Manager Host on page 6.
Throughout this chapter, the terms library and archive are used. Library
refers to an actual physical library (e.g., with robotics), whereas archive is
StorNext API Guide5
on the Storage Manager Host
on the Storage
Chapter 2 StorNext Storage Manager APIs
Installing the APIs on the Storage Manager Host
a more general term that may refer to a library, a vault, or anywhere else
where media can be stored.
A vault is a logical archive type. It is any location that contains copies of
media that have been removed from the operational system. Since a vault
has no robotics, if a vault has tape drives, tape media must be manually
mounted to the drive and dismounted from the drive.
Installing the APIs on the Storage Manager Host
This section describes how to install the SNAPI Storage Manager APIs
and the SNAPI Server on the StorNext Storage Manager host. After
installation is complete, the SNAPI Server will listen for requests from all
local and remote SNAPI clients. The SNAPI Server will log operational
and error messages to /usr/adic/SNAPI/logs/. The SNAPI Server will also
handle all local and remote requests from snclix, the SNAPI command
line interface utility.
1 Log on as root.
2 Insert and mount the product CD that contains the StorNext Storage
Manager APIs.
3 Use the cd command to navigate to the directory that corresponds to
your operating system:
•SunOS590sparc_32
•SunOS5100sparc_32
•RedHat40AS_26ia64
•RedHat40AS_26x86_32
•RedHat40AS_26x86_64
•SuSE90ES_26x86_64
•SuSE90ES_26ia64
•SuSE90ES_26x86_32
•SuSE100ES_26x86_64
•SuSE100ES_26ia64
StorNext API Guide6
Chapter 2 StorNext Storage Manager APIs
•SuSE100ES_26x86_32
4 From the operating system directory, run the program install.snapi.
This program automatically decompresses the APIs and copies them
to your StorNext directory in the following location: /usr/adic/SNAPI.
5 You can access this API guide by locating the pdf file on the StorNext
API CD.
After installing the Storage Manger APIs, in order to successfully
compile and link with your applications you need the location of the
main header file and the libraries Quantum delivers.
The main header file location: /usr/adic/SNAPI/inc/API.hh
The dynamic library location: /usr/adic/SNAPI/lib/libsnapi.so
The static library location: /usr/adic/SNAPI/lib/static/libsnapi.a
Installing the APIs on a Remote Client
Installing the APIs on a Remote Client
This section describes how to install the SNAPI Storage Manager APIs on
a remote client connected to a SNAPI Server host. As a prerequisite,
SNAPI must have already been installed on the Storage Manager host as
described in Installing the APIs
To install a remote client:
1 Copy the script /usr/adic/SNAPI/bin/install.snapiclient from the
Storage Manager host to the remote host.
Note:To ensure that the install.snapiclient script runs properly,
before proceeding verify that RCP is enabled between the
remote client host and the StorNext Storage Manager host.
2 Run the install.snapiclient script on the remote host, passing it the
name of the Storage Manager host. For example:
install.snapiclient <SNAPI_Server_Host>
The installation script also installs the snclix utility, which can be used to
run SNAPI API commands on the command line.
StorNext API Guide7
on the Storage Manager Host.
Configuring SNAPI
Chapter 2 StorNext Storage Manager APIs
Configuring SNAPI
Note:An upgrade of SNAPI on a remote client is accomplished by
running the installation procedure described above. To
remove SNAPI from a remote client, simply remove all
contents of the /usr/adic/SNAPI/ directory.
SNAPI configuration for both local and remote clients is accomplished by
editing the /usr/adic/SNAPI/config/snapi.cfg file on the SNAPI server and
remote hosts, respectively. The snapi.cfg file allows you to specify the
following:
•SNAPI server names
• INET socket port value for remote clients
Snapi.cfg Example2
• Client timeout value. This value specifies how long the client should
wait for a response from the SNAPI server. This value can be between
0-1000 minutes. The default value is 30 minutes.
You are not required to modify the snapi.cfg file before running the APIs
unless you are enabling HA support for remote clients, or in other special
cases. (See HA Failover Support
support.)
The following example describes and illustrates each of the parameters in
the snapi.cfg file. (You can find the example in the snapi.cfg.default file
installed at /usr/adic/SNAPI/config/snapi.cfg.default.)
<!-- The serverName indicates the host on which the S torNext server is
running. If this is an HA system, add a line to indicate the
failover host. -->
<PARAMETER name="serverName" value="localhost"/>
<!-- The serverPort is used for remote client connections. There i s no
need to edit this value unless the port is already in use, in which
case the port value on the StorNext server must be edited also. -->
<PARAMETER name="serverPort" value="61776"/>
for more information about enabling HA
StorNext API Guide8
Chapter 2 StorNext Storage Manager APIs
SNAPI Logs and Health Checks
<!-- The clientT imeOut is the maximum time (in secs) a client will spend
attempting to fulfill a request to the server. Set the value to 0 to
indicate the client should try indefinitely to fulfill the request. -->
<PARAMETER name="clientTimeOut" value="1800"/>
HA Failover Support2
HA failover support applies only to remote clients, and is supported by
the snapi.cfg file on the remote hosts. To enable HA support, specify the
primary and secondary SNAPI server host names in an ordered list on
separate lines in the /usr/adic/SNAPI/config/snapi.cfg file.
Upon detecting failover, SNAPI internally will reissue the original
request to the SNAPI server on behalf of the remote client. Connection
attempts to the primary and secondary servers will continue until the
client timeout limit is reached.
SNAPI Logs and Health Checks
Logs are available for the SNAPI server host. These logs use the existing
StorNext logging framework, and are located at /usr/adic/SNAPI/logs/tac.
You can configure SNAPI logs by adjusting the parameters located at
/usr/adic/SNAPI/logs/log_params.
Health checks are also available on the SNAPI server host. Health checks
are also integrated with the existing StorNext Health Check framework.
To run health checks, from the StorNext home page, choose Health Check
from the Service Menu. The Health Check Test screen appears. From this
screen run one or both of these health checks:
• Network: This health check validates connections to the StorNext
server
StorNext API Guide9
Use Cases
Chapter 2 StorNext Storage Manager APIs
Use Cases
• Config: This health check validates the contents of the SNAPI
configuration file (snapi.cfg)
Alternatively, you can accomplish the same thing manually by running
the following tests:
• snapiverifyConnectivity: Verifies connection to the StorNext server.
Located at /usr/adic/SNAPI/bin/snapiVerifyConnectivity.
• snapiverifyConfig: Validates the SNAPI configuration file (snapi.cfg)
contents. Located at /usr/adic/SNAPI/bin/snapiVerifyConfig.
There are three different programmatic entry points for accessing the
StorNext Storage Manager APIs:
• Using a C or C++ Library
• Using a C or C++ Library with XML Wrapper
• Using the SNAPI XML Command Line Interface (snclix)
This section contains examples showing how to use the APIs with these
methods.
Note:Data types used in these APIs are defined in the header files
located here: /usr/adic/SNAPI/inc/
Using a C or C++ Library2
StorNext API Guide10
For each API, there is a corresponding C++ class with the same name as
the API. Quantum provides both dynamic and static libraries, as well as a
header file to link to the application program.
The following example illustrates typical API usage for this case.
// Send request to the server and get overall request status code.
// Note: This method may throw exceptions (see catch block below).
status = getFileAttrReq.process();
// Check the returned status code.
if (status.getCode() != SUCCESS)
{
cout << "StatusCode: " << status.getCodeAsString() << endl;
cout << "Description: " << status.getDescription() << endl;
cout << "LocalStatus.StatusCode: " <<
getFileAttrReq.getLocalStatus().getCodeAsString() << endl;
cout << "LocalStatus.Description: " <<
getFileAttrReq.getLocalStatus().getDescription() << endl;
}
else
{
// Get the requested data.
FileInfo fileInfo = getFileAttrReq.getFileInfo();
For this approach there is a single function called doXML available to the
third-party program. This function’s input and output are string type,
and their contents are in XML format. Different APIs have different
specifications on the XML input and output, as described for each API.
Note:It is your responsibility to provide an input string that satisfies
the specification. Otherwise, a failure from the doXML
function call might result.
The following example illustrates typical API usage for this case.
// Stream the results to standard out.
cout << xmlOut << endl;
return status.getCode();
}
Using the SNAPI XML
Command Line Interface
(snclix)2
The snclix utility is a command line utility that provides an interface for
SNAPI APIs from the SNAPI server and remote client hosts. This utility
operates on XML input and output, and is very similar to the doXML()
function. Both of these take an XML request definition as input, and
return an XML response with requested information embedded in the
response.
StorNext API Guide13
Chapter 2 StorNext Storage Manager APIs
Use Cases
Note:It is your responsibility to generate a properly formatted XML
request and to subsequently access the relative portions of
information in the XML response.
Any XML information that is not relevant to the specified
request will cause an error. This also applies to cases where
single arguments are expected but multiple arguments are
supplied.
XML character data must comply with Section 2.4 of the XML
specification. In particular, when used in value strings, the following
characters must be escaped using their ASCII numeric character
references:
& = "&"
< = "<"
> = ">"
In addition, any non-printing characters (such as new line, tab, etc.) must
be escaped using their ASCII numeric character references.
When using the snclix utility, after you create a file containing properly
formatted XML (or optionally an input stream,) you then pass the
information to the snclix executable program.
Internally, snclix calls the doXML() function to process the request and
send the resulting XML response to an output file (or optionally streams
it to stdout).
The snclix utility is located at /usr/adic/SNAPI/bin/snclix and has the
following usage format:
snclix [-i infile] [-o outfile] [-c config]
-i infile:Specifies an input file. (File contents should be in XML format.)
-o outfile: Specifies an output file. (File contents will be in XML format.) If an
A brief description is provided for each API, as well as its input
arguments and output variables. Also provided for each API is an
example showing XML input and output, and the corresponding C++
class declaration.
The following StorNext Storage Manager APIs are described in this
section:
• Backup
• CheckoutMedia
• CleanMedia
• CopyMedia
• EjectMedia
• EnterMedia
• FileRetrieve
StorNext API Guide15
• GetArchiveCapacity
• GetArchiveList
• GetBackupStatus
• GetDriveList
• GetFileAttribute
• GetFileTapeLocationI
• GetMediaList
• GetMediaStatus
• GetPolicy
• GetPortList
• GetSchedule
• GetSystemStatus
• MoveMedia
• PassThru
Chapter 2 StorNext Storage Manager APIs
API Descriptions and Arguments
• RmDiskCopy
• SetArchiveState
• SetDirAttributes
• SetDriveState
• SetFileAttributes
• SetMediaState
• SetPolicy
• SetSchedule
For the C++ class declaration section, all API classes inherit from class
Request, which has a public member function process(). The third-party
program must call this function to have the API request processed. See
the example code in Appendix B.
StorNext API Guide16
Chapter 2 StorNext Storage Manager APIs
API Descriptions and Arguments
Note:The process() function should be called only once for each
instantiation of an API object. API users should instantiate a
new API object every time they need to call the process()
function.
When you enter arguments for the StorNext Storage Manager
APIs, wildcard characters such as the asterisk (*) are not
supported. For example, when you run the FileRetrieve API
you cannot enter ‘*’ when entering the <filename> parameter.
Backup2
This API initiates a backup operation.
Input
NA. This API has no command arguments.
Output
status: SUCCESS, FAILURE, SUBFAILURE, or SYNTAXERROR status
code.
XML Example
Request:2
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!-- Initiate a system backup operation. -->
<COMMAND name="Backup"/>
/// Primary Constructor
/// This constructor is intended for primary instantiation of the object,
/// given a single media ID.
CheckOutMedia(const std::string& inMediaID);
/// Secondary Constructor
/// This constructor is for instantiation of the object from a list of
/// media ID to eject.
CheckOutMedia(const MediaList& inMediaList);
2
/// Method to return the list of media
const MediaList& getMediaList() const;
/// Method to return the collection of status pairs
const StatusPairList& getLocalStatus() const;
/// Method to return the status pair for a specific mediaID
const StatusPair& getLocalStatus(const std::string& mediaID) const;
}
StorNext API Guide19
Chapter 2 StorNext Storage Manager APIs
API Descriptions and Arguments
CleanMedia2
This API cleans media by removing inactive files from the specified
media.
Input
mediaID: The ID of the media you want to clean. You can specify multiple
media IDs to clean multiple media.
Output
status: SUCCESS, FAILURE, SUBFAILURE, or SYNTAXERROR status
code.
XML Example
Request:2
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!-- Remove inactive files from all specified media. -->
<COMMAND name="CleanMedia">
/// Primary Constructor
/// This constructor is intended for primary instantiation of the object.
CleanMedia(const std::string& inMediaID);
/// Secondary Constructor
/// This constructor is intended for instantiation of the object fro m a
/// vector of media ids.
CleanMedia(const MediaList& inMedia);
/// Method to return the list of media
MediaList getMediaList() const;
/// Method to return the list of local status pairs
const StatusPairList& getLocalStatus() const;
/// Method to return the specific local status pair for a given mediaID
const StatusPair& getLocalStatus(const std::string& mediaID) const;
}
2
CopyMedia2
This API copies the content of all specified media to a piece of blank
media.
Input
mediaID: The ID of the media you want to copy. You can specify multiple
media IDs to copy multiple media.
StorNext API Guide21
2
Chapter 2 StorNext Storage Manager APIs
API Descriptions and Arguments
Output2
status: SUCCESS, FAILURE, SUBFAILURE, or SYNTAXERROR status
code.
XML Example
Request:2
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!-- Copy the content of all specified media to blank media. -->
<COMMAND name="CopyMedia">
/// This constructor is intended for primary instantiation of the object.
CopyMedia(const std::string& inMediaID);
/// Secondary Constructor
/// This constructor is intended for instantiation of the object fro m a
/// vector of media ids.
CopyMedia(const MediaList& inMedia);
/// Method to return the list of media
MediaList getMediaList() const;
/// Method to return the list of local status pairs
const StatusPairList& getLocalStatus() const;
/// Method to return the specific local status pair for a given mediaID
const StatusPair& getLocalStatus(const std::string& mediaID) const;
}
EjectMedia2
This API moves the specified media from the archive to a media I/E slot.
EjectMedia does an automated media eject. This API must be used with
the MoveMedia API.
After running this API, you must call the EnterMedia API to physically
move the media from the mailbox into the destination library, or in the
case of a vault, to logically enter the media into the vault.
Input
portID: The port used for ejecting media. The port ID is in the format
0,0,15,###. Only the digits following the final comma are needed,
indicated as ### in the format example. It is not needed for vault
archives.
mediaID: The ID of the media to eject.
Output
status: SUCCESS, FAILURE, SUBFAILURE, or SYNTAXERROR status
code.
2
2
StorNext API Guide23
Chapter 2 StorNext Storage Manager APIs
API Descriptions and Arguments
XML Example2
Request:2
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!-- Eject a specific media from the system. -->
<COMMAND name="EjectMedia">
/// Primary Constructor
/// This constructor is intended for primary instantiation of the object,
/// given a port Id and a single media Id.
EjectMedia(const std::string& inMediaId,
const std::string& inPortId = "0");
/// Method to set port Id
void setPortId(const std::string& inPortId);
2
2
/// Method to return the media Id
StorNext API Guide24
Chapter 2 StorNext Storage Manager APIs
const std::string& getMediaId() const;
/// Method to return the local status pair
const StatusPair& getLocalStatus() const;
}
API Descriptions and Arguments
EnterMedia2
This API adds (inserts) media into the specified archive from the I/E slot.
This API must be used after you run the EjectMedia API, and must be
used with the MoveMedia API.
Input
archiveID: The archive ID to which media is added.
portID: The port used for entering media. The port ID is in the format
0,0,15,###. Only the digits following the final comma are needed,
indicated as ### in the format example. It is not needed for vault
archives.
mediaID: The media ID to insert into the archive.
Output
status: SUCCESS, FAILURE, SUBFAILURE, or SYNTAXERROR status
code.
XML Example
Request:2
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!-- Enter a specific media into the system. -->
<COMMAND name="EnterMedia">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- archiveId : archive name to add media to -->
<!-- portId : IE port id to move media from -->
<!-- mediaId : media to add to archive -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Exactly one each of the above arguments are required. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
/// Primary Constructor
/// This constructor is intended for primary instantiation of the object,
/// given a archive Id, a port Id, and a single media Id.
EnterMedia(const std::string& inArchiveId,
const std::string& inMediaId,
const std::string& inPortId = "0");
/// Method to set portId
void setPortId(const std::string& inPortId);
2
2
/// Method to return the media Id
const std::string& getMediaId() const;
/// Method to return the local status pair
const StatusPair& getLocalStatus() const;
}
FileRetrieve2
StorNext API Guide26
This API retrieves the specified single file from secondary storage to
primary storage.
Loading...
+ 143 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.