1 #
   2 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
   3 # Use is subject to license terms.
   4 #
   5 
   6 #
   7 # BSD 3 Clause License
   8 #
   9 # Redistribution and use in source and binary forms, with or without
  10 # modification, are permitted provided that the following conditions
  11 # are met:
  12 #       - Redistributions of source code must retain the above copyright
  13 #         notice, this list of conditions and the following disclaimer.
  14 #
  15 #       - Redistributions in binary form must reproduce the above copyright
  16 #         notice, this list of conditions and the following disclaimer in
  17 #         the documentation and/or other materials provided with the
  18 #         distribution.
  19 #
  20 #       - Neither the name of Sun Microsystems, Inc. nor the
  21 #         names of its contributors may be used to endorse or promote products
  22 #         derived from this software without specific prior written permission.
  23 #
  24 # THIS SOFTWARE IS PROVIDED BY SUN MICROSYSTEMS, INC. "AS IS" AND ANY
  25 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  26 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27 # DISCLAIMED. IN NO EVENT SHALL SUN MICROSYSTEMS, INC. BE LIABLE FOR ANY
  28 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  29 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES
  30 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  31 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  32 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  33 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34 #
  35 
  36 #
  37 # This file contains all the sub routines for the 
  38 # DATA interface methods. Each Method tests different
  39 # error conditions depending on the input file
  40 #
  41 #
  42 # Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  43 #
  44 
  45 use strict;
  46 use warnings;
  47 
  48 our $log_flag = 1;
  49 our $fs_name = $ENV{'NDMP_FS'};
  50 our $option = "cli";
  51 
  52 sub data_abort_ise {
  53         my $interface = "data_abort";
  54         my $error = "NDMP_ILLEGAL_STATE_ERR";
  55         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
  56         ndmp_execute::ndmp_execute_cli(\%args);
  57 }
  58 sub data_abort_nne {
  59         my $interface = "data_abort";
  60         my $error = "NDMP_NO_ERR";
  61         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
  62         ndmp_execute::ndmp_execute_cli(\%args);
  63 }
  64 sub data_abort_nae {
  65         my $interface = "data_abort";
  66         my $error = "NDMP_NOT_AUTHORIZED_ERR";
  67         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
  68         ndmp_execute::ndmp_execute_cli(\%args);
  69 }
  70 sub data_connect_ise {
  71         my $interface = "data_connect";
  72         my $error = "NDMP_ILLEGAL_STATE_ERR";
  73         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
  74         ndmp_execute::ndmp_execute_cli(\%args);
  75 }
  76 sub data_connect_nne {
  77         my $interface = "data_connect";
  78         my $error = "NDMP_NO_ERR";
  79         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
  80         ndmp_execute::ndmp_execute_cli(\%args);
  81         $args{ 'err' } = "";
  82         ndmp_execute::ndmp_execute_cli(\%args);
  83 }
  84 sub data_connect_nae {
  85         my $interface = "data_connect";
  86         my $error = "NDMP_NOT_AUTHORIZED_ERR";
  87         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
  88         ndmp_execute::ndmp_execute_cli(\%args);
  89 }
  90 
  91 sub data_connect_iae {
  92         my $interface = "data_connect";
  93         my $error = "NDMP_ILLEGAL_ARGS_ERR";
  94         my $addr_type = "NDMP_ADDR_IPC";
  95         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error,'addr_type',$addr_type);
  96         ndmp_execute::ndmp_execute_cli(\%args);
  97 
  98 }
  99 sub data_get_env_ise {
 100         my $interface = "data_get_env";
 101         my $error = "NDMP_ILLEGAL_STATE_ERR";
 102         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
 103         ndmp_execute::ndmp_execute_cli(\%args);
 104 }
 105 sub data_get_env_nae {
 106         my $interface = "data_get_env";
 107         my $error = "NDMP_NOT_AUTHORIZED_ERR";
 108         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
 109         ndmp_execute::ndmp_execute_cli(\%args);
 110 }
 111 sub data_get_env_nne {
 112         my $interface = "data_get_env";
 113         my $error = "NDMP_NO_ERR";
 114         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
 115         ndmp_execute::ndmp_execute_cli(\%args);
 116 }
 117 sub data_get_state_nae {
 118         my $interface = "data_get_state";
 119         my $error = "NDMP_NOT_AUTHORIZED_ERR";
 120         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
 121         ndmp_execute::ndmp_execute_cli(\%args);
 122 }
 123 sub data_get_state_nne {
 124         my $interface = "data_get_state";
 125         my $error = "NDMP_NO_ERR";
 126         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
 127         ndmp_execute::ndmp_execute_cli(\%args);
 128 }
 129 sub data_start_backup_ise {
 130         my $interface = "data_start_backup";
 131         my $error = "NDMP_ILLEGAL_STATE_ERR";
 132         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
 133         ndmp_execute::ndmp_execute_cli(\%args);
 134 }
 135 sub data_start_backup_nne {
 136         my $interface = "data_start_backup";
 137         my $error = "NDMP_NO_ERR";
 138         my @butype = ("tar","dump");
 139         my $backup_type = "tar";
 140         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error,'backup_type',$backup_type);
 141         foreach $backup_type (@butype) {
 142                 $args{'backup_type'} = $backup_type;
 143                 ndmp_execute::ndmp_execute_cli(\%args);
 144         }
 145 }
 146 sub data_start_backup_iae {
 147         my $interface = "data_start_backup";
 148         my $error = "NDMP_ILLEGAL_ARGS_ERR";
 149         my $backup_type = "cpio";
 150         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error,'backup_type',$backup_type);
 151         ndmp_execute::ndmp_execute_cli(\%args);
 152 }
 153 sub data_start_backup_nae {
 154         my $interface = "data_start_backup";
 155         my $error = "NDMP_NOT_AUTHORIZED_ERR";
 156         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
 157         ndmp_execute::ndmp_execute_cli(\%args);
 158 }
 159 sub data_start_recover_ise {
 160         my $interface = "data_start_recover";
 161         my $error = "NDMP_ILLEGAL_STATE_ERR";
 162         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
 163         ndmp_execute::ndmp_execute_cli(\%args);
 164 }
 165 sub data_start_recover_nne {
 166         my $interface = "data_start_recover";
 167         my $error = "NDMP_NO_ERR";
 168         my @butype = ("tar","dump");
 169         my $backup_type = "tar";
 170         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error,'backup_type',$backup_type);
 171         foreach $backup_type (@butype) {
 172                 $args{'backup_type'} = $backup_type;
 173                 ndmp_execute::ndmp_execute_cli(\%args);
 174         }
 175 }
 176 sub data_start_recover_nae {
 177         my $interface = "data_start_recover";
 178         my $error = "NDMP_NOT_AUTHORIZED_ERR";
 179         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
 180         ndmp_execute::ndmp_execute_cli(\%args);
 181 }
 182 sub data_start_recover_iae {
 183         my $interface = "data_start_recover";
 184         my $error = "NDMP_ILLEGAL_ARGS_ERR";
 185         my $backup_type = "cpio";
 186         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error,'backup_type',$backup_type);
 187         ndmp_execute::ndmp_execute_cli(\%args);
 188 }
 189 sub data_start_recover_filehist_nse {
 190         my $interface = "data_start_recover_filehist";
 191         my $error = "NDMP_NOT_SUPPORTED_ERR";
 192         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
 193         ndmp_execute::ndmp_execute_cli(\%args);
 194 }
 195 sub data_stop_ise {
 196         my $interface = "data_stop";
 197         my $error = "NDMP_ILLEGAL_STATE_ERR";
 198         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
 199         ndmp_execute::ndmp_execute_cli(\%args);
 200 }
 201 sub data_stop_nne {
 202         my $interface = "data_stop";
 203         my $error = "NDMP_NO_ERR";
 204         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
 205         ndmp_execute::ndmp_execute_cli(\%args);
 206 }
 207 sub data_stop_nae {
 208         my $interface = "data_stop";
 209         my $error = "NDMP_NOT_AUTHORIZED_ERR";
 210         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
 211         ndmp_execute::ndmp_execute_cli(\%args);
 212 }
 213 sub data_listen_iae {
 214         my $interface = "data_listen";
 215         my $error = "NDMP_ILLEGAL_ARGS_ERR";
 216         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
 217         ndmp_execute::ndmp_execute_cli(\%args);
 218 }
 219 sub data_listen_ise {
 220         my $interface = "data_listen";
 221         my $error = "NDMP_ILLEGAL_STATE_ERR";
 222         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
 223         ndmp_execute::ndmp_execute_cli(\%args);
 224 }
 225 sub data_listen_nne {
 226         my $interface = "data_listen";
 227         my $error = "NDMP_NO_ERR";
 228         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'err',$error);
 229         ndmp_execute::ndmp_execute_cli(\%args);
 230 
 231 }
 232 
 233 1;