This is the mail archive of the
cluster-cvs@sourceware.org
mailing list for the cluster.
fence-agents: master - fence: Fusion of vmware_vi and vmware_vmruninto one agent
- From: Jan Friesse <honzaf at fedoraproject dot org>
- To: cluster-cvs-relay at redhat dot com
- Date: Tue, 13 Jan 2009 15:52:44 +0000 (UTC)
- Subject: fence-agents: master - fence: Fusion of vmware_vi and vmware_vmruninto one agent
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=commitdiff;h=ae2a0c72c654719f371de810423573d17a0bf325
Commit: ae2a0c72c654719f371de810423573d17a0bf325
Parent: 3f63c192782db7231bab6861a6396739b8f26aeb
Author: Jan Friesse <jfriesse@redhat.com>
AuthorDate: Tue Jan 13 16:52:02 2009 +0100
Committer: Jan Friesse <jfriesse@redhat.com>
CommitterDate: Tue Jan 13 16:52:02 2009 +0100
fence: Fusion of vmware_vi and vmware_vmrun into one agent
It's really sad to have 3 different agents for one type of
device. This patch deletes old ssh based vmware agent, and
replace it with fusion of vmware_vi and vmware_vmrun.
This solution is cluster aware and able to fence VMware
ESX/ESXi/VC/Server 1/Server 2 (see man page). Only one
disadvantage against old agent is, that user must install
VI Perl or VIX API to every node which do fencing. I hope
it's only small price for all benefits user will get.
---
fence/agents/vmware/Makefile | 5 +-
fence/agents/vmware/fence_vmware.py | 327 +++++++++++++++-------
fence/agents/vmware/fence_vmware_helper.pl | 240 ++++++++++++++++
fence/agents/vmware_vi/Makefile | 5 -
fence/agents/vmware_vi/fence_vmware_vi.py | 149 ----------
fence/agents/vmware_vi/fence_vmware_vi_helper.pl | 237 ----------------
fence/agents/vmware_vmrun/Makefile | 4 -
fence/agents/vmware_vmrun/fence_vmware_vmrun.py | 154 ----------
fence/man/Makefile | 1 -
fence/man/fence_vmware.8 | 134 +++++----
fence/man/fence_vmware_vmrun.8 | 137 ---------
11 files changed, 541 insertions(+), 852 deletions(-)
diff --git a/fence/agents/vmware/Makefile b/fence/agents/vmware/Makefile
index 6ed7594..6d812a5 100644
--- a/fence/agents/vmware/Makefile
+++ b/fence/agents/vmware/Makefile
@@ -1,4 +1,5 @@
-TARGET= fence_vmware
-
include ../../../make/defines.mk
+
+TARGET= fence_vmware_helper fence_vmware
+
include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index fc5618f..3f23c4c 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -1,143 +1,268 @@
#!/usr/bin/python
-#####
-##
-## The Following Agent Has Been Tested On VMware ESX 3.5 and VMware Server 1.0.7
-##
-#####
+#
+# The Following agent has been tested on:
+# vmrun 2.0.0 build-116503 (from VMware Server 2.0) against:
+# VMware ESX 3.5 (works correctly)
+# VMware Server 2.0.0 (works correctly)
+# VMware ESXi 3.5 update 2 (works correctly)
+# VMware Server 1.0.7 (works but list/status show only running VMs)
+#
+# VI Perl API 1.6 against:
+# VMware ESX 3.5
+# VMware ESXi 3.5 update 2
+# VMware Virtual Center 2.5
+#
import sys, re, pexpect
sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import *
#BEGIN_VERSION_GENERATION
-RELEASE_VERSION="New VMware Agent - test release on steroids"
+RELEASE_VERSION="VMware Agent using VI Perl API and/or VIX vmrun command"
REDHAT_COPYRIGHT=""
BUILD_DATE=""
#END_VERSION_GENERATION
-VMWARE_COMMAND="/usr/bin/vmware-cmd"
-COMMAND_PROMPT_REG="\[PEXPECT\]\$ "
-COMMAND_PROMPT_NEW="[PEXPECT]\$ "
+### CONSTANTS ####
+# VMware type is ESX/ESXi/VC
+VMWARE_TYPE_ESX=0
+# VMware type is Server 1.x
+VMWARE_TYPE_SERVER1=1
+# VMware type is Server 2.x and/or ESX 3.5 up2, ESXi 3.5 up2, VC 2.5 up2
+VMWARE_TYPE_SERVER2=2
+
+# Minimum required version of vmrun command
+VMRUN_MINIMUM_REQUIRED_VERSION=2
+
+# Default path to vmhelper command
+VMHELPER_COMMAND="fence_vmware_vi_helper"
+# Default path to vmrun command
+VMRUN_COMMAND="/usr/bin/vmrun"
+# Default type of vmware
+VMWARE_DEFAULT_TYPE="esx"
+
+#### GLOBAL VARIABLES ####
+# Internal type. One of VMWARE_TYPE_, set by #vmware_check_vmware_type
+vmware_internal_type=VMWARE_TYPE_ESX
+
+# If ESX is disconnected, say, that VM is off (don't return previous state)
+vmware_disconnected_hack=False
+
+### FUNCTIONS ####
+
+#Split string in simplified DSV format to array of items
+def dsv_split(dsv_str):
+ delimiter_c=':'
+ escape_c='\\'
+
+ res=[]
+ status=0
+ tmp_str=""
+
+ for x in dsv_str:
+ if (status==0):
+ if (x==delimiter_c):
+ res.append(tmp_str)
+ tmp_str=""
+ elif (x==escape_c):
+ status=1
+ else:
+ tmp_str+=x
+ elif (status==1):
+ if (x==delimiter_c):
+ tmp_str+=delimiter_c
+ elif (x==escape_c):
+ tmp_str+=escape_c
+ else:
+ tmp_str+=escape_c+x
+ status=0
+
+ if (tmp_str!=""):
+ res.append(tmp_str)
+
+ return res
+
+# Return string with command and additional parameters (something like vmrun -h 'host'
+def vmware_prepare_command(options,add_login_params,additional_params):
+ res=options["-e"]
+
+ if (add_login_params):
+ if (vmware_internal_type==VMWARE_TYPE_ESX):
+ res+=" --server '%s' --username '%s' --password '%s' "%(options["-a"],options["-l"],options["-p"])
+ elif (vmware_internal_type==VMWARE_TYPE_SERVER2):
+ res+=" -h 'https://%s/sdk' -u '%s' -p '%s' -T server "%(options["-a"],options["-l"],options["-p"])
+ elif (vmware_internal_type==VMWARE_TYPE_SERVER1):
+ host_name_array=options["-a"].split(':')
+
+ res+=" -h '%s' -u '%s' -p '%s' -T server1 "%(host_name_array[0],options["-l"],options["-p"])
+ if (len(host_name_array)>1):
+ res+="-P '%s' "%(host_name_array[1])
+
+ if ((options.has_key("-s")) and (vmware_internal_type==VMWARE_TYPE_ESX)):
+ res+="--datacenter '%s' "%(options["-s"])
+
+ if (additional_params!=""):
+ res+=additional_params
+
+ return res
+
+# Log message if user set verbose option
+def vmware_log(options, message):
+ if options["log"] >= LOG_MODE_VERBOSE:
+ options["debug_fh"].write(message+"\n")
+
+# Run command with timeout and parameters. Internaly uses vmware_prepare_command. Returns string
+# with output from vmrun command. If something fails (command not found, exit code is not 0), fail_usage
+# function is called (and never return).
+def vmware_run_command(options,add_login_params,additional_params,additional_timeout):
+ command=vmware_prepare_command(options,add_login_params,additional_params)
-# Start comunicating after login. Prepare good environment.
-def start_communication(conn, options):
- conn.sendline ("PS1='"+COMMAND_PROMPT_NEW+"'");
- conn.log_expect(options,COMMAND_PROMPT_REG,SHELL_TIMEOUT)
-
-# Prepare command line for vmware-cmd with parameters.
-def prepare_cmdline(conn,options,add_vm_name):
- cmd_line=VMWARE_COMMAND+" -H '"+options["-A"]+"' -U '"+options["-L"]+"' -P '"+options["-P"]+"'"
- if (add_vm_name):
- cmd_line+=" '"+options["-n"]+"'"
+ try:
+ vmware_log(options,command)
- if options.has_key("-v"):
- cmd_line+=" -v"
+ (res_output,res_code)=pexpect.run(command,SHELL_TIMEOUT+LOGIN_TIMEOUT+additional_timeout,True)
- return cmd_line
-
-def get_power_status(conn, options):
- result = ""
- try:
- start_communication(conn,options)
+ if (res_code==None):
+ fail(EC_TIMED_OUT)
+ if ((res_code!=0) and (add_login_params)):
+ vmware_log(options,res_output)
+ fail_usage("%s returned %s"%(options["-e"],res_output))
+ else:
+ vmware_log(options,res_output)
- cmd_line=prepare_cmdline(conn,options,True)
+ except pexpect.ExceptionPexpect:
+ fail_usage("Cannot run command %s"%(options["-e"]))
- cmd_line+=" getstate"
+ return res_output
- conn.sendline(cmd_line)
+def get_outlets_status(conn, options):
+ outlets={}
- conn.log_expect(options,COMMAND_PROMPT_REG,SHELL_TIMEOUT)
- status_err = re.search("vmcontrol\ error\ ([-+]?\d+)\:(.*)",conn.before.lower())
- if (status_err!=None):
- fail_usage("VMware error "+status_err.group(1)+": "+status_err.group(2))
-
- status = re.search("getstate\(\)\ =\ on",conn.before.lower())
-
- result=(status==None and "off" or "on")
-
- except pexpect.EOF:
- fail(EC_CONNECTION_LOST)
- except pexpect.TIMEOUT:
- fail(EC_TIMED_OUT)
+ if (vmware_internal_type==VMWARE_TYPE_ESX):
+ all_machines=vmware_run_command(options,True,"--operation list",0)
- return result
+ all_machines_array=all_machines.splitlines()
-def get_outlet_list(conn,options):
- result={}
+ for machine in all_machines_array:
+ machine_array=dsv_split(machine)
+ if (len(machine_array)==4):
+ if (machine_array[0] in outlets):
+ fail_usage("Failed. More machines with same name %s found!"%(machine_array[0]))
- try:
- start_communication(conn,options)
+ if (vmware_disconnected_hack):
+ outlets[machine_array[0]]=("",(
+ ((machine_array[2].lower() in ["poweredon"]) and
+ (machine_array[3].lower()=="connected"))
+ and "on" or "off"))
+ else:
+ outlets[machine_array[0]]=("",((machine_array[2].lower() in ["poweredon"]) and "on" or "off"))
- cmd_line=prepare_cmdline(conn,options,False)
- cmd_line+=" -l"
+ if ((vmware_internal_type==VMWARE_TYPE_SERVER1) or (vmware_internal_type==VMWARE_TYPE_SERVER2)):
+ running_machines=vmware_run_command(options,True,"list",0)
+ running_machines_array=running_machines.splitlines()[1:]
- conn.sendline(cmd_line)
+ if (vmware_internal_type==VMWARE_TYPE_SERVER2):
+ all_machines=vmware_run_command(options,True,"listRegisteredVM",0)
+ all_machines_array=all_machines.splitlines()[1:]
+ elif (vmware_internal_type==VMWARE_TYPE_SERVER1):
+ all_machines_array=running_machines_array
- conn.log_expect(options,COMMAND_PROMPT_REG,SHELL_TIMEOUT)
- status_err = re.search("vmcontrol\ error\ ([-+]?\d+)\:(.*)",conn.before.lower())
- if (status_err!=None):
- fail_usage("VMware error "+status_err.group(1)+": "+status_err.group(2))
+ for machine in all_machines_array:
+ if (machine!=""):
+ outlets[machine]=("",((machine in running_machines_array) and "on" or "off"))
- lines=conn.before.splitlines()
+ return outlets
- for line in lines[(options.has_key("-v") and 3 or 1):-1]:
- if (line!=""):
- result[line]=("","")
+def get_power_status(conn,options):
+ outlets=get_outlets_status(conn,options)
- except pexpect.EOF:
- fail(EC_CONNECTION_LOST)
- except pexpect.TIMEOUT:
- fail(EC_TIMED_OUT)
+ if ((vmware_internal_type==VMWARE_TYPE_SERVER2) or (vmware_internal_type==VMWARE_TYPE_ESX)):
+ if (not (options["-n"] in outlets)):
+ fail_usage("Failed: You have to enter existing name of virtual machine!")
+ else:
+ return outlets[options["-n"]][1]
- return result
+ elif (vmware_internal_type==VMWARE_TYPE_SERVER1):
+ return ((options["-n"] in outlets) and "on" or "off")
def set_power_status(conn, options):
- try:
- start_communication(conn,options)
-
- cmd_line=prepare_cmdline(conn,options,True)
+ if (vmware_internal_type==VMWARE_TYPE_ESX):
+ additional_params="--operation %s --vmname '%s'"%((options["-o"]=="on" and "on" or "off"),options["-n"])
+ elif ((vmware_internal_type==VMWARE_TYPE_SERVER1) or (vmware_internal_type==VMWARE_TYPE_SERVER2)):
+ additional_params="%s '%s'"%((options["-o"]=="on" and "start" or "stop"),options["-n"])
+ if (options["-o"]=="off"):
+ additional_params+=" hard"
- cmd_line+=" "+(options["-o"]=="on" and "start" or "stop hard")
+ vmware_run_command(options,True,additional_params,POWER_TIMEOUT)
- conn.sendline(cmd_line)
+# Returns True, if user uses supported vmrun version (currently >=2.0.0) otherwise False.
+def vmware_is_supported_vmrun_version(options):
+ vmware_help_str=vmware_run_command(options,False,"",0)
+ version_re=re.search("vmrun version (\d\.(\d[\.]*)*)",vmware_help_str.lower())
+ if (version_re==None):
+ return False # Looks like this "vmrun" is not real vmrun
- conn.log_expect(options,COMMAND_PROMPT_REG,POWER_TIMEOUT)
+ version_array=version_re.group(1).split(".")
- except pexpect.EOF:
- fail(EC_CONNECTION_LOST)
- except pexpect.TIMEOUT:
- fail(EC_TIMED_OUT)
-
+ try:
+ if (int(version_array[0])<VMRUN_MINIMUM_REQUIRED_VERSION):
+ return False
+ except Exception:
+ return False
+
+ return True
+
+# Define new options
+def vmware_define_defaults():
+ all_opt["vmware_type"]["default"]=VMWARE_DEFAULT_TYPE
+
+# Check vmware type, set vmware_internal_type to one of VMWARE_TYPE_ value and
+# options["-e"] to path (if not specified)
+def vmware_check_vmware_type(options):
+ global vmware_internal_type
+
+ options["-d"]=options["-d"].lower()
+
+ if (options["-d"]=="esx"):
+ vmware_internal_type=VMWARE_TYPE_ESX
+ if (not options.has_key("-e")):
+ options["-e"]=VMHELPER_COMMAND
+ elif (options["-d"]=="server2"):
+ vmware_internal_type=VMWARE_TYPE_SERVER2
+ if (not options.has_key("-e")):
+ options["-e"]=VMRUN_COMMAND
+ elif (options["-d"]=="server1"):
+ vmware_internal_type=VMWARE_TYPE_SERVER1
+ if (not options.has_key("-e")):
+ options["-e"]=VMRUN_COMMAND
+ else:
+ fail_usage("vmware_type can be esx,server2 or server1!")
+
+# Main agent method
def main():
- device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
- "action", "ipaddr", "login", "passwd", "passwd_script",
- "secure", "identity_file", "test" , "vmipaddr", "vmlogin",
- "vmpasswd", "port", "vmpasswd_script", "separator" ]
+ device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
+ "action", "ipaddr", "login", "passwd", "passwd_script",
+ "test", "port", "separator", "exec", "vmware_type",
+ "vmware_datacenter", "secure" ]
+
+ vmware_define_defaults()
options = check_input(device_opt, process_input(device_opt))
- ##
- ## Fence agent specific defaults
- #####
- if 0 == options.has_key("-c"):
- options["-c"] = "\$ "
-
- if 0 == options.has_key("-A"):
- options["-A"] = "localhost"
-
- options["-x"] = 1
- ##
- ## Operate the fencing device
- ####
- conn = fence_login(options)
- fence_action(conn, options, set_power_status, get_power_status, get_outlet_list)
-
- ##
- ## Logout from system
- ######
- conn.sendline("logout")
- conn.close()
+ # Default is secure connection
+ options["-x"] = 1
+
+ # Check vmware type and set path
+ vmware_check_vmware_type(options)
+
+ # Test user vmrun command version
+ if ((vmware_internal_type==VMWARE_TYPE_SERVER1) or (vmware_internal_type==VMWARE_TYPE_SERVER2)):
+ if (not (vmware_is_supported_vmrun_version(options))):
+ fail_usage("Unsupported version of vmrun command! You must use at least version %d!"%(VMRUN_MINIMUM_REQUIRED_VERSION))
+
+ # Operate the fencing device
+ fence_action(None, options, set_power_status, get_power_status, get_outlets_status)
if __name__ == "__main__":
main()
diff --git a/fence/agents/vmware/fence_vmware_helper.pl b/fence/agents/vmware/fence_vmware_helper.pl
new file mode 100644
index 0000000..eb18630
--- /dev/null
+++ b/fence/agents/vmware/fence_vmware_helper.pl
@@ -0,0 +1,240 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my ($RELEASE_VERSION, $REDHAT_COPYRIGHT, $BUILD_DATE);
+
+#BEGIN_VERSION_GENERATION
+$RELEASE_VERSION="";
+$REDHAT_COPYRIGHT="";
+$BUILD_DATE="";
+#END_VERSION_GENERATION
+
+#### FUNCTIONS #####
+# Show error message
+sub show_error {
+ print STDERR @_;
+}
+
+sub my_exit {
+ my ($exit_code)=@_;
+
+ # Disconnect from server
+ Util::disconnect();
+
+ exit $exit_code;
+}
+
+# Convert one field (string) to format acceptable by DSV. This
+# means replace any : with \: and \ with \\.
+sub convert_field_to_dsv {
+ my ($input_line)=@_;
+
+ $input_line =~ s/([\\:])/\\$1/g;
+ return $input_line
+}
+
+#### Global variables #####
+# Aditional options
+my %opts = (
+ 'operation' => {
+ type => "=s",
+ help => "The operation to perform (on,off,list). Operations on/off require name of the virtual machine",
+ default => "list",
+ required => 0,
+ },
+ 'vmname' => {
+ type => "=s",
+ help => "The name of the virtual machine",
+ required => 0,
+ },
+ 'datacenter' => {
+ type => "=s",
+ help => "The name of the datacenter",
+ required => 0,
+ }
+);
+
+#################
+##### MAIN ######
+#################
+
+# Conditional use of VIRuntime
+eval "use VMware::VIRuntime;";
+
+if ($@) {
+ show_error "Please install VI Perl API package to use this tool!\n";
+ exit 1;
+}
+
+# Parse options
+Opts::add_options(%opts);
+Opts::parse();
+Opts::validate();
+
+if (!(Opts::get_option('operation')=~/^(on|off|list)$/i)) {
+ show_error "Operation should be on, off or list!\n";
+ exit 2;
+}
+
+my $operation=lc(Opts::get_option('operation'));
+
+if (($operation ne 'list') && (!defined Opts::get_option('vmname'))) {
+ show_error "Operation on, off require vmname parameter!\n";
+ exit 2;
+}
+
+
+# Try connect to machine
+eval {
+ Util::connect();
+};
+
+if ($@) {
+ show_error "Cannot connect to server!\nVMware error:".$@;
+ exit 3;
+}
+
+my ($datacenter, $datacenter_view, $vm_views,$vm);
+# We are connected to machine
+
+# If user want's datacenter, we must first find datacenter
+my %filter=(view_type => 'VirtualMachine');
+
+if( defined (Opts::get_option('datacenter')) ) {
+ $datacenter = Opts::get_option('datacenter');
+ $datacenter_view = Vim::find_entity_view(view_type => 'Datacenter',
+ filter => { name => $datacenter });
+ if (!$datacenter_view) {
+ show_error "Cannot find datacenter ".$datacenter."!\n";
+
+ my_exit 4;
+ }
+
+ $filter{'begin_entity'}=$datacenter_view;
+}
+
+if ($operation ne 'list') {
+ $filter{'filter'}= {"config.name" => Opts::get_option('vmname')};
+}
+
+$vm_views = Vim::find_entity_views(%filter);
+
+my $found=0;
+
+# Traverse all found vm
+foreach $vm(@$vm_views) {
+ if ($operation eq 'list') {
+ if (!$vm->summary->config->template) {
+ print convert_field_to_dsv($vm->name).":".
+ convert_field_to_dsv($vm->summary->config->vmPathName).":".
+ convert_field_to_dsv($vm->runtime->powerState->val).":".
+ convert_field_to_dsv($vm->runtime->connectionState->val)."\n";
+ }
+ } elsif ($operation eq 'on') {
+ eval {
+ $vm->PowerOnVM();
+ };
+
+ if ($@) {
+ show_error "Cannot power on vm ".Opts::get_option('vmname')."!\nVMware error:".$@;
+ my_exit 6;
+ }
+ } elsif ($operation eq 'off') {
+ eval {
+ $vm->PowerOffVM();
+ };
+
+ if ($@) {
+ show_error "Cannot power off vm ".Opts::get_option('vmname')."!\nVMware error:".$@;
+ my_exit 6;
+ }
+ } else {
+ show_error "Operation should be on, off or list!\n";
+ my_exit 2;
+ }
+ $found++;
+}
+
+if ((!$found) && ($operation ne 'list')) {
+ show_error "Cannot find vm ".Opts::get_option('vmname')."!\n";
+ my_exit 5;
+}
+
+# Should be 0 -> success all, or 6 in case of error
+my_exit 0;
+
+__END__
+
+=head1 NAME
+
+fence_vmware_vi_helper - Perform list of virtual machines and
+ poweron, poweroff of operations on virtual machines.
+
+=head1 SYNOPSIS
+
+ fence_vmware_vi_helper --operation <on|off|list> [options]
+
+=head1 DESCRIPTION
+
+This VI Perl command-line utility provides an interface for
+seven common provisioning operations on one or more virtual
+machines: powering on, powering off and listing virtual mode.
+
+=head1 OPTIONS
+
+=head2 GENERAL OPTIONS
+
+=over
+
+=item B<operation>
+
+Operation to be performed. One of the following:
+
+ <on> (power on one or more virtual machines),
+ <off> (power off one or more virtual machines),
+ <list> (list virtual machines and their status)
+
+=item B<vmname>
+
+Optional. Name of the virtual machine on which the
+operation is to be performed.
+
+=item B<datacenter>
+
+Optional. Name of the datacenter for the virtual machine(s).
+Operations will be performed on all the virtual machines under the given datacenter.
+
+=back
+
+=head1 EXAMPLES
+
+Power on a virtual machine
+
+ fence_vmware_vi_helper --username administrator --password administrator --operation on
+ --vmname rhel --server win1
+
+ fence_vmware_vi_helper --username administrator --password administrator --operation on
+ --vmname rhel --server win1 --datacenter Datacenter
+
+Power off a virtual machine
+
+ fence_vmware_vi_helper --username administrator --password administrator --operation off
+ --vmname rhel --server win1
+
+ perl fence_vmware_vi_helper --username administrator --password administrator --operation off
+ --vmname rhel --server win1 --datacenter Datacenter
+
+List of virtual machines
+
+ fence_vmware_vi_helper --username administrator --password administrator --server win1
+
+ fence_vmware_vi_helper --username administrator --password administrator --server win1
+ --operation list
+
+=head1 SUPPORTED PLATFORMS
+
+All operations supported on ESX 3.0.1
+
+All operations supported on Virtual Center 2.0.1
diff --git a/fence/agents/vmware_vi/Makefile b/fence/agents/vmware_vi/Makefile
deleted file mode 100644
index e62d4c6..0000000
--- a/fence/agents/vmware_vi/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../../make/defines.mk
-
-TARGET= fence_vmware_vi_helper fence_vmware_vi
-
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/vmware_vi/fence_vmware_vi.py b/fence/agents/vmware_vi/fence_vmware_vi.py
deleted file mode 100644
index 4526b94..0000000
--- a/fence/agents/vmware_vi/fence_vmware_vi.py
+++ /dev/null
@@ -1,149 +0,0 @@
-#!/usr/bin/python
-
-#
-# The Following agent has been tested on:
-# VI Perl API 1.6 against:
-# VMware ESX 3.5
-# VMware ESXi 3.5 update 2
-# VMware Virtual Center 2.5
-#
-
-import sys, re, pexpect
-sys.path.append("@FENCEAGENTSLIBDIR@")
-from fencing import *
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION="VMware Agent using VI Perl API"
-REDHAT_COPYRIGHT=""
-BUILD_DATE=""
-#END_VERSION_GENERATION
-
-# Path to vmrun command
-VMHELPER_COMMAND="fence_vmware_vi_helper"
-
-# Return string with command and additional parameters (something like vmrun -h 'host'
-def vmware_vi_prepare_command(options,add_login_params,additional_params):
- res=VMHELPER_COMMAND
-
- if (add_login_params):
- res+=" --server '%s' --username '%s' --password '%s' "%(options["-a"],options["-l"],options["-p"])
-
- if (options.has_key("-d")):
- res+="--datacenter '%s' "%(options["-d"])
-
- if (additional_params!=""):
- res+=additional_params
-
- return res
-
-# Log message if user set verbose option
-def vmware_vi_log(options, message):
- if options["log"] >= LOG_MODE_VERBOSE:
- options["debug_fh"].write(message+"\n")
-
-# Run vmrun command with timeout and parameters. Internaly uses vmware_vix_prepare_command. Returns string
-# with output from vmrun command. If something fails (command not found, exit code is not 0), fail_usage
-# function is called (and never return).
-def vmware_vi_run_command(options,add_login_params,additional_params):
- command=vmware_vi_prepare_command(options,add_login_params,additional_params)
-
- try:
- vmware_vi_log(options,command)
-
- (res_output,res_code)=pexpect.run(command,POWER_TIMEOUT+SHELL_TIMEOUT+LOGIN_TIMEOUT,True)
-
- if (res_code==None):
- fail(EC_TIMED_OUT)
- if ((res_code!=0) and (add_login_params)):
- vmware_vi_log(options,res_output)
- fail_usage("vmware_helper returned %s"%(res_output))
- else:
- vmware_vi_log(options,res_output)
-
- except pexpect.ExceptionPexpect:
- fail_usage("Cannot run vmware_helper command %s"%(VMHELPER_COMMAND))
-
- return res_output
-
-def dsv_split(dsv_str):
- delimiter_c=':'
- escape_c='\\'
-
- res=[]
- status=0
- tmp_str=""
-
- for x in dsv_str:
- if (status==0):
- if (x==delimiter_c):
- res.append(tmp_str)
- tmp_str=""
- elif (x==escape_c):
- status=1
- else:
- tmp_str+=x
- elif (status==1):
- if (x==delimiter_c):
- tmp_str+=delimiter_c
- elif (x==escape_c):
- tmp_str+=escape_c
- else:
- tmp_str+=escape_c+x
- status=0
-
- if (tmp_str!=""):
- res.append(tmp_str)
-
- return res
-
-def get_outlets_status(conn, options):
- outlets={}
-
- all_machines=vmware_vi_run_command(options,True,"--operation list")
-
- all_machines_array=all_machines.splitlines()
-
- for machine in all_machines_array:
- machine_array=dsv_split(machine)
- if (len(machine_array)==3):
- if (machine_array[0] in outlets):
- fail_usage("Failed. More machines with same name %s found!"%(machine_array[0]))
-
- outlets[machine_array[0]]=("",((machine_array[2].lower() in ["poweredon"]) and "on" or "off"))
-
- return outlets
-
-def get_power_status(conn,options):
- outlets=get_outlets_status(conn,options)
-
- if (not (options["-n"] in outlets)):
- fail_usage("Failed: You have to enter existing name of virtual machine!")
- else:
- return outlets[options["-n"]][1]
-
-def set_power_status(conn, options):
- additional_params="--operation %s --vmname '%s'"%((options["-o"]=="on" and "on" or "off"),options["-n"])
-
- vmware_vi_run_command(options,True,additional_params)
-
-# Define new options
-def vmware_vi_define_new_opts():
- all_opt["datacenter"]={
- "getopt":"d:",
- "help":"-d <type> Datacenter",
- "order": 2}
-
-def main():
- device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
- "action", "ipaddr", "login", "passwd", "passwd_script",
- "test", "port", "separator", "datacenter" ]
-
- vmware_vi_define_new_opts()
-
- options = check_input(device_opt, process_input(device_opt))
-
- # Operate the fencing device
- fence_action(None, options, set_power_status, get_power_status, get_outlets_status)
-
-if __name__ == "__main__":
- main()
diff --git a/fence/agents/vmware_vi/fence_vmware_vi_helper.pl b/fence/agents/vmware_vi/fence_vmware_vi_helper.pl
deleted file mode 100644
index fcd4f5a..0000000
--- a/fence/agents/vmware_vi/fence_vmware_vi_helper.pl
+++ /dev/null
@@ -1,237 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-my ($RELEASE_VERSION, $REDHAT_COPYRIGHT, $BUILD_DATE);
-
-#BEGIN_VERSION_GENERATION
-$RELEASE_VERSION="";
-$REDHAT_COPYRIGHT="";
-$BUILD_DATE="";
-#END_VERSION_GENERATION
-
-#### FUNCTIONS #####
-# Show error message
-sub show_error {
- print STDERR @_;
-}
-
-sub my_exit {
- my ($exit_code)=@_;
-
- # Disconnect from server
- Util::disconnect();
-
- exit $exit_code;
-}
-
-# Convert one field (string) to format acceptable by DSV. This
-# means replace any : with \: and \ with \\.
-sub convert_field_to_dsv {
- my ($input_line)=@_;
-
- $input_line =~ s/([\\:])/\\$1/g;
- return $input_line
-}
-
-#### Global variables #####
-# Aditional options
-my %opts = (
- 'operation' => {
- type => "=s",
- help => "The operation to perform (on,off,list). Operations on/off require name of the virtual machine",
- default => "list",
- required => 0,
- },
- 'vmname' => {
- type => "=s",
- help => "The name of the virtual machine",
- required => 0,
- },
- 'datacenter' => {
- type => "=s",
- help => "The name of the datacenter",
- required => 0,
- }
-);
-
-#################
-##### MAIN ######
-#################
-
-# Conditional use of VIRuntime
-eval "use VMware::VIRuntime;";
-
-if ($@) {
- show_error "Please install VI Perl API package to use this tool!\n";
- exit 1;
-}
-
-# Parse options
-Opts::add_options(%opts);
-Opts::parse();
-Opts::validate();
-
-if (!(Opts::get_option('operation')=~/^(on|off|list)$/i)) {
- show_error "Operation should be on, off or list!\n";
- exit 2;
-}
-
-my $operation=lc(Opts::get_option('operation'));
-
-if (($operation ne 'list') && (!defined Opts::get_option('vmname'))) {
- show_error "Operation on, off require vmname parameter!\n";
- exit 2;
-}
-
-
-# Try connect to machine
-eval {
- Util::connect();
-};
-
-if ($@) {
- show_error "Cannot connect to server!\nVMware error:".$@;
- exit 3;
-}
-
-my ($datacenter, $datacenter_view, $vm_views,$vm);
-# We are connected to machine
-
-# If user want's datacenter, we must first find datacenter
-my %filter=(view_type => 'VirtualMachine');
-
-if( defined (Opts::get_option('datacenter')) ) {
- $datacenter = Opts::get_option('datacenter');
- $datacenter_view = Vim::find_entity_view(view_type => 'Datacenter',
- filter => { name => $datacenter });
- if (!$datacenter_view) {
- show_error "Cannot find datacenter ".$datacenter."!\n";
-
- my_exit 4;
- }
-
- $filter{'begin_entity'}=$datacenter_view;
-}
-
-if ($operation ne 'list') {
- $filter{'filter'}= {"config.name" => Opts::get_option('vmname')};
-}
-
-$vm_views = Vim::find_entity_views(%filter);
-
-my $found=0;
-
-# Traverse all found vm
-foreach $vm(@$vm_views) {
- if ($operation eq 'list') {
- print convert_field_to_dsv($vm->name).":".
- convert_field_to_dsv($vm->summary->config->vmPathName).":".
- convert_field_to_dsv($vm->runtime->powerState->val)."\n";
- } elsif ($operation eq 'on') {
- eval {
- $vm->PowerOnVM();
- };
-
- if ($@) {
- show_error "Cannot power on vm ".Opts::get_option('vmname')."!\nVMware error:".$@;
- my_exit 6;
- }
- } elsif ($operation eq 'off') {
- eval {
- $vm->PowerOffVM();
- };
-
- if ($@) {
- show_error "Cannot power off vm ".Opts::get_option('vmname')."!\nVMware error:".$@;
- my_exit 6;
- }
- } else {
- show_error "Operation should be on, off or list!\n";
- my_exit 2;
- }
- $found++;
-}
-
-if (!$found) {
- show_error "Cannot find vm ".Opts::get_option('vmname')."!\n";
- my_exit 5;
-}
-
-# Should be 0 -> success all, or 6 in case of error
-my_exit 0;
-
-__END__
-
-=head1 NAME
-
-fence_vmware_vi_helper - Perform list of virtual machines and
- poweron, poweroff of operations on virtual machines.
-
-=head1 SYNOPSIS
-
- fence_vmware_vi_helper --operation <on|off|list> [options]
-
-=head1 DESCRIPTION
-
-This VI Perl command-line utility provides an interface for
-seven common provisioning operations on one or more virtual
-machines: powering on, powering off and listing virtual mode.
-
-=head1 OPTIONS
-
-=head2 GENERAL OPTIONS
-
-=over
-
-=item B<operation>
-
-Operation to be performed. One of the following:
-
- <on> (power on one or more virtual machines),
- <off> (power off one or more virtual machines),
- <list> (list virtual machines and their status)
-
-=item B<vmname>
-
-Optional. Name of the virtual machine on which the
-operation is to be performed.
-
-=item B<datacenter>
-
-Optional. Name of the datacenter for the virtual machine(s).
-Operations will be performed on all the virtual machines under the given datacenter.
-
-=back
-
-=head1 EXAMPLES
-
-Power on a virtual machine
-
- fence_vmware_vi_helper --username administrator --password administrator --operation on
- --vmname rhel --server win1
-
- fence_vmware_vi_helper --username administrator --password administrator --operation on
- --vmname rhel --server win1 --datacenter Datacenter
-
-Power off a virtual machine
-
- fence_vmware_vi_helper --username administrator --password administrator --operation off
- --vmname rhel --server win1
-
- perl fence_vmware_vi_helper --username administrator --password administrator --operation off
- --vmname rhel --server win1 --datacenter Datacenter
-
-List of virtual machines
-
- fence_vmware_vi_helper --username administrator --password administrator --server win1
-
- fence_vmware_vi_helper --username administrator --password administrator --server win1
- --operation list
-
-=head1 SUPPORTED PLATFORMS
-
-All operations supported on ESX 3.0.1
-
-All operations supported on Virtual Center 2.0.1
diff --git a/fence/agents/vmware_vmrun/Makefile b/fence/agents/vmware_vmrun/Makefile
deleted file mode 100644
index 01e8d90..0000000
--- a/fence/agents/vmware_vmrun/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET= fence_vmware_vmrun
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/vmware_vmrun/fence_vmware_vmrun.py b/fence/agents/vmware_vmrun/fence_vmware_vmrun.py
deleted file mode 100644
index e51b581..0000000
--- a/fence/agents/vmware_vmrun/fence_vmware_vmrun.py
+++ /dev/null
@@ -1,154 +0,0 @@
-#!/usr/bin/python
-
-#
-# The Following agent has been tested on:
-# vmrun 2.0.0 build-116503 (from VMware Server 2.0) against:
-# VMware ESX 3.5 (works correctly)
-# VMware Server 2.0.0 (works correctly)
-# VMware ESXi 3.5 update 2 (works correctly)
-# VMware Server 1.0.7 (doesn't work)
-# Any older version of vmrun doesn't have support for ESX/ESXi
-#
-
-import sys, re, pexpect
-sys.path.append("@FENCEAGENTSLIBDIR@")
-from fencing import *
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION="VMware Agent using VIX API"
-REDHAT_COPYRIGHT=""
-BUILD_DATE=""
-#END_VERSION_GENERATION
-
-# Path to vmrun command
-VMRUN_COMMAND="/usr/bin/vmrun"
-# Default type for -T parameter of vmrun command (default is esx, can be changed with -c)
-VMWARE_DEFAULT_TYPE="esx"
-# Minimum required version of vmrun command
-VMRUN_MINIMUM_REQUIRED_VERSION=2
-
-# Return string with command and additional parameters (something like vmrun -h 'host'
-def vmware_vix_prepare_command(options,add_login_params,additional_params):
- res=options["-c"]
-
- if (add_login_params):
- res+=" -h '%s' -u '%s' -p '%s' -T '%s' "%(options["-a"],options["-l"],options["-p"],options["-d"])
-
- if (additional_params!=""):
- res+=additional_params
-
- return res
-
-# Log message if user set verbose option
-def vmware_vix_log(options, message):
- if options["log"] >= LOG_MODE_VERBOSE:
- options["debug_fh"].write(message+"\n")
-
-# Run vmrun command with timeout and parameters. Internaly uses vmware_vix_prepare_command. Returns string
-# with output from vmrun command. If something fails (command not found, exit code is not 0), fail_usage
-# function is called (and never return).
-def vmware_vix_run_command(options,add_login_params,additional_params):
- command=vmware_vix_prepare_command(options,add_login_params,additional_params)
-
- try:
- vmware_vix_log(options,command)
-
- (res_output,res_code)=pexpect.run(command,POWER_TIMEOUT+SHELL_TIMEOUT+LOGIN_TIMEOUT,True)
-
- if (res_code==None):
- fail(EC_TIMED_OUT)
- if ((res_code!=0) and (add_login_params)):
- vmware_vix_log(options,res_output)
- fail_usage("vmrun returned %s"%(res_output))
- else:
- vmware_vix_log(options,res_output)
-
- except pexpect.ExceptionPexpect:
- fail_usage(("Bad command name %s. Make sure, that you installed\nvmrun command (VIX Api). "+\
- "If you have nonstandard installation location,\ntry use -c switch.")%(options["-c"]))
-
- return res_output
-
-# Returns True, if user uses supported vmrun version (currently >=2.0.0) otherwise False.
-def vmware_vix_is_supported_vmrun_version(options):
- vmware_help_str=vmware_vix_run_command(options,False,"")
- version_re=re.search("vmrun version (\d\.(\d[\.]*)*)",vmware_help_str.lower())
- if (version_re==None):
- return False # Looks like this "vmrun" is not real vmrun
-
- version_array=version_re.group(1).split(".")
-
- try:
- if (int(version_array[0])<VMRUN_MINIMUM_REQUIRED_VERSION):
- return False
- except Exception:
- return False
-
- return True
-
-def get_outlets_status(conn, options):
- outlets={}
-
- running_machines=vmware_vix_run_command(options,True,"list")
- all_machines=vmware_vix_run_command(options,True,"listRegisteredVM")
-
- all_machines_array=all_machines.splitlines()[1:]
- running_machines_array=running_machines.splitlines()[1:]
-
- for machine in all_machines_array:
- if (machine!=""):
- outlets[machine]=("",((machine in running_machines_array) and "on" or "off"))
-
- return outlets
-
-def get_power_status(conn,options):
- outlets=get_outlets_status(conn,options)
-
- if (not (options["-n"] in outlets)):
- fail_usage("Failed: You have to enter existing name of virtual machine!")
- else:
- return outlets[options["-n"]][1]
-
-def set_power_status(conn, options):
- additional_params="%s '%s'"%((options["-o"]=="on" and "start" or "stop"),options["-n"])
- if (options["-o"]=="off"):
- additional_params+=" hard"
-
- vmware_vix_run_command(options,True,additional_params)
-
-# Define new options
-def vmware_vix_define_new_opts():
- all_opt["vmrun_cmd"]={
- "getopt":"c:",
- "help":"-c <command> Name of vmrun command (default "+VMRUN_COMMAND+")",
- "order": 2}
- all_opt["host_type"]={
- "getopt":"d:",
- "help":"-d <type> Type of VMware to connect (default "+VMWARE_DEFAULT_TYPE+")",
- "order": 2}
-
-def main():
- device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
- "action", "ipaddr", "login", "passwd", "passwd_script",
- "test", "port", "separator", "vmrun_cmd", "host_type" ]
-
- vmware_vix_define_new_opts()
-
- options = check_input(device_opt, process_input(device_opt))
-
- # Fence agent specific defaults
- if (not options.has_key("-c")):
- options["-c"]=VMRUN_COMMAND
-
- if (not options.has_key("-d")):
- options["-d"]=VMWARE_DEFAULT_TYPE
-
- # Test user vmrun command version
- if (not (vmware_vix_is_supported_vmrun_version(options))):
- fail_usage("Unsupported version of vmrun command! You must use at least version %d!"%(VMRUN_MINIMUM_REQUIRED_VERSION))
-
- # Operate the fencing device
- fence_action(None, options, set_power_status, get_power_status, get_outlets_status)
-
-if __name__ == "__main__":
- main()
diff --git a/fence/man/Makefile b/fence/man/Makefile
index 248cb58..bca7365 100644
--- a/fence/man/Makefile
+++ b/fence/man/Makefile
@@ -19,7 +19,6 @@ TARGET= fence_ack_manual.8 \
fence_vixel.8 \
fence_virsh.8 \
fence_vmware.8 \
- fence_vmware_vmrun.8 \
fence_wti.8 \
fence_xvm.8 \
fence_xvmd.8
diff --git a/fence/man/fence_vmware.8 b/fence/man/fence_vmware.8
index 6f75afa..620537b 100644
--- a/fence/man/fence_vmware.8
+++ b/fence/man/fence_vmware.8
@@ -4,69 +4,83 @@
fence_vmware - I/O Fencing agent for VMware virtual machines
.SH SYNOPSIS
-.B
+.B
fence_vmware
[\fIOPTION\fR]...
.SH DESCRIPTION
-fence_vmware is an I/O Fencing agent which can be used with the VMware ESX or
-VMware Server to fence virtual machines. It logs via ssh to a VMware ESX (or Server)
-physical machine and there run vmware-cmd, which does all work.
+fence_vmware is an I/O Fencing agent which can be used with the VMware ESX,
+VMware ESXi or VMware Server to fence virtual machines.
-By default, VMware ESX has disabled root account so you must create annother user
-account with limited permissions on VMWare ESX machine.
+Before you can use this agent, it must be installed VI Perl Toolkit or vmrun
+command on every node you want to make fencing.
-Better idea is install right version of vmware-cmd (with same API) to any other machine
-in network and use it for fencing.
+VI Perl Toolkit is preferred for VMware ESX/ESXi and Virtual Center. Vmrun
+command is only solution for VMware Server 1/2 (this command will works against
+ESX/ESXi 3.5 up2 and VC up2 too, but not cluster aware!) and is available as part of
+VMware VIX API SDK package. VI Perl and VIX API SDK are both available from
+VMware web pages (not int RHEL repository!).
-fence_vmware accepts options on the command line as well as from stdin.
-Fenced sends parameters through stdin when it execs the agent. fence_vmware
-can be run by itself with command line options. This is useful for testing
+You can specify type of VMware you are connecting to with \fB-d\fP switch
+(or \fIvmware_type\fR for stdin). Possible values are esx, server2 and server1.
+Default value is esx, which will use VI Perl. With server1 and server2, vmrun command
+is used.
+
+After you have successfully installed VI Perl Toolkit or VIX API, you should
+be able to run fence_vmware_helper (part of this agent) or vmrun command.
+This agent supports only vmrun from version 2.0.0 (VIX API 1.6.0).
+
+fence_vmware accepts options on the command line as well as from stdin.
+Fenced sends parameters through stdin when it execs the agent. fence_vmware
+can be run by itself with command line options. This is useful for testing
and for turning outlets on or off from scripts.
+.SH HOST NAME/IP ADDRESS SPECIFICATION
+Host name can include port in standard notation host_name:port.
+Specifying port isn't mandatory, but you must use it, if you try use this agent
+against VMware server 2.0.0 with default options, where https console runs on port
+8333. In case of ESX/ESXi, you don't need to specify port, because
+default configuration runs https on standard (443) port.
+
.SH OPTIONS
.TP
\fB-a\fP \fIIPaddress\fR
-IP address or hostname of machine where is vmware-cmd.
+IP address or hostname of ESX/ESXi host machine. See (see
+.SM
+.B "HOST NAME/IP ADDRESS SPECIFICATION"
+above).
.TP
-\fB-A\fP \fIIPAdress\fR
-IP adress or hostname of machine where is runing vmware. Default is localhost.
-.TP
-\fB-h\fP
+\fB-h\fP
Print out a help message describing available options, then exit.
.TP
\fB-l\fP \fIlogin\fR
-Login name of machine with vmware-cmd.
-.TP
-\fB-L\fP \fIlogin\fR
-Login name to VMware administration interface.
+Login name to VMware administration console.
.TP
\fB-o\fP \fIaction\fR
-The action required. This can be reboot (default), status, off or on.
+The action required. This can be reboot (default), status, off, on, list
+or monitor.
.TP
\fB-p\fP \fIpassword\fR
-Password for login or for passphrase for machine with vmware-cmd.
-.TP
-\fB-P\fP \fIpassword\fR
-Password for login to VMware administration interface.
+Password for login for VMware administration console.
.TP
-\fB-B\fP \fIscript\fR
-Script to run to retrieve password for machine with vmware-cmd.
-.TP
-\fB-R\fP \fIscript\fR
-Script to run to retrieve password for VMware administration interface.
+\fB-S\fP \fIscript\fR
+Script to run to retrieve password for VMware administration console.
.TP
\fB-n\fP \fIname\fR
-Name of virtual machine to fence (ie. /vmfs/volumes/48bfcbd1-4624461c-8250-0015c5f3ef0f/Rhel/Rhel.vmx)
+Name of virtual machine to fence (ie. "test" for ESX with VI Perl or
+"[datastore1] test/test.vmx" for Server 2) which is returned by list command.
.TP
-\fB-x\fP
-Use secure connection over ssh (this is default, and can't be disabled)
+\fB-e\fP \fIcommand\fR
+Location of fence_vmware_helper or vmrun command. Default is fence_vmware_helper or
+/usr/bin/vmrun, but if you are using nonstandard location, you may find this switch useful.
.TP
-\fB-k\fP \fIfilename\fR
-Identity file (private key) for ssh
+\fB-d\fP \fItype\fR
+Type of VMware product you are trying to connect. This can be esx, server1 or server2.
.TP
-\fB-T\fP
-Test only. Answer NO to the confirmation prompt instead of YES.
+\fB-s\fP \fIdatacenter\fR
+VMware datacenter to use. This can be used to filter guests to operate. Without specifying,
+guests from all datacenters will be used. Parameter can be used only with VI Perl helper
+(type is esx).
.TP
\fB-v\fP
Verbose. Record session to stdout, or debug file if specified (see -D).
@@ -83,43 +97,39 @@ Print out a version message, then exit.
This option is used by fence_node(8) and is ignored by fence_vmware.
.TP
\fIipaddr = < hostname | ip >\fR
-IP address or hostname of machine where is vmware-cmd.
-.TP
-\fIvmipaddr = < hostname | ip >\fR
-IP adress or hostname of machine where is runing vmware. Default is localhost.
+IP address or hostname of ESX/ESXi host machine. See (see
+.SM
+.B "HOST NAME/IP ADDRESS SPECIFICATION"
+above).
.TP
\fIlogin = < param >\fR
-Login name of machine with vmware-cmd.
-.TP
-\fIvmlogin = < param >\fR
-Login name to VMware administration interface.
+Login name to VMware administration console.
.TP
\fIoption = < param >\fR
-The action required. This can be reboot (default), status, off or on.
+The action required. This can be reboot (default), status, off, on, list
+or monitor.
.TP
\fIpasswd = < param >\fR
-Password for login or for passphrase for machine with vmware-cmd.
-.TP
-\fIvmpasswd = < param >\fR
-Password for login to VMware administration interface.
+Password for login for VMware administration console.
.TP
\fIpasswd_script = < param >\fR
-Script to run to retrieve password for machine with vmware-cmd.
-.TP
-\fIvmpasswd_script = < param >\fR
-Script to run to retrieve password for VMware administration interface.
+Script to run to retrieve password for VMware administration console.
.TP
\fIport = < param >\fR
-Name of virtual machine to fence (ie. /vmfs/volumes/48bfcbd1-4624461c-8250-0015c5f3ef0f/Rhel/Rhel.vmx)
+Name of virtual machine to fence (ie. "test" for ESX with VI Perl or
+"[datastore1] test/test.vmx" for Server 2) which is returned by list command.
+.TP
+\fIexec = < param >\fR
+Location of fence_vmware_helper or vmrun command. Default is fence_vmware_helper or
+/usr/bin/vmrun, but if you are using nonstandard location, you may find this switch useful.
.TP
-\fIsecure = < param >\fR
-Use secure connection over ssh (this is default, and can't be disabled)
-.TP
-\fIidentity_file = < param >\fR
-Identity file (private key) for ssh
+\fIvmware_type = < param >\fR
+Type of VMware product you are trying to connect. This can be esx, server1 or server2.
.TP
-\fItest = < param >\fR
-Test only. Answer NO to the confirmation prompt instead of YES.
+\fIvmware_datacenter = < param >\fR
+VMware datacenter to use. This can be used to filter guests to operate. Without specifying,
+guests from all datacenters will be used. Parameter can be used only with VI Perl helper
+(type is esx).
.TP
\fIverbose = < param >\fR
Verbose. Record session to stdout, or debug file if specified (see debug).
diff --git a/fence/man/fence_vmware_vmrun.8 b/fence/man/fence_vmware_vmrun.8
deleted file mode 100644
index dcf4a78..0000000
--- a/fence/man/fence_vmware_vmrun.8
+++ /dev/null
@@ -1,137 +0,0 @@
-.TH fence_vmware_vmrun 8
-
-.SH NAME
-fence_vmware_vmrun - Another I/O Fencing agent for VMware virtual machines
-
-.SH SYNOPSIS
-.B
-fence_vmware_vmrun
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_vmware_vmrun is an I/O Fencing agent which can be used with the VMware ESX,
-VMware ESXi or VMware Server to fence virtual machines. It is based on different
-idea than fence_vmware and don't need to make ssh connection to ESX server. This
-is main advantage, because ESXi doesn't have remote ssh administration console.
-
-Before you can use this agent, it must be installed vmrun command on every node
-you want to make fencing. Vmrun command is available as part of VMware VIX API
-SDK package, which is available from VMware web pages (not in official RHEL
-repository!). After you have successfully installed VIX API, you should be able
-to run vmrun command. This agent supports only vmrun from version 2.0.0 (VIX API
-1.6.0).
-
-fence_vmware_vmrun accepts options on the command line as well as from stdin.
-Fenced sends parameters through stdin when it execs the agent. fence_vmware_vmrun
-can be run by itself with command line options. This is useful for testing
-and for turning outlets on or off from scripts.
-
-.SH HOST NAME/IP ADDRESS SPECIFICATION
-Host name may be entered in many ways and this string is forwarded directly to
-vmrun command. Basic usage is protocol://host_name:[port]/sdk. If you want
-secure (https) connection, just use https as protocol, otherwise use http
-(this is reason, why agent doesn't have any secure switch). Port isn't
-mandatory, but you must use it, if you try use this agent against VMware
-server 2.0.0 with default options, where https console runs on port 8333 and
-http on 8222. In case of ESX/ESXi, you don't need to specify port, because
-default configuration runs https on standard (443) port.
-
-Don't forget to add /sdk suffix, otherwise agent will not work!
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fR
-IP address or hostname of ESX/ESXi host machine. See (see
-.SM
-.B "HOST NAME/IP ADDRESS SPECIFICATION"
-above).
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fR
-Login name to VMware administration console.
-.TP
-\fB-o\fP \fIaction\fR
-The action required. This can be reboot (default), status, off, on, list
-or monitor.
-.TP
-\fB-p\fP \fIpassword\fR
-Password for login for VMware administration console.
-.TP
-\fB-S\fP \fIscript\fR
-Script to run to retrieve password for VMware administration console.
-.TP
-\fB-n\fP \fIname\fR
-Name of virtual machine to fence (ie.[datastore1] test/test.vmx) which
-is returned by list command.
-.TP
-\fB-c\fP \fIcommand\fR
-Location of vmrun command. Default is /usr/bin/vmrun, but if you are using
-nonstandard location, you may find this switch useful.
-.TP
-\fB-d\fP \fItype\fR
-Type of VMware product you are trying to connect. This is directly forwarded
-to vmrun command as -T switch. Default is esx, which is internally alias
-for server (2.0.x) , which use same VIX API as ESX and ESXi.
-.TP
-\fB-T\fP
-Test only. Answer NO to the confirmation prompt instead of YES.
-.TP
-\fB-v\fP
-Verbose. Record session to stdout, or debug file if specified (see -D).
-.TP
-\fB-D\fP
-Specifies file, where will be written debug messages from session.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_vmware_vmrun.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of ESX/ESXi host machine. See (see
-.SM
-.B "HOST NAME/IP ADDRESS SPECIFICATION"
-above).
-.TP
-\fIlogin = < param >\fR
-Login name to VMware administration console.
-.TP
-\fIoption = < param >\fR
-The action required. This can be reboot (default), status, off, on, list
-or monitor.
-.TP
-\fIpasswd = < param >\fR
-Password for login for VMware administration console.
-.TP
-\fIpasswd_script = < param >\fR
-Script to run to retrieve password for VMware administration console.
-.TP
-\fIport = < param >\fR
-Name of virtual machine to fence (ie.[datastore1] test/test.vmx) which
-is returned by list command.
-.TP
-\fIvmrun_cmd = < param >\fR
-Location of vmrun command. Default is /usr/bin/vmrun, but if you are using
-nonstandard location, you may find this switch useful.
-.TP
-\fIhost_type = < param >\fR
-Type of VMware product you are trying to connect. This is directly forwarded
-to vmrun command as -T switch. Default is esx, which is internally alias
-for server (2.0.x) , which use same VIX API as ESX and ESXi.
-.TP
-\fItest = < param >\fR
-Test only. Answer NO to the confirmation prompt instead of YES.
-.TP
-\fIverbose = < param >\fR
-Verbose. Record session to stdout, or debug file if specified (see debug).
-.TP
-\fIdebug = < param >\fR
-Specifies file, where will be written debug messages from session.
-
-.SH SEE ALSO
-fence(8), fence_node(8), fence_vmware(8)