warn "$ME: failed to close standard output: $!\n";
$? ||= 1;
}
# Get the program name from $0 and strip directory names
$_=$0;
s/.*\///;
my $pname = $_;
# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and
# "#END_VERSION_GENERATION" It is generated by the Makefile
#BEGIN_VERSION_GENERATION
$RELEASE_VERSION="";
$REDHAT_COPYRIGHT="";
$BUILD_DATE="";
#END_VERSION_GENERATION
$comm_program = s3270;
$debug = 0;
$max_loops = 10;
sub usage
{
print "Usage:\n";
print "\n";
print "$pname [options]\n";
print "\n";
print "Options:\n";
print " -a <ip> IP address or hostname of the physical s390\n";
print " -h usage\n";
print " -o metadata print XML metadata for fence agent\n";
print " -u <string> userid of the virtual machine to fence\n";
print " -p <string> Password\n";
print " -S <path> Script to run to retrieve login password\n";
print " -q quiet mode\n";
print " -r <devnum> ipl device <devnum>\n";
print " -V Version\n";
exit 0;
}
sub fail
{
($msg)=@_;
print "failed: " . $msg . "\n" unless defined $opt_q;
exit 1;
}
sub fail_usage
{
($msg)=@_;
print stderr $msg."\n" if $msg;
print stderr "Please use '-h' for usage.\n";
exit 1;
}
sub version
{
print "$pname $RELEASE_VERSION $BUILD_DATE\n";
print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT );
exit 0;
}
sub print_metadata
{
print '<?xml version="1.0" ?>
<resource-agent name="fence_zvm" shortdesc="I/O Fencing agent for GFS on s390 and zSeries VM clusters" >
<longdesc>
fence_zvm is an I/O Fencing agent used on a GFS virtual machine in a s390 or zSeries VM cluster. It uses the s3270 program to log the specified virtual machine out of VM. For fence_zvm to execute correctly, you must have s3270 in your PATH.
</longdesc>
<vendor-url>http://www.ibm.com</vendor-url>
<parameters>
<parameter name="ipaddr" unique="1" required="1">
<getopt mixed="-a <ip>" />
<content type="string" />
<shortdesc lang="en">IP Address or Hostname</shortdesc>
</parameter>
<parameter name="userid" unique="1" required="1">
<getopt mixed="-u <userid>" />
<content type="string" />
<shortdesc lang="en">Userid of the virtual machine to fence</shortdesc>
</parameter>
<parameter name="passwd" unique="1" required="0">
<getopt mixed="-p <password>" />
<content type="string" />
<shortdesc lang="en">Login password or passphrase</shortdesc>