fs_restore_config(3) — Subroutines
NAME
fs_restore_config − Restores an AdvFS domain configuration.
SYNOPSIS
#include <stocfg/fs_config.h>
int fs_restore_config(
char ∗config,
char ∗remap,
char ∗∗undo_script,
char ∗∗err_buf,
int ignoreMntPoints); );
LIBRARY
File System and Storage Configuration Library libstocfg
PARAMETERS
∗config
Points to a domain configuration description expressed in XML format. See fs_save_config for how to save a configuration and see fs_config_data for the definition of configuration data.
∗remap
Points to configuration remapping information described in the XML format. See fs_config_data to specify configuration remapping data.
∗∗undo_script
Points to a pointer to a location in which the function stores a character buffer containing a set of command line operations to undo the results of this function.
∗∗err_buf
Points to a pointer to a location in which the function stores an error message.
ignoreMntPoints
Causes the restore function to ignore processing of the mount point information. Directories are not created; filesets are not mounted; and the /etc/fstab file is not updated. Set =1 to ignore mount points.
DESCRIPTION
The fs_restore_config function recreates the configuration of an AdvFS domain by remapping it on cloned disks. You can capture the configuration by using the fs_save_config function and restore it on the same host or on a different host.
You must provide this function with the remapping of original disks to cloned disks. The configuration objects that you can rename are specified in the remapping DTD. See fs_config_data for more information. Remapping information must be specified in XML markup.
See fs_config_data for a sample remapping DTD.
NOTES
The calling function is responsible for freeing memory allocated for the undo script and the error message.
RESTRICTIONS
You must be the root user to execute this function.
If LSM volumes are used by the AdvFS domain, the target system must have LSM setup, and volclonedg must be available.
All volclonedg restrictions apply to this function.
RETURN VALUES
0Returns a value of 0 (zero) on successful completion.
-1Returns a value of -1 on failure and sets the error buffer to point to an error message.
ERRORS
The following are some error messages along with suggested solutions:
Root user permissions required - login in as root user
Empty configuration list - verify the file path/name
Failed parsing config data - verify the configuration definition
Unable to rename fileset - make sure the new and old fileset names are correct
/etc/fstab currently has an entry for fileset - remove the existing file system’s entry from /etc/fstab file to avoid conflicts
File of same name as new mount point exists - specify a different new mount point for the fileset
LSM daemon (vold) is not running - initialize LSM if it is not already setup
Unable to restore LSM config info - make sure that the volclonedg command is available on the system, and that all original disk group disks and new ones are correctly specified in the remapping file
The following error messages may be returned in local restore mode only:
New mount point is required in local restore - add definition of new mount point for the fileset in the remap file
New volume names are required in local restore - add definition of new AdvFS volume for the domain in the remap file
The names of cloned disks are missing - add definition of new disk group disk for the disk group in the remap file
See /usr/lib/nls/msg/$LANG/stocfg.cat for a complete listing of error messages.
EXAMPLES
The following example shows the restoration of an AdvFS domain.
#include <stdio.h>
#include <stocfg/fs_config.h>
main(int argc, char ∗∗argv)
{
int status;
int size;
int ignoreMntPoints;
char ∗undo;
char ∗ebuf;
char ∗config;
char ∗remap;
FILE ∗fp_config,∗fp_remap, ∗fopen();
int fs_restore_config(char ∗config, char ∗remap,
char ∗∗undoScript,
char ∗∗errBuf,
int ignoreMntPoints);
if(argc < 2)
{
printf("Usage: %s [<-i>] <config_file>
<remap_file>\n",∗argv);
printf(" -i ignore mount points\n");
printf(" config_file XML data from
previous fs_save_config()\n");
printf(" remap_file XML data remapping file\n");
exit(0);
}
if(strcmp(∗(argv + 1),"-i") == 0)
{
ignoreMntPoints = 1;
++argv;
}
else
{
ignoreMntPoints = 0;
}
config = (buffer containing configuration information)
remap = (buffer containing remapping information)
undo = NULL;
ebuf = NULL;
status = fs_restore_config(config,remap,&undo,&ebuf,
ignoreMntPoints);
if(status)
{
printf("fs_restore_config failed:
status = %d\n",status);
printf("ebuf = %s\n",ebuf);
fflush(stdout);
}
if(undo != NULL)
printf("\n%s\n",undo);
}
SEE ALSO
Functions: fs_get_dom_list(3), fs_get_fset_list(3), fs_config_get_devs(3), fs_save_config(3)
Files: fs_config_data(4)