One of the really cool features of the policy management within VMTurbo is that we can build dynamic groups. Using regular expressions for searching often causes a collective groan among sysadmins, but luckily we have made the process easier with a quick in-application guide to how to create simple search expressions.
Perhaps I want to create separate policies around storage or host affinity that will affect a set of machines. Creating manual groups can be tedious, and is also prone to error as we may find that the group selection is left as it is without adjustment later on as the virtual infrastructure grows and changes. Let's use a starter example where we want to add some policies for any machines that are clones because this is a common practice in virtual infrastructures.
All your clones are belong to us - Creating the clone membership group
Our assumption is that you are using a naming structure in your virtual environment where clones contain the word clone inside them. This can be anywhere in the name of the object, such as "clone of W2K3", "accounting-clone", "myclone-9-12-2014" or other such names. The theme here is that the word clone could be anywhere within the name of the VM object, so we have to use a regular expression for our dynamic group. This is where it gets fun
First we head over to the VMTurbo control instance and click on the Policy tab:
Within the Policy tab you will select Group Management in the left-hand pane, and in the middle pane you will click the + button to add a new group:
The Group Builder popup requires a name, so we can choose one such as "All VMs Named Clone":
Now we click on the Members tab within the Group Builder which lets us choose the grouping method. We will choose the default which is "Group entities by criteria" and you can see from the drop-down lists that we have some options:
We will choose by name in the "Choose search criterion..." drop-down, and in the "Search for:" drop-down we will use Virtual Machines:
Before you get started, you can click the ? button beside the regular expression selection which shows us some examples of how to build a search phrase:
A common mistake made with regular expressions is that we can forget to put the wildcards in the right place. For our example where we want to include the name "clone" we can start by searching for .*clone and let's see the results by clicking the "Find Matches:" button:
You can see the results window contains six objects based on this criteria, but in our sample infrastructure, we know that there are more. Because we used .*clone as our search expression, it is only searching for virtual machines where clone is the end of the name. In order to make sure we are searching for "clone" anywhere in the name, we use .*clone.* instead:
That's much better! Now we can see that our group contains more members that include those where "clone" is anywhere within the name of the object.
Click on the "Create Group" button and you are all set! In order to view the newly created group, expand the "My Groups" twisty on our Policy tab and you can see the properties of the "All VMs Named Clone" in the right hand pane when we select the group. This is where we can edit the group as needed in future:
This is important because it means that as new virtual machines are created with clone in the name, they will be dynamically added to this group.
Now that we have our dynamic group created, we can apply any VMTurbo policies to the group and we will be sure that it applies to the appropriate group, and will dynamically adjust as virtual machines are added to the environment.
It's just that easy