VMware vCenter

A VMware vCenter resource handler connects to a vCenter server and manages the templates, networks, datastores, and virtual machines in its clusters

Cloud Management Platform (CMP) supports vCenter versions 6.5 through 9.x. A CMP environment is created for each imported cluster. The VMware Cloud on AWS resource handler is deprecated — use this handler for VMware Cloud on AWS virtual machines.

Before you begin

  • The hostname of the vCenter server and an account CMP can authenticate with. For the privileges that account needs, see Minimum required permissions in vCenter/VMware.
  • Network rules that allow HTTPS on port 443 between the CMP server and every vCenter and ESX host.

Add a vCenter resource handler

  1. Go to Admin > Resource Handlers, select Add, then select VMware vCenter under Private Cloud.

  2. Fill in the credentials dialog and select Continue.

    Screenshot of the Create Resource Handler dialog for VMware vCenter. (opens full-size image in a new tab)

  3. Enter a name and an optional description, choose clusters under Import VMware Clusters, set any remaining options, then select Done.

You must select at least one cluster. CMP creates an environment per cluster and runs a Sync Resource Handler metadata job to import the clusters, datastores, datastore tiers, networks, and templates.

Field Description
IP address The host name or IP address of the vCenter server.
Port The API port. Defaults to 443.
Account username The vCenter account CMP authenticates as. CMP uses it for every management action, including creating servers, power operations, and syncing.
Password The password for that account. If the password vault feature is enabled, this field offers Locally Stored or Vault Managed. Select Vault Managed to read the secret from a configured vault provider. See Use password vaults.
SSL Verification Whether CMP verifies the vCenter server’s SSL certificate.

The settings dialog also includes Virtual folder path, remote console options, VM sync filters, and Split by cluster, which splits sync jobs so each one covers a single cluster. To change them later, open the handler’s Overview tab and select Edit Settings.

Import templates

An environment cannot be used until a template is imported and attached to it; the Templates tab shows a warning icon until this is done.

  1. On the handler, open the Templates tab and select Import templates. The list comes from the vCenter server this handler is connected to.
  2. Select templates, then select Import selected templates.

Select Sync templates to pick up templates added in vCenter since the last import.

Networks

Import networks from the handler’s Networks tab, and datastores from its Storage tab with Import datastores.

Network adapter type

The network adapter type set on a template in CMP overrides the adapter type of the virtual machines provisioned from it in vCenter. It may also override the adapter type on the template in vCenter.

  1. Go to Admin > Integrations > Networks.
  2. Select the network name, then select Edit.

NSX

If your vCenter supports advanced network configurations such as VXLANs and edge appliances, configure them on the handler’s NSX tab.

NSX endpoint

Defines the NSX Manager connection used to create VXLANs and edge appliances. See Network virtualization.

Edge Gateway Configuration

Sets the defaults used when creating an NSX Edge Services Gateway appliance, such as Provider Network, Cluster, Datastore, and CLI Credentials.

The provider network specified in the NSX Edge Configuration must be associated with an IP Pool; otherwise, CMP cannot determine the IP address for the gateway’s uplink interface. That network also needs a gateway and netmask configured in CMP.

vCenter parameters

The following parameters are imported, with options populated by CMP from what it discovers in vCenter.

Parameter Description
VMware Datastore Required. The datastore where a server’s disks are placed.
VMware Disk Provisioning Type Required. How the disk is provisioned.
VMware Resource Pool The resource pool a server is created in.
NSX Transport Zone The NSX transport zone to use. Applies only when the handler has an NSX endpoint.
NSX Edge The NSX edge appliance to use. Applies only when the handler has an NSX endpoint.

VMware Cluster is not a parameter you set: CMP records it in the environment on import. VMware Adapter Type is set per network interface rather than per server. You can add VMware Datastore Free Space to an environment as described below.

Disks

VMware Datastore Free Space parameter

