Author Archives: dean132

Property Relationships in vRA 7

In a previous post I described how to create a property relationship in vRA 6.2 using a value expression.

I thought I would attempt this using vRA 7 as the previous method is no longer valid. What we need to do now is create a vRO Action script to populate the vRA menu’s.

So to recap my requirements, I need to have a section on the request form that prompts users to select a management network for NIC0, and then depending on what the user selects they should be given specific options for NIC1, the table below shows the options.

Management vLAN (Primary NIC0) Production vLAN (Secondary NIC1)
vLANMAN_001 vLANPROD_001
vLANPROD_002
vLANMAN_002 vLANPROD_003
vLANPROD_004
vLANMAN_003 vLANPROD_005
vLANPROD_006

 

To get started we need to create our vRO action script, it’s at this point I must say a huge thanks to Simon Sparks from vcoflow.co.uk who showed me just how stupid I was being when trying this, and being pretty nice about it at the same time:

Open vRO client, select the Design view and then select the Actions tab:

 

You’re going to want to create a folder here for your custom actions, in my example I just used vra.custom.actions:

Create a new action and give it a name, for this example I have used “NetworkSelector”. Open the new action and go to the “Scripting” tab:

Change the Return Type to “Array of String”

Add a parameter I have just used netchoice for this example:

Now for the script area:


var arrOptions;
arrOptions = new Array();

if(netchoice)
{
switch(netchoice){
case "vlan_man001":
arrOptions.push("vlan_prod001");
arrOptions.push("vlan_prod002");
case "vlan_man002":
arrOptions.push("vlan_prod003");
arrOptions.push("vlan_prod004");
case "vlan_man003":
arrOptions.push("vlan_prod005");
arrOptions.push("vlan_prod006");
default:
arrOptions.push("");
}
}
else
{
arrOptions.push("");
}
return arrOptions

 

OK Save the vRO Action and go back to vRA. We now need to create the parent and child properties, we create the parent first:

  • Name: This is the custom property name that we are setting
  • Label: This is what appears on the request form
  • Order Index: This is the order the field will appear on the request form, as this is the parent we set this to 1
  • Data type – this is set to string
  • Display Advice: We need a dropdown for this example
  • Values: We predefine the values at this point, the values must match Network names

Save the property definition and then let create a new property definition for the child property:

First part of the property creation is pretty standard, I need to assign the correct order index here also:

For the values section choose Dropdown and then select “External Values” a box will appear where you can browse to your previously created vRO Action:

Now we need to bind the input parameter to the parent property:

Now we have both Property Definitions we need to create a property group assigning the two property definitions to the group:

Now you can assign the property group to your blueprint:

Now from the request form you can see the dropdowns with the appropriate options

Hope you find this helpful, and again massive thanks to Simon Sparks for his help with this, I am not a coder by any stretch and I’ll be studying javascript intensively over the next few weeks/months.

 

Facebooktwittergoogle_pluslinkedinby feather

Property Relationships in vRA 6.2

I had a requirement from a customer where they needed to give users the option to select which vLAN (port group) a secondary NIC would be placed on. To add a little bit of extra complexity, the options for the secondary NICs should change depending on where the primary NIC was placed……..are you with me still? Anyway looking around I found some great help out there mainly from Jad El-Zein’s fantastic blog post here and then this fantastic tool from Eiad Al-Aqqad blog and tool here Note: In vRA7 this method is no longer used, I have now uploaded a post on how to achieve this in vRA7. OK, for this example here are my requirements:

Management vLAN (Primary NIC) Production vLAN (Secondary NIC)
vLANMAN_001 vLANPROD_001vLANPROD_002
vLANMAN_002 vLANPROD_003vLANPROD_004
vLANMAN_003 vLANPROD_005vLANPROD_006

OK so first we need to create a parent value, in this case it will be the

VirtualMachine.Network0.Name property:

Edit the property attributes:

Now we need create the child values, for this example of the secondary NIC it will be the VirtualMachine.Network1.Name property:

Edit the property attributes: Create a relationship with the parent property:

Now we need to create a value expression, the relationship generator is invaluable here, it’s a great tool:

 

For the purists out there who like to write some code now and then the value expressions looks like this:

