vCloud Automation Center 6.0 and vCenter Orchestrator Advance Automation -Part02

If you have reached this post from Google, check this post first. That is where problem is discussed and this the second part of the solution. First thing you need is to pass three information from vCAC i.e. VM Name, Size of the VM and whether you need any backup. VM Name is parameter you will get from vCAC but for Backup Selection and VM Size selection I have created a custom property in build profile. Here is how I have created below

First go to infrastructure tab

In Infrastructure tab go to –> Blueprint –> Property Dictionary

image

Create a New Property Definition

Provide Name –VMSize

Display Name –Virtual Machine Size

Control Type – DropDownList

Please ensure Required check box is selected

Once done please click on green arrow.

Then click on Edit to edit Property Attributes

image

In the property attribute, select ValueList, Put same name “VM Sizes” and provide value as Large, Medium and Small which reflect the size of VM.

image

Similar exercise you follow for backup option

Here is how it looks when user selects the VM Size

image

For backup service selection this is how it looks below

image

Just ensure blueprint is updated as follows

image

This completes vCenter Automation Part at basic Level. Now comes the 3rd and final part. Follow third part here

vCloud Automation Center 6.0 and vCenter Orchestrator Advance Automation -Part01

This post is about extending vCAC in-built workflows. In last two post (Post1, Post2) I used vCenter Orchestrator (vCO) workflows and executed them using vCloud Automation Center’s (vCAC) advance service designer. It was like taking vCAC as front end to execute those workflows without taking any benefits of vCloud Automation Center’s product. vCAC was purely acting as front end.

Advance service designer doesn’t follow any reservation, policies configured for a particular tenant. It is purely taking inputs from whatever is configured in vCenter Orchestrator workflow and executing it. As I think of it is of help but then I miss all configuration, tracking ownership, multi-tenancy and metering in built in vCAC. In order to cover this I need to do additional scripting which is referred as day-2 operation. To cater this problem, vCAC provides you a way where you can modify in-built workflows. Basic details are provided into this document. I won’t repeat it here. But in order to understand this post you must read it.

To extend workflow you need vCAC designer. It is part of vCAC and can be downloaded from https://vCACAppliance.hostname.com:5480/installer/. Install it. (it is next-next-next-Finish thing).

Problem Statement

User should be able to provision VM by selecting VM size within vCAC interface. Users should be able to understand what compute, storage details are provisioned when they select VM Size.

Here I’m going to modify my existing workflow which I created in post here. If you see the workflow there are three inputs needed

1. VM name

2. VM size

3. IP Address for the VM

If you review this post, 3rd point is automatically taken care. So I have to just focus on how to take two input (VM Name and VM Size) from vCAC and put in the vCO workflow. It was bit simple, just two inputs.

Cloning part will be taken care by vCAC but post provisioning task will be taken care by vCO workflow. So we need to only focus on creating a vCO workflow which will do the following

  1. Changing CPU count
  2. Change RAM
  3. Add Disk
  4. Add Backup Network if selected

If you execute this workflow from vCO or vCenter  VC:VirtualMachine as input is needed. But vCAC do not understand VC:VirtualMachine, it can only understand string input or can provide string output.  VC:VirtualMachine input is referred as complex object type. In order to deal with this input we need to put a wrapper around the workflow. How to put a wrapper around a workflow is explained by VCOTEAM.INFO. Thanks to this post. It is key post.

That post is a where you can start but that isn’t sufficient. You need more. If you refer below return type is array.

image

We need a VC:VirtualMachine as return type. I added script section and then I have created a new parameter with VC:VirtualMachine type with name as vm01 (referred in below screen)

image

In the first line of the script I converted array type i.e. Array/VC:VirtualMachine into VC:VirtualMachine and sent that as output. This is the core piece. If you understood this, you don’t need worry further. Everything else is straight forward. I thought so Winking smile

When I executed the VCO workflow from vCAC, it failed twice. First it failed with VMware tools not working and second time it failed with error “Hot add functionality” is disabled in VM.

First problem was when the provisioning activity was completed, my next workflow which was to shutdown the VM graceful was looking for VMware tools, it didn’t found vmware tools and abruptly failed. In order to shutdown VM gracefully VMware tools must be ready. So to address first problem I have to find a workflow which will check if VMware tools are ready. This can be easily checked by using “vim3WaitToolsStarted” action element. This workflow waits for VMware tools to be ready, as it is need to graceful shutdown VM.