Give this parameter a single option on the environment. It matters most when adding a disk to an existing server.

If the server has no value for it, because it was discovered or built before the parameter was configured, CMP falls back to the environment and takes the first option it finds, so a single option is the safer configuration. If neither the server nor the environment has a value, CMP uses the global default. Global options and options set on a group are not consulted when adding a disk.

Modify or add disks

vCenter needs a datastore and a disk provisioning type whenever a disk is added. The modification API accepts these parameters:

  • disk_size: the new size for the original disk.
  • new_disk_size: the size of a disk being added.
  • vmware_datastore: the datastore to provision the disk to.
  • vmware_disk_type: the provisioning type for the disk.

VM customization

By default, CMP uses the guest customization tools in a vCenter template to set the host name, IP address, DNS servers, WINS servers, domain membership, and similar values on a new virtual machine.

For finer control over Windows, add the Sysprep Answer File parameter to a vCenter-backed environment and set its value to the contents of an unattend.xml file. CMP treats the file as a template, so values such as {{ server.hostname }} resolve at build time. See Using Windows Sysprep with resource handlers.

Tags

CMP treats every VMware tag as having single cardinality: one tag value per category per virtual machine. If a VMware category allows several tags, only one of their values appears in CMP. Changing the value of a parameter linked to a tag in CMP removes the other values from the virtual machine.

Tags are synchronized only with vCenter 6.5 or later.

To limit which virtual machines CMP syncs by tag, see VM sync filters.

VM sync filters

VM sync filters limit which virtual machines CMP imports on sync. Set them on the handler’s Overview tab under Edit Settings. Leave a field blank to disable that filter. To sync, a virtual machine must pass every filter you set.

Field Effect
VM Tags to Include Syncs only virtual machines with a vSphere tag that matches a rule.
VM Names to Ignore Skips virtual machines whose name matches a rule.
VM Folders To Ignore Skips virtual machines in a folder that matches a rule.
VM Folders To Include Syncs only virtual machines in a folder that matches a rule.

These filters are separate from Tags, which brings tag values into CMP.

Rule format

Each field takes a comma-separated list of Python regular expressions:

  • Each rule matches from the start of the name, folder, or tag string. To match anywhere, start the rule with .*. To match the whole string, end the rule with $.
  • Spaces around the commas are ignored. A rule can’t contain a comma. Use .* in place of quantifiers such as {1,3}.
  • Matching is case-sensitive. To ignore case, start a rule with (?i). Don’t put a space in front of (?i), even after a comma: .*cloudbolt.*,(?i).*test.*.
  • CMP rejects the save if a rule is not a valid regular expression.

VM Tags to Include

When this field is set, CMP syncs only virtual machines with at least one vSphere tag that matches a rule. Virtual machines with no tags are left out.

CMP checks each rule against one string per tag category on the virtual machine: the category name, a colon, and the list of the virtual machine’s tags in that category. For example, the tag CB in the category managed_by_cb produces:

managed_by_cb:['CB']

In a rule, escape the square brackets with \. This rule syncs only virtual machines tagged CB in managed_by_cb:

managed_by_cb:\['CB'\]$
Virtual machine’s tags Strings checked Synced
CB in managed_by_cb managed_by_cb:['CB'] Yes
CB in managed_by_cb, and prod in env managed_by_cb:['CB'] and env:['prod'] Yes, one string matches
CB and Other in managed_by_cb managed_by_cb:['CB', 'Other'] No, $ rules out a second tag
CBX in managed_by_cb managed_by_cb:['CBX'] No
prod in env env:['prod'] No
No tags None No

More examples:

Goal Rule
CB in managed_by_cb, with or without other tags in that category managed_by_cb:.*'CB'
Any tag in managed_by_cb managed_by_cb:
CB in managed_by_cb, or prod in env managed_by_cb:\['CB'\]$, env:\['prod'\]$