<PropertyValue><FilterName>VirtualMachine.Network0.Name</FilterName><FilterValue>vlanman_001</<br/>FilterValue><Value>vlanprod_001</Value>
</PropertyValue><PropertyValue><FilterName>VirtualMachine.Network0.Name</<br/>FilterName><FilterValue>vlanman_001</FilterValue>
<Value>vlanprod_002</Value></PropertyValue><PropertyValue><FilterName>VirtualMac<br/>hine.Network0.Name</FilterName>
<FilterValue>vlanman_002</FilterValue><Value>vlanprod_003</Value></<br/>PropertyValue><PropertyValue>
<FilterName>VirtualMachine.Network0.Name</FilterName><FilterValue>vlanman_002</<br/>FilterValue><Value>vlanprod_004</Value></PropertyValue>
<PropertyValue><FilterName>VirtualMachine.Network0.Name</<br/>FilterName><FilterValue>vlanman_003</FilterValue><Value>vlanprod_005</Value></PropertyValue>
<PropertyValue><FilterName>VirtualMachine.<br/>Network0.Name</FilterName><FilterValue>vlanman_003</FilterValue>
<Value>vlanprod_006</Value></PropertyValue></ArrayOfPropertyValue> 

Here is what your property should look like:

Next step is to create a Property Layout to make sure the properties display in the correct order on the request form NetworkSelection is the layout for this example:

The property instances should be as below:

Now we need to assign the custom property definitions and the property layout to the desired blueprint:

Now when we request a Catalog Item you should see the options on the request form:

Hope this is of some help to someone, if I need to achieve something similar with vRA7 I will post up the solution.

Facebooktwittergoogle_pluslinkedinby feather

PowerCLI Validation Quick Scripts

I recently built a vSphere platform, and following completion of the build I was required to perform testing, and also validate that the build matched the design documents, rather than screen print a load of images for each host etc, I used PowerCLI to get the settings for me so I could compare them with the design document. I am just going to put a list of the commands, there’s nothing overly complicated or even elegant here, but they might come in handy for someone.

Get Hosts Build Numbers

Get-VMHost | Select Name,Version,Build sort-object name

Check hosts are joined to a domain

Get-VMHost | Get-VMHostAuthentication | Select-Object VMhost,DOmain,DomainMembershipStatus | Sort-Object VMhost

 Get DRS Status

Get-Cluster  Select-Object Name,DrsEnabled,DrsMode,DrsAutomationLevel

 Get Lockdown mode status

Get-View  -ViewType  HostSystem  Select
Name, @{N=“Version”;E={$_.Summary.Config.Product.Name}}, @{N=“State”;E={$_.Runtime.ConnectionState}}, @{N=“LockedMode”;E={$_.Config.AdminDisabled}} |
Where { $_.Version -match “i”} Sort-Object  Name

 Check if ESXi Shell is running on hosts

Get-VMHost Get-VMHostService  Where { $_.Key -eq “TSM”} | Select-Object VMhost,Key,Label,RUnningSort-Object VMHost

 Check is SSH Service is running on hosts

Get-Cluster | Get-VMHost | Get-VMHostService Where { $_.Key -eq “TSM-SSH”} Select-Object VMhost,Label,RunningSort-Object VMHost

 Enable SSH on all hosts

Get-Cluster | Get-VMHost | Foreach { Start-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq “TSM-SSH”} ) 

}

 Get Cluster HA Status

Get-Cluster | Select-Object Name,HAEnabled,HAAdmissionControlEnabled,HAFailoverLevel,HAIsolationResponse,HARestartPriority

 Get HA Reservations

Get-Cluster clustername | Select-Object Name,@{N=“CpuFailoverResourcesPercentage”;E={$_.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.CpuFailoverResourcesPercent}},@{N=“MemoryFailoverResourcesPercentage”;E={$_.ExtensionData.Configuration.DasConfig.AdmissionControlPolicy.MemoryFailoverResourcesPercent}} |
Sort-Object Name | ft -AutoSize

 Get Host Multipath policy

Get-VMHost | Get-ScsiLun | Select-Object VMhost,CanonicalName,LunType,MultipathPolicy | Sort-Object VMhost

 Get Storage IO Control Status

Get-Datastore | Select Name,StorageIOControlEnabled

 Get Scratch partition settings

Get-VMhost | Get-AdvancedSetting -Name “ScratchConfig.ConfiguredScratchLocation” | Select-Object Entity,Name,Value | Sort-Object Entity

 Check Syslog allowed through firewall

Get-VMHost | Get-VMHostFirewallException | where {$_.Name.StartsWith(‘syslog’)}

 Check vLAN Port taggings on Portgroups

$esxihosts = Get-VMHost