Second problem was workflow didn’t wait for another workflow to be completed. After I shutdown VMs I have workflow which will change CPU count, then change RAM, Add Disk and finally powered ON the VM. So powered ON workflow didn’t wait to execute CPU count, Add Disk and RAM change workflow.  Therefore I use to get error about Hotplug not supported. It was like VM was started before even CPU and RAM change could be executed. So to solve this problem I added “vim3WaitTaskEnd” in-built workflow. This workflow checks previous tasks before executing next task.

With this additional work my final workflow was ready and shown below

image

NB: Except for the script section, everything in vCenter Orchestrator is in-built

Now next part is how to make vCAC to pick this VCO. I have discussed in next post here

Adding Backup vNetwork card in Bulk using vCenter Orchestrator

Last week I was given task to create a vCO workflow which will allow L1 sysadmins to add a network card to all VMs. I was arguing why not use Powershell? Powershell script was ready in minutes. IT manager was not comfortable with script as his experience were not good in the past and above all this task must be done by L1 during non-business hours. It should be easily executed by them.

I did took his point where in Level-1 won’t have sufficient knowledge to troubleshoot or understand the powershell script. But my point was workflow will take some time as I didn’t saw any built in workflow for it.

I started to search a better way to do it. simplest way was to use Onyx. Onyx didn’t  proved much of help here. Script given by Onyx is not at all workable. I spent lot of my time in understanding it. And some Google search. It wasn’t easy for me.

I took a powershell out from Onyx and started working on it. It gave me fare bit of idea how it should be achieved.

image

I have designed Workflow which could be seen above. In the workflow I first searched all the VMs in particular resource pool. You can search in the Custer, folder or other places. After I got the VMs, I have to add them network card. Since I’m expected to get more than one VM, I get all VMs in an array. To go through each VM, I used foreach loop.That is all.

User interface below only asks Level –I to select resource pool. Inside the resource pool all VMs will be added with additional network card.

image

In my case I selected TESTVMs resource pool as seen below

image

Press Submit and Booom, network cards are attached as seen below

image

Let me explain you the script. If you don’t read my comments go to the bottom of this post to download the script.


var managedObject = VM;<- VM is Virtual machine to which you wish to add network card
var spec = new VcVirtualMachineConfigSpec();<- You need to initialized virtual machine configuration spec
var myDeviceChange = new Array(); <- you also need to initialized a array to hold all changes.
var myVirtualMachineNICCard = new VcVirtualE1000(); <- you need to initialized  VcVirtualE1000 network card and below you fill all the required values
var configSpec = new VcVirtualDeviceConfigSpec(); <- initialized virtual machine device configuration specification

myVirtualMachineNICCard.key = 0;
myVirtualMachineNICCard.backing = new VcVirtualEthernetCardNetworkBackingInfo();
<- initialized virtual machine network backing information
myVirtualMachineNICCard.backing.deviceName = “VM Network”;
myVirtualMachineNICCard.connectable = new VcVirtualDeviceConnectInfo();
<- initialized virtual machine connectable information
myVirtualMachineNICCard.connectable.startConnected = true;
myVirtualMachineNICCard.connectable.allowGuestControl = true;
myVirtualMachineNICCard.connectable.connected = true;
myVirtualMachineNICCard.addressType = “generated”;
myVirtualMachineNICCard.wakeOnLanEnabled = true;
configSpec.operation = VcVirtualDeviceConfigSpecOperation.add;
<-since we want to add the network card, we use add
configSpec.device = myVirtualMachineNICCard
myDeviceChange.push(configSpec)
spec.deviceChange = myDeviceChange
managedObject.reconfigVM_Task(spec)


Script is the most difficult part for this post. I tried my best to explain it. Hope it helps you all.

I also took opportunity to update my previous post and now workflow looks as shown below. User gets option to select backup network. In order to implement it I used decision workflow. If user has selected Backup Network required as Yes, then green line will be followed where network card will be added and next workflow will be executed. If he says No, add backup network workflow is skipped and next workflow is followed.

image

image

Hope it helps.

