cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2047
Views
0
Helpful
0
Comments
Orf Gelbrich
Cisco Employee
Cisco Employee
Task NameInstall / Upgrade Vmware Tools
Description
Prerequisites
  1. Tested on 5.4
CategoryWorkflow
ComponentsvSphere 5.x
User Inputs

Instructions for Regular Workflow Use:

  1. Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
  2. Unzip the file on your computer. Should end up with a .WFD file.
  3. Log in to UCS Director as a user that has "system-admin" privileges.
  4. Navigate to "Policies-->Orchestration" and click on "Import".
  5. Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
  6. Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
  7. Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
  8. Click "Submit".
  9. A new folder should appear in "Policies-->Orchestration" that contains the imported workflow. You will now need to update the included tasks with information about the specific environment.

Thanks goes out to Phani Penmethsa

The request to create this via custom task:

Unknown.png

The workflow and custom task:

Screen Shot 2015-07-22 at 7.26.39 PM.png

The location:

Screen Shot 2015-07-22 at 7.27.00 PM.png

User Input:

Screen Shot 2015-07-22 at 7.27.17 PM.png

The Code for the Custom Task:

importPackage(java.net);

importPackage(javax.xml.rpc);

importPackage(com.vmware.vim);

importPackage(com.cloupia.service.cIM.inframgr);

importPackage(com.cloupia.lib.cIaaS.vmware);

importPackage(com.vmware.vim25);

importPackage(com.vmware.vim25.mo);

importPackage(java.lang);

var vmid=input.vmware;

var api=ctxt.getAPI();

var gvm=api.getVMBasicInfo(vmid);

logger.addInfo("GVM" + gvm);

var accountName = gvm.getAccountName();

var vmname=gvm.getInstanceId();

logger.addInfo("ACCOUNT NAME" +accountName);

logger.addInfo("VMWARE NAME" +vmname);

try {

logger.addInfo("Inside try ");

var account = InfraPersistenceUtil.getAccount(accountName);

logger.addInfo("ACCOUNT" + account);

var si = new VCenterConnectionManager(account).getServiceInstance();

logger.addInfo("SERVICEINSTANCE" + si);

var  rootFolder = si.getRootFolder();

var vm=new InventoryNavigator(rootFolder).searchManagedEntity("VirtualMachine", vmname);

logger.addInfo("VIRTUAL MACHINE" + vm);

var harwarelist=vm.getConfig().getHardware().getDevice();

var toolrunninnstatus=vm.getGuest().getToolsRunningStatus();

logger.addInfo("TOOL STATUS" + toolrunninnstatus);

var cdRom = null;

for(var i=0;i<harwarelist.length;i++){

logger.addInfo("HARDWARE:" + harwarelist[i]);

if(harwarelist[i] instanceof VirtualCdrom){

cdRom = harwarelist[i];

}

}

if(cdRom == null)

  throw new Exception("CD/DVD not found");

if(toolrunninnstatus == "guestToolsRunning"){

logger.addInfo("Inside if ");

vm.upgradeTools_Task("");

}

else{

logger.addInfo("Inside else ");

vm.mountToolsInstaller();

}

} catch (e) {

logger.addError(e);

ctxt.setFailed("CD/DVD drive not found");

ctxt.exit();

}

The run of the workflow:

Service Request ID: 5899

Workflow Inputs:

- VM ID

Nov 24, 2015 12:31:26 UTC Request submitted

Nov 24, 2015 12:31:31 UTC Executing workflow item number 1

Nov 24, 2015 12:31:31 UTC Completed workflow item number 0, with status Completed

Nov 24, 2015 12:31:35 UTC Executing workflow item number 2

Nov 24, 2015 12:31:35 UTC Trigger context executeWorkFlowStep called

Nov 24, 2015 12:31:35 UTC Executing custom action Upgrade or Install VMware tools (custom_Install Or Upgrade VM Tool custom task)

Nov 24, 2015 12:31:35 UTC Executing custom action Upgrade or Install VMware tools (custom_Install Or Upgrade VM Tool custom task)

Nov 24, 2015 12:31:35 UTC Executing custom script for Install Or Upgrade VM Tool custom task

