
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
06-03-2015 05:12 AM - edited 03-01-2019 06:35 AM
Task Name | VM Details |
Description | |
Prerequisites |
|
Category | Workflow |
Components | vSphere 5.x |
User Inputs |
Instructions for Regular Workflow Use:
- Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
- Unzip the file on your computer. Should end up with a .WFD file.
- Log in to UCS Director as a user that has "system-admin" privileges.
- Navigate to "Policies-->Orchestration" and click on "Import".
- Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
- Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
- Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
- Click "Submit".
- 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.
A thank you goes out to Adam Ringenberg for this contribution. Thank you.
The custom Task for the VM details:
The workflow execution as an example:
The out put of the custom task:
The workflow run:
When used with in the VM context:
This could be added to the custom task code:
Extracting the vCenter vm id. That is required to generate VMRC URL.
Added following code to get the required output.
var Overview_vCenter_VM_ID = vmObject.Overview_vCenter_VM_ID;
logger.addInfo("Overview_vCenter_VM_ID = " +Overview_vCenter_VM_ID);
output.Overview_vCenter_VM_ID = Overview_vCenter_VM_ID;
Original Example:
This could be also added to the VM details:
Obtain the the NIC adapter name:
//NIC1 Adapter name
var vmId = task.getOutput("PROVISIONED_VM_ID");
var gvm = InfraPersistenceUtil.getVMById(vmId);
var nicList = InfraPersistenceUtil.getVMVNicByAccountAndVMId(gvm.getAccountName(), gvm.getInstanceId());
var adapterName = nicList.get(0).getAdapterName();
output.VM_NIC1_NET_ADAPTER_NAME = adapterName;
The Code for the custom task:
importPackage(com.cloupia.model.cIM);
importPackage(java.util);
importPackage(java.lang);
importPackage(java.io);
importPackage(com.cloupia.lib.util);
importPackage(com.cloupia.model.cIM);
importPackage(com.cloupia.service.cIM.inframgr);
importPackage(org.apache.commons.httpclient);
importPackage(org.apache.commons.httpclient.cookie);
importPackage(org.apache.commons.httpclient.methods);
importPackage(org.apache.commons.httpclient.auth);
importPackage(com.cloupia.model.cEvent.notify);
importPackage(com.cloupia.lib.util.mail);
importPackage(com.cloupia.fw.objstore);
importPackage(com.cloupia.lib.util.managedreports);
//NIC1 Adapter name
// var vmId = task.getOutput("PROVISIONED_VM_ID");
var vmId = input.VM_ID;
logger.addInfo("vmId = " + vmId);
var gvm = InfraPersistenceUtil.getVMById(vmId);
var nicList = InfraPersistenceUtil.getVMVNicByAccountAndVMId(gvm.getAccountName(), gvm.getInstanceId());
var adapterName0 = nicList.get(0).getAdapterName();
logger.addInfo("adapterName0 = " + adapterName0);
var adapterName1 = nicList.get(0).getAdapterName();
logger.addInfo("adapterName1 = " + adapterName1);
var adapterName2 = nicList.get(0).getAdapterName();
logger.addInfo("adapterName2 = " + adapterName2);
var adapterName3 = nicList.get(0).getAdapterName();
logger.addInfo("adapterName3 = " + adapterName3);
var adapterName4 = nicList.get(0).getAdapterName();
logger.addInfo("adapterName4 = " + adapterName4);
var adapterName5 = nicList.get(0).getAdapterName();
logger.addInfo("adapterName5 = " + adapterName5);
var adapterName6 = nicList.get(0).getAdapterName();
logger.addInfo("adapterName6 = " + adapterName6);
output.nic0 = adapterName0;
output.nic1 = adapterName1;
output.nic2 = adapterName2;
output.nic3 = adapterName3;
output.nic4 = adapterName4;
output.nic5 = adapterName5;
output.nic6 = adapterName6;
The run log:
Service Request ID: 5003
Workflow Inputs:
- VM ID
Jun 03, 2015 05:31:13 CDT Request submitted
Jun 03, 2015 05:31:19 CDT Executing workflow item number 1
Jun 03, 2015 05:31:19 CDT Completed workflow item number 1, with status Completed
Jun 03, 2015 05:31:22 CDT Executing workflow item number 2
Jun 03, 2015 05:31:22 CDT Trigger context executeWorkFlowStep called
Jun 03, 2015 05:31:22 CDT Executing custom action GetVmSummary (custom_getVMSummary)
Jun 03, 2015 05:31:22 CDT Executing custom action GetVmSummary (custom_getVMSummary)
Jun 03, 2015 05:31:22 CDT Executing custom script for getVMSummary
Jun 03, 2015 05:31:25 CDT vmId = 1140
Jun 03, 2015 05:31:25 CDT Overview_VM_ID = 1140
Jun 03, 2015 05:31:25 CDT Overview_Instance_Name = Solaris11_1(.124)
Jun 03, 2015 05:31:25 CDT Overview_Status = ON (poweredOn)
Jun 03, 2015 05:31:25 CDT Overview_IP_Address =
Jun 03, 2015 05:31:25 CDT Overview_Hostname = null
Jun 03, 2015 05:31:25 CDT Overview_Image_ID = Solaris11_1(.124)
Jun 03, 2015 05:31:25 CDT Overview_Cloud_Name = Dallas
Jun 03, 2015 05:31:25 CDT Overview_Cloud_Type = VMWare
Jun 03, 2015 05:31:25 CDT Ownership_Group = Default Group
Jun 03, 2015 05:31:25 CDT Ownership_vDC = Default vDC
Jun 03, 2015 05:31:25 CDT Ownership_Category = Discovered VM
Jun 03, 2015 05:31:25 CDT Ownership_Service_Request_ID =
Jun 03, 2015 05:31:25 CDT Ownership_Label =
Jun 03, 2015 05:31:25 CDT Ownership_Provisioned_Time =
Jun 03, 2015 05:31:25 CDT Ownership_Scheduled_Termination_Time =
Jun 03, 2015 05:31:25 CDT Overview_Host_Node = 172.17.32.113
Jun 03, 2015 05:31:25 CDT Network_Port_Group = VM Network
Jun 03, 2015 05:31:25 CDT Network_VLAN_ID = 0
Jun 03, 2015 05:31:25 CDT Network_No_of_vNics = 1
Jun 03, 2015 05:31:25 CDT Network_vNic_Mac_Address = 00:50:56:a5:46:6a
Jun 03, 2015 05:31:25 CDT Network_vNic_Device_Config_Id = 4000
Jun 03, 2015 05:31:25 CDT Overview_Boot_Time = Jun 03, 2015 03:36:15 CDT
Jun 03, 2015 05:31:25 CDT Overview_Config_Name = Solaris11_1(.124)
Jun 03, 2015 05:31:25 CDT Overview_VM_Version = vmx-08
Jun 03, 2015 05:31:25 CDT Resources_Resource_Pool = Infra
Jun 03, 2015 05:31:25 CDT Resources_Num_Virtual_CPUs = 2
Jun 03, 2015 05:31:25 CDT Resources_CPU_Reserved_MHz = 0.0
Jun 03, 2015 05:31:25 CDT Resources_CPU_Limit_MHz = -1.0
Jun 03, 2015 05:31:25 CDT Resources_CPU_Overhead_Limit_MHz = 0.0
Jun 03, 2015 05:31:25 CDT Resources_CPU_Shares = 2000
Jun 03, 2015 05:31:25 CDT Resources_Memory_MB = 6144
Jun 03, 2015 05:31:25 CDT Resources_Memory_Reserved_MB = 0.0
Jun 03, 2015 05:31:25 CDT Resources_Memory_Limit_MB = 0.0
Jun 03, 2015 05:31:25 CDT Resources_Memory_Overhead_Limit_MB = 89.0
Jun 03, 2015 05:31:25 CDT Resources_Memory_Shares = 61440
Jun 03, 2015 05:31:25 CDT Storage_Total_Provisioned_GB = 106.04
Jun 03, 2015 05:31:25 CDT Storage_Committed_GB = 106.04
Jun 03, 2015 05:31:25 CDT Storage_Uncommitted_GB = 0.0
Jun 03, 2015 05:31:25 CDT Storage_Non_shared_GB = 106.04
Jun 03, 2015 05:31:25 CDT Storage_Data_Store_Names = SAN2
Jun 03, 2015 05:31:25 CDT Storage_VM_Path = [SAN2] Solaors11_1/Solaors11_1.vmx
Jun 03, 2015 05:31:25 CDT Guest_Information_Guest_OS = Oracle Solaris 11 (64-bit)
Jun 03, 2015 05:31:25 CDT Guest_Information_Guest_State = notRunning
Jun 03, 2015 05:31:25 CDT Guest_Information_Tools_Status = guestToolsNotRunning
Jun 03, 2015 05:31:25 CDT Guest_Information_Tools_Version = 0
Jun 03, 2015 05:31:25 CDT Options_Default_PowerOff_Type = soft
Jun 03, 2015 05:31:25 CDT Processing output: Overview_VM_ID
Jun 03, 2015 05:31:27 CDT Processing output: Overview_Instance_Name
Jun 03, 2015 05:31:28 CDT Processing output: Overview_Status
Jun 03, 2015 05:31:29 CDT Processing output: Overview_IP_Address
Jun 03, 2015 05:31:30 CDT Processing output: Overview_Hostname
Jun 03, 2015 05:31:30 CDT output: Overview_Hostname is not set
Jun 03, 2015 05:31:30 CDT Processing output: Overview_Image_ID
Jun 03, 2015 05:31:31 CDT Processing output: Overview_Cloud_Name
Jun 03, 2015 05:31:31 CDT Processing output: Overview_Cloud_Type
Jun 03, 2015 05:31:32 CDT Processing output: Ownership_Group
Jun 03, 2015 05:31:33 CDT Processing output: Ownership_vDC
Jun 03, 2015 05:31:34 CDT Processing output: Ownership_Category
Jun 03, 2015 05:31:35 CDT Processing output: Ownership_Service_Request_ID
Jun 03, 2015 05:31:36 CDT Processing output: Ownership_Label
Jun 03, 2015 05:31:37 CDT Processing output: Ownership_Provisioned_Time
Jun 03, 2015 05:31:38 CDT Processing output: Ownership_Scheduled_Termination_Time
Jun 03, 2015 05:31:39 CDT Processing output: Overview_Host_Node
Jun 03, 2015 05:31:40 CDT Processing output: Network_Port_Group
Jun 03, 2015 05:31:41 CDT Processing output: Network_VLAN_ID
Jun 03, 2015 05:31:42 CDT Processing output: Network_No_of_vNics
Jun 03, 2015 05:31:43 CDT Processing output: Network_vNic_Mac_Address
Jun 03, 2015 05:31:44 CDT Processing output: Network_vNic_Device_Config_Id
Jun 03, 2015 05:31:45 CDT Processing output: Overview_Boot_Time
Jun 03, 2015 05:31:46 CDT Processing output: Overview_Config_Name
Jun 03, 2015 05:31:47 CDT Processing output: Overview_VM_Version
Jun 03, 2015 05:31:47 CDT Processing output: Resources_Resource_Pool
Jun 03, 2015 05:31:49 CDT Processing output: Resources_Num_Virtual_CPUs
Jun 03, 2015 05:31:50 CDT Processing output: Resources_CPU_Reserved_MHz
Jun 03, 2015 05:31:50 CDT Processing output: Resources_CPU_Limit_MHz
Jun 03, 2015 05:31:52 CDT Processing output: Resources_CPU_Overhead_Limit_MHz
Jun 03, 2015 05:31:53 CDT Processing output: Resources_CPU_Shares
Jun 03, 2015 05:31:54 CDT Processing output: Resources_Memory_MB
Jun 03, 2015 05:31:55 CDT Processing output: Resources_Memory_Reserved_MB
Jun 03, 2015 05:31:56 CDT Processing output: Resources_Memory_Limit_MB
Jun 03, 2015 05:31:57 CDT Processing output: Resources_Memory_Overhead_Limit_MB
Jun 03, 2015 05:31:58 CDT Processing output: Resources_Memory_Shares
Jun 03, 2015 05:31:59 CDT Processing output: Storage_Total_Provisioned_GB
Jun 03, 2015 05:32:00 CDT Processing output: Storage_Committed_GB
Jun 03, 2015 05:32:00 CDT Processing output: Storage_Uncommitted_GB
Jun 03, 2015 05:32:01 CDT Processing output: Storage_Non_shared_GB
Jun 03, 2015 05:32:02 CDT Processing output: Storage_Data_Store_Names
Jun 03, 2015 05:32:03 CDT Processing output: Storage_VM_Path
Jun 03, 2015 05:32:04 CDT Processing output: Guest_Information_Guest_OS
Jun 03, 2015 05:32:05 CDT Processing output: Guest_Information_Guest_State
Jun 03, 2015 05:32:06 CDT Processing output: Guest_Information_Tools_Status
Jun 03, 2015 05:32:07 CDT Processing output: Guest_Information_Tools_Version
Jun 03, 2015 05:32:08 CDT Processing output: Options_Default_PowerOff_Type
Jun 03, 2015 05:32:09 CDT Task #1 (GetVmSummary (custom_getVMSummary)) completed successfully in 46 seconds
Jun 03, 2015 05:32:09 CDT Input/Output values for Task #1 (GetVmSummary (custom_getVMSummary)):
Jun 03, 2015 05:32:09 CDT [Mapped Input: VM_Id = 1140]
Jun 03, 2015 05:32:09 CDT [Output: Overview_VM_ID = 1140]
Jun 03, 2015 05:32:09 CDT [Output: Overview_Instance_Name = Solaris11_1(.124)]
Jun 03, 2015 05:32:09 CDT [Output: Overview_Status = ON (poweredOn)]
Jun 03, 2015 05:32:09 CDT [Output: Overview_IP_Address = ]
Jun 03, 2015 05:32:09 CDT [Output: Overview_Image_ID = Solaris11_1(.124)]
Jun 03, 2015 05:32:09 CDT [Output: Overview_Cloud_Name = Dallas]
Jun 03, 2015 05:32:09 CDT [Output: Overview_Cloud_Type = VMWare]
Jun 03, 2015 05:32:09 CDT [Output: Ownership_Group = Default Group]
Jun 03, 2015 05:32:09 CDT [Output: Ownership_vDC = Default vDC]
Jun 03, 2015 05:32:09 CDT [Output: Ownership_Category = Discovered VM]
Jun 03, 2015 05:32:09 CDT [Output: Ownership_Service_Request_ID = ]
Jun 03, 2015 05:32:09 CDT [Output: Ownership_Label = ]
Jun 03, 2015 05:32:09 CDT [Output: Ownership_Provisioned_Time = ]
Jun 03, 2015 05:32:09 CDT [Output: Ownership_Scheduled_Termination_Time = ]
Jun 03, 2015 05:32:09 CDT [Output: Overview_Host_Node = 172.17.32.113]
Jun 03, 2015 05:32:09 CDT [Output: Network_Port_Group = VM Network]
Jun 03, 2015 05:32:09 CDT [Output: Network_VLAN_ID = 0]
Jun 03, 2015 05:32:09 CDT [Output: Network_No_of_vNics = 1]
Jun 03, 2015 05:32:09 CDT [Output: Network_vNic_Mac_Address = 00:50:56:a5:46:6a]
Jun 03, 2015 05:32:09 CDT [Output: Network_vNic_Device_Config_Id = 4000]
Jun 03, 2015 05:32:09 CDT [Output: Overview_Boot_Time = Jun 03, 2015 03:36:15 CDT]
Jun 03, 2015 05:32:09 CDT [Output: Overview_Config_Name = Solaris11_1(.124)]
Jun 03, 2015 05:32:09 CDT [Output: Overview_VM_Version = vmx-08]
Jun 03, 2015 05:32:09 CDT [Output: Resources_Resource_Pool = Infra]
Jun 03, 2015 05:32:09 CDT [Output: Resources_Num_Virtual_CPUs = 2]
Jun 03, 2015 05:32:09 CDT [Output: Resources_CPU_Reserved_MHz = 0.0]
Jun 03, 2015 05:32:09 CDT [Output: Resources_CPU_Limit_MHz = -1.0]
Jun 03, 2015 05:32:09 CDT [Output: Resources_CPU_Overhead_Limit_MHz = 0.0]
Jun 03, 2015 05:32:09 CDT [Output: Resources_CPU_Shares = 2000]
Jun 03, 2015 05:32:09 CDT [Output: Resources_Memory_MB = 6144]
Jun 03, 2015 05:32:09 CDT [Output: Resources_Memory_Reserved_MB = 0.0]
Jun 03, 2015 05:32:09 CDT [Output: Resources_Memory_Limit_MB = 0.0]
Jun 03, 2015 05:32:09 CDT [Output: Resources_Memory_Overhead_Limit_MB = 89.0]
Jun 03, 2015 05:32:09 CDT [Output: Resources_Memory_Shares = 61440]
Jun 03, 2015 05:32:09 CDT [Output: Storage_Total_Provisioned_GB = 106.04]
Jun 03, 2015 05:32:09 CDT [Output: Storage_Committed_GB = 106.04]
Jun 03, 2015 05:32:09 CDT [Output: Storage_Uncommitted_GB = 0.0]
Jun 03, 2015 05:32:09 CDT [Output: Storage_Non_shared_GB = 106.04]
Jun 03, 2015 05:32:09 CDT [Output: Storage_Data_Store_Names = SAN2]
Jun 03, 2015 05:32:09 CDT [Output: Storage_VM_Path = [SAN2] Solaors11_1/Solaors11_1.vmx]
Jun 03, 2015 05:32:09 CDT [Output: Guest_Information_Guest_OS = Oracle Solaris 11 (64-bit)]
Jun 03, 2015 05:32:09 CDT [Output: Guest_Information_Guest_State = notRunning]
Jun 03, 2015 05:32:09 CDT [Output: Guest_Information_Tools_Status = guestToolsNotRunning]
Jun 03, 2015 05:32:09 CDT [Output: Guest_Information_Tools_Version = 0]
Jun 03, 2015 05:32:09 CDT [Output: Options_Default_PowerOff_Type = soft]
Jun 03, 2015 05:32:09 CDT Completed workflow item number 2, with status Completed
Jun 03, 2015 05:32:11 CDT Executing workflow item number 3
Jun 03, 2015 05:32:11 CDT Completed workflow item number 3, with status Completed