Don’t write a rule that depends on the order of tags in a category. CMP lists them in the order vCenter returns them.

The tag filter depends on tag sync. If SYNC_VMWARE_TAGS = False is set in /var/opt/cloudbolt/proserv/customer_settings.py, CMP doesn’t fetch tags, skips this filter, and syncs every virtual machine.

VM Names to Ignore

CMP skips each virtual machine whose name matches a rule.

Goal Rule
Name contains cloudbolt or test .*cloudbolt.*, .*test.*
Same, in any case, for example CloudBolt01 or Test-01 (?i).*cloudbolt.*,(?i).*test.*
Name contains both cloudbolt and test (?=.*cloudbolt)(?=.*test)
Name starts with dev dev
Name is exactly joetest1 joetest1$

There is no field to include virtual machines by name. To sync only some names, ignore every name that doesn’t match. This rule syncs only virtual machines whose names contain cloudbolt or test:

(?!.*(cloudbolt|test))

To sync only names that contain both words, use (?!.*cloudbolt), (?!.*test).

VM Folders To Ignore and VM Folders To Include

  • VM Folders To Ignore skips virtual machines in a folder that matches a rule.
  • VM Folders To Include syncs only virtual machines in a folder that matches a rule.

Set one or the other. CMP rejects the save if both have a value. Either field slows the sync, because CMP has to fetch each virtual machine’s folder.

Rules are checked against the name of the folder that directly holds the virtual machine, as shown in the VMs and Templates view in vCenter. Only the folder name counts, not its path: a virtual machine in Prod/Databases/Oracle is checked against Oracle. Folders with the same name in different places are treated alike.

Goal Rule
One folder Templates$
Two folders Templates$, AD Servers$
Folders whose names start with Secure Servers Secure Servers
Folders whose names contain lab, in any case, for example QA-Lab or LAB01 (?i).*lab.*

End a rule with $ to match the whole folder name. Templates also matches Templates-Old, but Templates$ doesn’t.

VM Folders To Include works the same way. For example, CloudBoltVMs$ syncs only the virtual machines directly in CloudBoltVMs, not those in its group subfolders.

Troubleshooting

The sync job’s progress shows how many virtual machines the filters left out:

Skipping 42 VMs based on exclusion rules on the resource handler.

The job log names each virtual machine left out and why, for example Excluding VM 'web01' due to it lacking an include tag.

If a tag rule leaves out a virtual machine you expected to sync, open the virtual machine in vCenter, note its tag categories and tags on the Summary tab, and build the string from them as shown in VM Tags to Include. If the tag rule has no effect at all, check that SYNC_VMWARE_TAGS is not set to False.

Snapshots

vCenter servers support snapshots. See Snapshots.

Virtual folder path

CMP places provisioned virtual machines in a folder on the vSphere client, and gives each group a subfolder of the same name. The default path is CloudBoltVMs/{{ group }}.

Change it with the same template syntax used for hostname templates.

Virtual folder path options

CloudBolt VM directory

CloudBoltVMs/{{ group }}

CloudBoltVMs/ is the root directory for virtual machines, and {{ group }} is the current group’s name. It produces paths such as CloudBoltVMs/Development and CloudBoltVMs/Production.

Check for parent groups

{% if group.parent %}/{{ group.parent }}/{{ group }}{% else %}/{% endif %}

This builds the path from the group hierarchy: a group with a parent gets both names, so “Subfolder” under “Parent” becomes /Parent/Subfolder, while a group with no parent becomes /Group.

Specify a virtual folder path

  1. Go to Admin > Resource Handlers and select your vCenter handler.
  2. On the Overview tab, select Edit Settings.
  3. Enter the path in Virtual folder path, then select Save.

Minimum required permissions in vCenter/VMware

The vCenter account a resource handler authenticates as needs a role with the privileges below

Use vCenter APIs

Reach vCenter directly from plugin code through its vSphere Web Services API or its vSphere Automation API