foreach($esxihost in $esxihosts){

Get-VirtualPortGroup -VMHost $esxihost | select $esxihost.Name,Name, VirtualSwitch, VLanId

}

 Check DNS Resolution for all hosts (from list of hosts in text file)

$hosts = Get-Content C:\SDCHosts.txt

Foreach ($element in $hosts){
Resolve-DnsName $element 

}

 Get VAAI Plugin status

Get-VMHost | Get-AdvancedSetting -Name DataMover.HardwareAccelerated*, VMFS3.HardwareAccelerated* | Select-Object Entity,Name,Value | Sort-Object Entity

 Get time server status

Get-VMHost | Sort Name | Select Name, @{N=“NTPServer”;E={$_ |Get-VMHostNtpServer}}, ` Timezone,

@{N=“CurrentTime”;E={(Get-View
$_.ExtensionData.ConfigManager.DateTimeSystem) | Foreach {$_.QueryDateTime().ToLocalTime()}}}, `

@{N=“ServiceRunning”;E={(Get-VmHostService -VMHost $_ |Where-Object {$_.key-eq “ntpd”}).Running}} `

Facebooktwittergoogle_pluslinkedinby feather

Add Microsoft SQL Database to vRO

This has probably been covered in a million places, but if you want to add a database to vRO, to allow vRO to run modify the database as part of a workflow do the following:

First we are going to need a JDBC URL for the SQL Databse, luckily vRO comes with its very owm built in JDBC URL Generator workflow:

Open the vCO client à Library à JDBC à JDBC URL Generator and start the workflow

 

On the Next screen you should only enter a domain name if the user account you specified is an AD user, if you are using a SQL account leave the domain blank. This caught me out once.

Click Submit and when the workflow runs on the right hand will you see the JDBC URL in the logs

Copy this and then go to Library à SQL à Configuration à Add a database

Start the workflow and enter your details, paste the entire JDBC URL we created earlier, deleting what was already present.

Enter the credentials and Submit

You have now added a SQL Database that can edited via vRO.

Facebooktwittergoogle_pluslinkedinby feather

Publish vRO workflows in vRA Catalog

As a quick and easy run through I thought I would show how you can publish vRO workflows as a Catalog Item in vRA. This is a really basic workflow just to show an example of how vRA Advanced Service Designer can be used.

Couple of Pre-Reqs, make sure you are running vCloud Suite – Advanced edition as a minimum you do not get Advanced Service Designer in Standard!!!

OK, to get started you are going to need a workflow in vRealize Orchestrator, I have chosen the “Create an Organisational Unit” workflow that is included in the vRO AD Plugin. It’s a simple workflow that if you run it natively it only asks for 2 parameters an OU name and a Parent OU, since I don’t want my users to have to enter a parent OU, I am going to make some changes to the workflow to set the parent OU in advance.

First duplicate the workflow and save it in a folder where you keep all your customised workflows

Now lets edit the workflow to set the Parent OU value so the end users does not have to.

Edit the workflow and click on the Schema Tab

Select the createOrganizationalUnit element and edit it, click on the “IN” tab

Double click on the “container parameter”

Click on the “Not Set” value highlighted in the picture above and browse the domain to the parent OU where you want to place all created OUs

Click Select and then Click OK. If you select the “Validate” button from the Schema Tab the validation will run and should succeed (you may be prompted about an un-used parameter you are safe to remove this)

You can now run this workflow from vRO to make sure it runs successfully.

Ok so now you have your workflow, we now need to Publish this in vRA and grant permission to users so that people can see it in their Catalog, and run it.

Login to vRA and go to Advanced Service Designer à Service Blueprints à Add

Browse to the folder on vRO where the workflow you created earlier is located, highlight it and then click “Next”

Fill in the details for your workflow and then click “Next”

Then click “Next”

Then click “Next” again, we don’t need to make any changes

You’ll now have you Service Blueprint

Highlight the blueprint and click on “Publish”

As with all VM Blueprints you will need to assign a Service and Entitlements to the blueprint

Once done you should see the Service Blueprint in your catalog

Fill out the request info

Then enter the name of the OU you want

Click “Submit” and the request should process

That’s it for this demo, it’s a very simple way to show you how to get started with Advanced Services Designer, the more complex the vRO workflow the more complex it gets to publish, but I keep saying it vRA is a great product and really extensible.

 

 

 

 

 

Facebooktwittergoogle_pluslinkedinby feather