Anyone want to use or modify this script can download it from here.

And modified workflow can be downloaded from here

How to use vCenter Orchestrator to reduce your template maintenance overhead

When I choose to blog about this workflow I was bit hesitant if it is going to be really any value add to my readers. This is the extension of previous blog and it related to custom property post which I had done earlier. In custom property I raised the concern that with clone workflow you have very limited choice. As I explore in depth about integrating vCenter Orchestrator and vCenter Cloud Automation Center I found a better way to do. Clone workflow is the best workflow but vCloud Automation Center by default provides a limited customization it. I have not inclination to get into deploy mechanism of each and every OS e.g. WIM or any other method. So any thing extra I can do with cloning will be always a value add. In this post I explore this pain point.

You must have had heard VM sprawl. Have you heard of Gold templates sprawl. I have experienced it a lot. We created as many VM template as we had service type and again for each OS. Currently our VM sizing looks like below

image

There are total nine templates I have to maintain. Maintenance includes patching these VMs every time new patches are released. This is very common problem with MS OS. Upgrading VM tools, Upgrade VM hardware. If either of this is left it created huge incompliance in VM hardware, vmware tools and patches.

We always have searched a better solution for this. One was to use PowerShell but it was really clumsy and support was not using it at all.

Using this post I also wish to focused on resolving this problem.

Support wanted a complete automated method where in either end user (non-IT) provision the VM and he gets the VM as per the size he has selected or IT provision them

So they were looking for end to end automatic provisioning a VM without any additional effort to customize the existing deployment method. Cloning was the only option. So I felt cloning existing VM and changing the CPU, Memory and Disk size would be the best way to resolve it. vCenter Orchestrator is wonderful product. It just helps you do it without any effort as long as you know the tips and tricks about it.

All the Workflows are in-built in vCO. All I did is put them in right place.

image

Crux of this entire workflow is script section.

image

Script section is very simple. Let me explain it you

First I created a input parameter by name VMService. I have added property to it with pre-defined answers Large, Medium and Small. This create a drop down menu where user selects VM size

Second I created three attributes by name. Remember attributes gets there value from somewhere else

  1. vmNbOfCpus (type number)
  2. vmMemorySize (type number)
  3. AdditionalDisk (type number)

I used “If else” loop. So when user select VMService as Large, script under curly bracket will be executed i.e. it is take value for vCPU=4, MemorySize=4096MB and Disk size=40 GB. All I have to pass these values to next workflow. In this case they are

  1. ChangeCPUcount gets vmNbOfCpus  as 4
  2. ChangeRAM gets vmMemorySize as 4096 MB
  3. Add Data disk gets 40 GB
  4. Change the custom attribute

End User gets below screen to provision VM. Just select IP address, VM Name and Size of the VM. That is all end user has to worry. VM will be ready within 15-20 minutes.

image

Below is the example of workflow logs

image

And Below is the example of VM which was created.

image

As part of workflow I also added custom attribute to VM based on the size created. VM size provisioned below is Medium.

image

This has been achieved using vCenter Orchestrator Video training available freely at this location.

If you wish to integrate this workflow with vCloud Automation Center you should use advance workflow designer feature. I have discussed it here. Process is more or less similar.

Note: In cloning workflow vim3WaitDnsNameInTools was behaving abnormally. This action element reads DNS name of the VM. Once it read DNS name of the VM using VMware tools, it takes this as trigger to end sysprep operation and proceed next workflow. In my case I got quite varying results. While searching a bit I came across new plug-in introduced for vCenter 5.5.1. Please use latest plug-in which is right now under Technical Preview as I post this.

Service Provisioning using vCenter Orchestrator (vCO)

I think we are living in the most dynamic time of our life. I have done good number of post on vCAC and want to do more. My plan is to focus on vCAC is to do with VMware Certified Design Expert – Cloud (VCDX-Cloud). It is long long journey. See here the amount work Derek has to put to get there

But this time I don’t want to focus on install and config ones. Main component of vCAC is its extensibility which is referred as XaaS in the document. You can only achieve it when you have some background in scripting and keen to develop new things. It is predicated that every infrastructure administrator must have some scripting and or developers skills to survive in IT in next decade. One of the link which support this is http://it20.info/2014/01/vchs-meets-vco-and-boris-becomes-a-hero/

