diff options
author | Janice Chang <Janice.Chang@Sun.COM> | 2010-08-09 16:22:41 -0400 |
---|---|---|
committer | Janice Chang <Janice.Chang@Sun.COM> | 2010-08-09 16:22:41 -0400 |
commit | 1e05b03fa76ee89d509f0c461b36cb865f1e6794 (patch) | |
tree | a192de32bae3e1fcf8831a191083e08664f029ce | |
parent | 50200e773f0242e336d032a7b43485e1bcfc9bfe (diff) | |
download | illumos-joyent-1e05b03fa76ee89d509f0c461b36cb865f1e6794.tar.gz |
PSARC 2010/310 Addition of SMF "drive-type" property to ndmpd service
6960332 provide both kinds of BSD and SysV tape semantics to the clients
6965720 ndmp_log_dma doesn't work for ZFS backup type
-rw-r--r-- | usr/src/cmd/ndmpadm/ndmpadm_main.c | 3 | ||||
-rw-r--r-- | usr/src/cmd/ndmpd/include/ndmpd_prop.h | 1 | ||||
-rw-r--r-- | usr/src/cmd/ndmpd/ndmp.xml | 1 | ||||
-rw-r--r-- | usr/src/cmd/ndmpd/ndmp/ndmpd_main.c | 5 | ||||
-rw-r--r-- | usr/src/cmd/ndmpd/ndmp/ndmpd_prop.c | 1 | ||||
-rw-r--r-- | usr/src/cmd/ndmpd/ndmp/ndmpd_zfs.c | 2 | ||||
-rw-r--r-- | usr/src/cmd/ndmpd/tlm/tlm_init.c | 3 | ||||
-rw-r--r-- | usr/src/cmd/ndmpd/tlm/tlm_lib.c | 21 |
8 files changed, 33 insertions, 4 deletions
diff --git a/usr/src/cmd/ndmpadm/ndmpadm_main.c b/usr/src/cmd/ndmpadm/ndmpadm_main.c index 098ca1ce81..73b84d47f9 100644 --- a/usr/src/cmd/ndmpadm/ndmpadm_main.c +++ b/usr/src/cmd/ndmpadm/ndmpadm_main.c @@ -104,7 +104,8 @@ static char *prop_table[] = { "backup-quarantine", "restore-quarantine", "overwrite-quarantine", - "zfs-force-override" + "zfs-force-override", + "drive-type" }; #define NDMPADM_NPROP (sizeof (prop_table) / sizeof (prop_table[0])) diff --git a/usr/src/cmd/ndmpd/include/ndmpd_prop.h b/usr/src/cmd/ndmpd/include/ndmpd_prop.h index c7f7b108b0..b8066daf98 100644 --- a/usr/src/cmd/ndmpd/include/ndmpd_prop.h +++ b/usr/src/cmd/ndmpd/include/ndmpd_prop.h @@ -113,6 +113,7 @@ typedef enum { NDMP_RESTORE_QTN, NDMP_OVERWRITE_QTN, NDMP_ZFS_FORCE_OVERRIDE, + NDMP_DRIVE_TYPE, NDMP_MAXALL } ndmpd_cfg_id_t; diff --git a/usr/src/cmd/ndmpd/ndmp.xml b/usr/src/cmd/ndmpd/ndmp.xml index ce401d03d0..01a4fa2fe9 100644 --- a/usr/src/cmd/ndmpd/ndmp.xml +++ b/usr/src/cmd/ndmpd/ndmp.xml @@ -137,6 +137,7 @@ POSSIBILITY OF SUCH DAMAGE. <propval name='restore-wildcard-enable' type='boolean' value='false' /> <propval name='tcp-port' type='integer' value='10000' /> <propval name='zfs-force-override' type='astring' value='off' /> + <propval name='drive-type' type='astring' value='sysv' /> <propval name='value_authorization' type='astring' value='solaris.smf.value.ndmp' /> </property_group> diff --git a/usr/src/cmd/ndmpd/ndmp/ndmpd_main.c b/usr/src/cmd/ndmpd/ndmp/ndmpd_main.c index b87eb49ff8..6e541242fe 100644 --- a/usr/src/cmd/ndmpd/ndmp/ndmpd_main.c +++ b/usr/src/cmd/ndmpd/ndmp/ndmpd_main.c @@ -301,7 +301,10 @@ main(int argc, char *argv[]) exit(SMF_EXIT_ERR_CONFIG); } - (void) tlm_init(); + if (tlm_init() == -1) { + syslog(LOG_ERR, "Failed to initialize tape manager."); + exit(SMF_EXIT_ERR_CONFIG); + } /* * Prior to this point, we are single-threaded. We will be diff --git a/usr/src/cmd/ndmpd/ndmp/ndmpd_prop.c b/usr/src/cmd/ndmpd/ndmp/ndmpd_prop.c index 47ed20ec30..98365035ca 100644 --- a/usr/src/cmd/ndmpd/ndmp/ndmpd_prop.c +++ b/usr/src/cmd/ndmpd/ndmp/ndmpd_prop.c @@ -89,6 +89,7 @@ ndmpd_cfg_param_t ndmpd_cfg_table[] = {"restore-quarantine", "", 0, NDMP_CF_NOTINIT}, {"overwrite-quarantine", "", 0, NDMP_CF_NOTINIT}, {"zfs-force-override", "", 0, NDMP_CF_NOTINIT}, + {"drive-type", "", 0, NDMP_CF_NOTINIT}, }; /* diff --git a/usr/src/cmd/ndmpd/ndmp/ndmpd_zfs.c b/usr/src/cmd/ndmpd/ndmp/ndmpd_zfs.c index 68b50ae2fd..c72a3a8ea6 100644 --- a/usr/src/cmd/ndmpd/ndmp/ndmpd_zfs.c +++ b/usr/src/cmd/ndmpd/ndmp/ndmpd_zfs.c @@ -1034,6 +1034,7 @@ ndmpd_zfs_pre_backup(ndmpd_zfs_args_t *ndmpd_zfs_args) nctxp->nc_plversion = ndmp_pl->np_plversion; nctxp->nc_plname = ndmpd_get_prop(NDMP_PLUGIN_PATH); nctxp->nc_ddata = (void *) session; + nctxp->nc_params = ndmpd_zfs_params; err = ndmp_pl->np_pre_backup(ndmp_pl, nctxp, ndmpd_zfs_args->nz_dataset); @@ -1091,6 +1092,7 @@ ndmpd_zfs_pre_restore(ndmpd_zfs_args_t *ndmpd_zfs_args) (void) memset(nctxp, 0, sizeof (ndmp_context_t)); nctxp->nc_ddata = (void *) session; + nctxp->nc_params = ndmpd_zfs_params; err = ndmp_pl->np_pre_restore(ndmp_pl, nctxp, bkpath, ndmpd_zfs_args->nz_dataset); diff --git a/usr/src/cmd/ndmpd/tlm/tlm_init.c b/usr/src/cmd/ndmpd/tlm/tlm_init.c index 7580a831fe..fc57bcad41 100644 --- a/usr/src/cmd/ndmpd/tlm/tlm_init.c +++ b/usr/src/cmd/ndmpd/tlm/tlm_init.c @@ -545,7 +545,8 @@ tlm_init(void) * but later on this needs to be removed as the * probe will happen somewhere else. */ - (void) probe_scsi(); + if (probe_scsi() < 0) + return (-1); nsa = scsi_get_adapter_count(); for (i = 0; i < nsa; i++) diff --git a/usr/src/cmd/ndmpd/tlm/tlm_lib.c b/usr/src/cmd/ndmpd/tlm/tlm_lib.c index ec9ee5f225..fa15a8e7ad 100644 --- a/usr/src/cmd/ndmpd/tlm/tlm_lib.c +++ b/usr/src/cmd/ndmpd/tlm/tlm_lib.c @@ -45,6 +45,7 @@ #include <pthread.h> #include "tlm.h" #include "tlm_proto.h" +#include <ndmpd_prop.h> #include <sys/mtio.h> #include <sys/mnttab.h> #include <sys/mntent.h> @@ -1015,6 +1016,7 @@ probe_scsi(void) char *p; int lun = 0; int sid = 0; + char *drive_type; /* Initialize the scsi adapter link */ sa->sa_link_head.sl_next = &sa->sa_link_head; @@ -1050,19 +1052,36 @@ probe_scsi(void) NDMP_LOG(LOG_DEBUG, "Tape directory read error %s", SCSI_TAPE_DIR); } else { + drive_type = ndmpd_get_prop(NDMP_DRIVE_TYPE); + + if ((strcasecmp(drive_type, "sysv") != 0) && + (strcasecmp(drive_type, "bsd") != 0)) { + NDMP_LOG(LOG_ERR, "Invalid ndmpd/drive-type value. " + "Valid values are 'sysv' and 'bsd'."); + return (-1); + } + while ((dp = readdir(dirp)) != NULL) { if ((strcmp(dp->d_name, ".") == 0) || (strcmp(dp->d_name, "..") == 0)) continue; /* Skip special modes */ - if (strpbrk(dp->d_name, "bchlmu") != 0) + if (strpbrk(dp->d_name, "chlmu") != NULL) continue; /* Pick the non-rewind device */ if (strchr(dp->d_name, 'n') == NULL) continue; + if (strcasecmp(drive_type, "sysv") == 0) { + if (strchr(dp->d_name, 'b') != NULL) + continue; + } else if (strcasecmp(drive_type, "bsd") == 0) { + if (strchr(dp->d_name, 'b') == NULL) + continue; + } + sid = atoi(dp->d_name); /* |