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 # POST 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 ndmp_fh_add_dir {
  53         my $interface = "NDMP_FH_ADD_DIR";
  54         my %args = ('fs',$fs_name,'option',$option,'inf',$interface);
  55         ndmp_execute::ndmp_execute_cli(\%args);
  56 }
  57 sub ndmp_fh_add_file {
  58         my $interface = "NDMP_FH_ADD_FILE";
  59         my %args = ('fs',$fs_name,'option',$option,'inf',$interface);
  60         ndmp_execute::ndmp_execute_cli(\%args);
  61 }
  62 sub ndmp_fh_add_node {
  63         my $interface = "NDMP_FH_ADD_NODE";
  64         my %args = ('fs',$fs_name,'option',$option,'inf',$interface);
  65         ndmp_execute::ndmp_execute_cli(\%args);
  66 }
  67 sub ndmp_recovery_failed_not_found {
  68         my $interface = "NDMP_LOG_FILE";
  69         my $sub_msg = "NDMP_RECOVERY_FAILED_NOT_FOUND";
  70         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'sub_msg',$sub_msg);
  71         ndmp_execute::ndmp_execute_cli(\%args);
  72 }
  73 sub ndmp_recovery_failed_no_directory {
  74         my $interface = "NDMP_LOG_FILE";
  75         my $sub_msg = "NDMP_RECOVERY_FAILED_NO_DIRECTORY";
  76         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'sub_msg',$sub_msg);
  77         ndmp_execute::ndmp_execute_cli(\%args);
  78 }
  79 sub ndmp_recovery_failed_permission {
  80         my $interface = "NDMP_LOG_FILE";
  81         my $sub_msg = "NDMP_RECOVERY_FAILED_PERMISSION";
  82         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'sub_msg',$sub_msg);
  83         ndmp_execute::ndmp_execute_cli(\%args);
  84 }
  85 sub ndmp_recovery_successful {
  86         my $interface = "NDMP_LOG_FILE";
  87         my $sub_msg = "NDMP_RECOVERY_SUCCESSFUL";
  88         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'sub_msg',$sub_msg);
  89         ndmp_execute::ndmp_execute_cli(\%args);
  90 }
  91 sub ndmp_log_message_ndmp_log_error {
  92         my $interface = "NDMP_LOG_MESSAGE";
  93         my $sub_msg = "NDMP_LOG_ERROR";
  94         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'sub_msg',$sub_msg);
  95         ndmp_execute::ndmp_execute_cli(\%args);
  96 }
  97 sub ndmp_log_message_ndmp_log_normal {
  98         my $interface = "NDMP_LOG_MESSAGE";
  99         my $sub_msg = "NDMP_LOG_NORMAL";
 100         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'sub_msg',$sub_msg);
 101         ndmp_execute::ndmp_execute_cli(\%args);
 102 }
 103 sub notify_connection_status_ndmp_connected {
 104         my $interface = "NDMP_NOTIFY_CONNECTION_STATUS";
 105         my $sub_msg = "NDMP_CONNECTED";
 106         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'sub_msg',$sub_msg);
 107         ndmp_execute::ndmp_execute_cli(\%args);
 108 }
 109 sub notify_connection_status_ndmp_shutdown {
 110         my $interface = "NDMP_NOTIFY_CONNECTION_STATUS";
 111         my $sub_msg = "NDMP_SHUTDOWN";
 112         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'sub_msg',$sub_msg);
 113         ndmp_execute::ndmp_execute_cli(\%args);
 114 }
 115 sub notify_data_halt_successful {
 116         my $interface = "NDMP_NOTIFY_DATA_HALTED";
 117         my $sub_msg = "NDMP_DATA_HALT_SUCCESSFUL";
 118         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'sub_msg',$sub_msg);
 119         ndmp_execute::ndmp_execute_cli(\%args);
 120 }
 121 sub notify_mover_halt_aborted {
 122         my $interface = "NDMP_NOTIFY_MOVER_HALTED";
 123         my $sub_msg = "NDMP_MOVER_HALT_ABORTED";
 124         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'sub_msg',$sub_msg);
 125         ndmp_execute::ndmp_execute_cli(\%args);
 126 }
 127 sub notify_mover_halt_connection_closed {
 128         my $interface = "NDMP_NOTIFY_MOVER_HALTED";
 129         my $sub_msg = "NDMP_MOVER_HALT_CONNECT_CLOSED";
 130         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'sub_msg',$sub_msg);
 131         ndmp_execute::ndmp_execute_cli(\%args);
 132 }
 133 sub notify_mover_pause_eow {
 134         my $interface = "NDMP_NOTIFY_MOVER_PAUSED";
 135         my $sub_msg = "NDMP_MOVER_PAUSE_EOW";
 136         my %args = ('fs',$fs_name,'option',$option,'inf',$interface,'sub_msg',$sub_msg);
 137         ndmp_execute::ndmp_execute_cli(\%args);
 138 }
 139 1;