I loving solving problems and while working in operations team it is the primary thing we do. But then optimize it, do it effectively, Do more with less where the constant instructions from the management. I fortunately got introduced to PowerShell quite early. I’m glad I know little bit of it. I did good amount of scripting on PowerShell. I use to blog about it here. But with self-service provisioning, agility attributes of cloud computing I realized this skill is not sufficient. You need to know a how to orchestrator thing. With PowerShell this is possible but it increases code complexity and also it becomes very difficult to maintain and update the code every time environment changes.

I’m working on the project where I have to provide an end user option to provision VM with different SLA e.g. Gold, Silver and Bronze. User should be able to select VM as per SLA. User should be made aware of what comes with Gold, Silver and Bronze VMs. User must be able to select whether he wish to backup his VM.

Here is how I have crudely defined Gold, Silver and Bronze Services

image

Lets now focus on how to allow user to select these VMs.

vCO  have lot of built-in workflow. For this exercise lets use in-built one. It is well suited for our objective.

Let me define workflow. Workflows consist of a schema, attributes, and parameters. Schema is nothing but actual program or script (If I may call ). Attributes are something we pre-define like declaring variables right at the top of the script. Parameters are of two types. Input and out parameters. Input parameters are where user input is needed or some form of input is needed. Output parameter is result of execution of workflow.

I have duplicated three workflows based on inbuilt workflow by name “create simple virtual machine”.

image

Renamed them as Gold VM, Silver VM and Bronze VM as seen below. This is pretty basic.

image

Now the challenge was how to invoke these workflows when user selects services he needs. I created a new workflow by name Coca cola services. Inside this I created an input parameter by name Services. Since we want end user to select services, I have to change the presentation for the input parameter in the form of drop down list. Go to the presentation tab, select Services and select blue triangle and select the Properties as Predefined answers. In Predefined answers Insert Values as Gold, Silver and Bronze

image

This will create a drop down menu from which user can select the service . Now I have to initiate the action based on user selection. e.g. If users selects Gold, I want Gold VM workflow to be initiated or if user selects Silver, I want Silver VM workflow to be initiated and similar for bronze. This can be achieved in workflow by using decision.

Since user input defined are string parameter, In decision I have selected Services if it Gold – it is True condition.

image

Drag decision into this place as shown/ Below is the complete workflow schema

image

Here you have simple Go-No-go kind of workflow. I have defined here if you see Gold, please Go and initiate GOLD VM 1.1 workflow. If you see No-go, I have dragged and dropped another decision and there I have defined if you get from user Silver request, Go for silver VM 1.1 workflow and again for No-go, I have dropped another decision, here for bronze I have requested to execute Bronze VM 1.1 workflow.

If you know little bit of scripting this is as simple as below. And if you look at the workflow it is reflecting similar picture

 ServiceWorkflow

So if you know the workflow elements, it makes things much easier. If you know scripting you will understand how much pain has been reduced by vCO. Thanks vCO team for this.

So this covers the service tiering. Now the next portion is of allowing user to select backup.

This was bit difficult for me to construct at surface.Got hold of vCenter Orchestrator Book and there I got a hint. I have to modify default workflow. Since we need to give user an option to select Backup. So when user selects he wants backup I want to add additional network and that network card must get attached to Backup port group. Logic is quite simple here, User selects the Radio button (yes/no), if says Yes, I wrote a this code to additional network card.

   1:  //Add Backup Network
   2:  if(

BackupVM

==true){
   3:  deviceConfigSpec = System.getModule("com.VMware.library.vc.vm.spec.config.device").createVirtualEthernetCardNetworkConfigSpec(

vmBackupNetwork

);
   4:  deviceConfigSpecs[ii++] = deviceConfigSpec;
   5:  }

Don’t worry much about this code. Just worry about the variables here.

1) BackupVM is input variable which I have defined, and defined it as Boolean type. If User select Yes, it will create VM network

2) vmBackupNetwork is an attribute I have defined in each workflow (Gold VM1.1, Silver1.1 & Bronze1.1) which will always attach itself to backup network as shown below

image

After you save, validate workflow below Presentation screen is seen. This is just a workflow. We need to get this executed from vCloud Automation Center. Let me keep this for next post.

image