Skip to main content

@PValsecchi already showed how to use vSphere tags for VM selection in VBR. New in v11 is the possibility to combine vSphere tags. I want to show how this work.

 

For that, I created two tag categories. One for Location and one for Backup. I defined datacenter A and B locations; and Gold, Silver and Bronze backup priority.

 

These tags are assigned to my 4 test VMs:

So: VM01 and VM03 (odd numbers) are located in DC A. VM02 and VM04 (even numbers) are in DC B. VM01 and VM02 are defined for Gold-Backup, VM03 for Silver, VM04 for Bronze.

 

First, I select one Tag for VM selection: DC A. This can be done either with single tag selection or with new combination of tags but just select one.

As expected, when backup runs, VM01 and VM03 are selected:

Next, I want to backup all Gold-Backup VMs in DC B and select these tags:

 

Objects shown in Job definition:

Just VM02 has all tags assigned:

 

Fine, works as expected! And now, backup all VMs in DC A and B:

Eventually here is a pitfall. Because now nothing will be backed up:

 

Simple because no VM can be in DC A and B simultaneously - at lease not with the definition of my tags. To backup all DC A and B VMs, select single tags as usually:

All VMs in both DCs are selected:

Important: at the moment just AND combinations are supported

 

Nice!


Another great chapter @vNote42 , I admit not using tags enough...

@JMeixner Actually there is solution for this: VMware Event Broker Appliance. It is currently a fling (no support) that is still in development. Just a few days ago, version 0.5 was released. It uses a new approach: Event driven automation. In this example, a tag is assigned to a new VM, when the event of VM-creation appears.

I personally believe, this will be part of vSphere one day.

Are you using this tool even in production or only for testing prouposes?

For production purpose I am waiting for the final version of the broker .. it is still a fling


Another great chapter @vNote42 , I admit not using tags enough...

@JMeixner Actually there is solution for this: VMware Event Broker Appliance. It is currently a fling (no support) that is still in development. Just a few days ago, version 0.5 was released. It uses a new approach: Event driven automation. In this example, a tag is assigned to a new VM, when the event of VM-creation appears.

I personally believe, this will be part of vSphere one day.

Are you using this tool even in production or only for testing prouposes?


A tag on your datastore can cover this as well.
Newly created vm’s on that datastore are automatically in back-up with the job.


One problem I see with tags is that they don't allow you to set an execution order within the tag itself. Is that so?

This is not completely true! You can order the tags within the selection. If you need to backup your most important VMs first, you can add them explicitly by selecting them beneath your tags.

 


One problem I see with tags is that they don't allow you to set an execution order within the tag itself. Is that so?

You are speaking of the order the VMs are processed within a job?


One problem I see with tags is that they don't allow you to set an execution order within the tag itself. Is that so?

Thanks a lot for the wonderful write-up. I always encourage people to use TAGs as it's a brilliant way to manage your VMs and your backups. I also tend to TAG the VMs that require Copy/Replication as normally we don't replicate/Copy everything to DR. 


Yes it is quite easy to query for not-tagged VMs. Simple like this:

$NotTaggedVMs = @()
Get-VM | ForEach-Object {if((Get-TagAssignment $_) -eq $null) {$NotTaggedVMs += $_}}

I normally start such a script scheduled. It could tag VMs or report per mail. 

This will help me for sure


The VMware Event Broker Appliance sounds great! Will need to test this out soon.

+1 on this, every day’s a school day!

And almost every day is too short ...


The VMware Event Broker Appliance sounds great! Will need to test this out soon.

+1 on this, every day’s a school day!


The VMware Event Broker Appliance sounds great! Will need to test this out soon.

Please share your experiences here. :grin:


The VMware Event Broker Appliance sounds great! Will need to test this out soon.


Thank you for the code snippet, @vNote42 

And the hint to the Event Broker Appliance is great, too. I will suggest ths to our VMWare Admins.


@JMeixner Actually there is solution for this: VMware Event Broker Appliance. It is currently a fling (no support) that is still in development. Just a few days ago, version 0.5 was released. It uses a new approach: Event driven automation. In this example, a tag is assigned to a new VM, when the event of VM-creation appears.

I personally believe, this will be part of vSphere one day.


Yes it is quite easy to query for not-tagged VMs. Simple like this:

$NotTaggedVMs = @()
Get-VM | ForEach-Object {if((Get-TagAssignment $_) -eq $null) {$NotTaggedVMs += $_}}

I normally start such a script scheduled. It could tag VMs or report per mail. 


@JMeixner: I don’t know any. But as a workaround you could create a catch-all job, which backups only VMs without tags. Or create a scheduled PowerCLI script which reports VMs without tags or assigns a default tag to those.

Seeing the example with the two DCs I fear that this can easily happen and result in missing backups. Double checking or reporting will be a must if using tag combinations.


This is great, and thanks for breaking down the logic of the tag combination as you did, it was great to see that example of selecting both DCs!


This is a fine way to define a structure for automatic selection of VMs to Jobs. Great extension of this functionality.

Is there a mechanism in VMWare to be sure that the tags have to be set at the creation of a VM? Otherwise the admins will forget it for most of the maschines… :smiley:


Comment