Nov 24, 2015 12:31:39 UTC GVMcom.cloupia.model.cIM.GenericVM@4c302d7f

Nov 24, 2015 12:31:39 UTC ACCOUNT NAMEDallas

Nov 24, 2015 12:31:39 UTC VMWARE NAMEPRD-Win1-01

Nov 24, 2015 12:31:39 UTC Inside try

Nov 24, 2015 12:31:39 UTC ACCOUNTAccount: Name:Dallas, vServer:172.17.32.110, vuser:administrator Vurl :/sdkAccess Port 443, hServer:null, huser:null, rhevmHost: null, rhevmDomain: null, rhevmUserName: null, Location:null

Nov 24, 2015 12:31:39 UTC SERVICEINSTANCEServiceInstance:ServiceInstance @ https://172.17.32.110/sdk

Nov 24, 2015 12:31:39 UTC VIRTUAL MACHINEVirtualMachine:vm-1469 @ https://172.17.32.110/sdk

Nov 24, 2015 12:31:39 UTC TOOL STATUSguestToolsRunning

Nov 24, 2015 12:31:39 UTC HARDWARE:com.vmware.vim25.VirtualIDEController@5cc529d5

Nov 24, 2015 12:31:39 UTC HARDWARE:com.vmware.vim25.VirtualIDEController@741dce93

Nov 24, 2015 12:31:39 UTC HARDWARE:com.vmware.vim25.VirtualPS2Controller@1754fce9

Nov 24, 2015 12:31:39 UTC HARDWARE:com.vmware.vim25.VirtualPCIController@7493027e

Nov 24, 2015 12:31:39 UTC HARDWARE:com.vmware.vim25.VirtualSIOController@29014c9b

Nov 24, 2015 12:31:39 UTC HARDWARE:com.vmware.vim25.VirtualKeyboard@10a7d2e8

Nov 24, 2015 12:31:39 UTC HARDWARE:com.vmware.vim25.VirtualPointingDevice@14ff7d33

Nov 24, 2015 12:31:39 UTC HARDWARE:com.vmware.vim25.VirtualMachineVideoCard@1e8c534b

Nov 24, 2015 12:31:39 UTC HARDWARE:com.vmware.vim25.VirtualMachineVMCIDevice@316cd1d2

Nov 24, 2015 12:31:39 UTC HARDWARE:com.vmware.vim25.VirtualLsiLogicSASController@7c475547

Nov 24, 2015 12:31:39 UTC HARDWARE:com.vmware.vim25.VirtualDisk@50cec4fa

Nov 24, 2015 12:31:39 UTC HARDWARE:com.vmware.vim25.VirtualDisk@62df90dc

Nov 24, 2015 12:31:39 UTC HARDWARE:com.vmware.vim25.VirtualDisk@613eec82

Nov 24, 2015 12:31:39 UTC HARDWARE:com.vmware.vim25.VirtualDisk@583fca63

Nov 24, 2015 12:31:39 UTC HARDWARE:com.vmware.vim25.VirtualCdrom@24481db3

Nov 24, 2015 12:31:39 UTC HARDWARE:com.vmware.vim25.VirtualVmxnet3@59909d6e

Nov 24, 2015 12:31:39 UTC HARDWARE:com.vmware.vim25.VirtualFloppy@6fc243e5

Nov 24, 2015 12:31:39 UTC Inside if

Nov 24, 2015 12:31:39 UTC Task #1 (Upgrade or Install VMware tools (custom_Install Or Upgrade VM Tool custom task)) completed successfully in 4 seconds

Nov 24, 2015 12:31:39 UTC Input/Output values for Task #1 (Upgrade or Install VMware tools (custom_Install Or Upgrade VM Tool custom task)):

Nov 24, 2015 12:31:39 UTC [Mapped Input: Vmid = 1809]

Nov 24, 2015 12:31:39 UTC Completed workflow item number 1, with status Completed

Nov 24, 2015 12:31:43 UTC Executing workflow item number 3

Nov 24, 2015 12:31:43 UTC Completed workflow item number 2, with status Completed

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links

Review Cisco Networking for a $25 gift card