6.0
Table Of Contents
- vSphere SDK for Perl Programming Guide
- Contents
- Getting Started with vSphere SDK for Perl
- Writing vSphere SDK for Perl Scripts
- Refining vSphere SDK for Perl Scripts
- Creating and Using Filters
- Filtering Views Selectively Using Properties
- Retrieving the ServiceInstance Object on a vSphere Host
- Saving and Using Sessions
- Using Multiple Sessions
- Learning About Object Structure Using Data::Dumper
- Specifying Untyped Arguments in Scheduled Tasks and Callbacks
- Using Advanced Subroutines
- vSphere SDK for Perl Subroutine Reference
- Web Services for Management Perl Library
- Credential Store Perl Library
VMware, Inc. 11
Chapter 1 Getting Started with vSphere SDK for Perl
3FollowtheseprogrammingconventionswhenyoumodifyorcreatevSphereSDKforPerlscripts:
Useparameternamesfollowedbyparametervalues,asfollows:
Vim::<subroutine>(<parameter_name>=><value>, <parameter_name>=><value> );
Util::<subroutine>(<parameter_name>=><value>, <parameter_name>=><value> );
Opts::<subroutine>(<parameter_name>=><value>, <parameter_name>=><value> );
UsetheoptionsinTable 1‐3,“OptionsAvailableforAllSDKforPerlCommands,”onpage 16to
specifyconnectioninformation.
Usethemechanismdiscussedin“Step2:(Optional)DefineScript‐SpecificCommand‐LineOptions”
onpage 20forspecifyingadditionalscript‐specificoptions.
Common vSphere SDK for Perl Tasks
ThevSphereSDKforPerlincludesutilityapplicationsandsamplescriptsforcommonadministrationtasks.
Sometasksrequireadditionalscripting.SeeChapter 2,“WritingvSphereSDKforPerlScripts,”onpage 19.
vSphere SDK for Perl Programming Conventions
SeveralprogrammingconventionsaredifferentthanyoumightexpectbecausetheSDKinteractswithaserver
usingSOAP/WSDL.
Booleandatatypes–SDKapplicationssendandreceiveBooleanvaluesasfollows:
Input(sendingfromtheclientapplication):
Source Description
“WritingvSphereSDKforPerlScripts”on
page 19.
In‐depthdiscussionofscriptsthatincludesanexample.
Chapter 4,“vSphereSDKforPerl
SubroutineReference,”onpage 41.
ReferencetovSphereSDKforPerlsubroutines.
“WebServicesforManagementPerl
Library”onpage 51.
AllowsyoutowritescriptsthatretrieveCIMdatafromthe
ESX/ESXihostusingCIMOM,aservicethatprovidesstandardCIM
managementfunctionsoveraWBEM(Web‐BasedEnterprise
Management).
“CredentialStorePerlLibrary”onpage 61. AllowsvSphereSDKforPerlapplicationstomanagethevSphere
credentialstore.
vSphereAPIReferencedocumentation. Referencetotheserver‐sideobjectyourscriptinteractswith.
Table 1-1. Common Administrative Tasks and SDK Utilities
Task Script Location
Discovery(loggingin) connect.pl /apps/general
Performancemonitoring viperformance.pl(retrieves
performancecountersfromhost)
/apps/performance
Virtualmachinepoweroperations vmcontrol.pl /apps/vm
Virtualmachinesnapshotandrestorefunctionality vmsnapshot.pl,snapshotmanager.pl /apps/vm
Virtualmachinemigration vmmigrate.pl /apps/vm
Hostoperations,forexample,addingastandalone
hosttoavCenterServersystem,shuttingdownand
rebootingahost,andsoon
hostops.pl /apps/host
Viewingorchanging
ofCPUormemoryshare
allocationonavirtualmachine
sharesmanager.pl /apps/vm