HybskyM
Contributor
Contributor

Scheduling a workflow to trigger on VM power-on

Hello,

I'm looking for way how to schedule a VM re-config workflow on VM power cycle. Is there a way how to do this using vRO or is anybody aware of other option? The goal is to apply the specific VM configuration change (or run PowerCLI script to do the same) anytime when user decides to reboot his/her VM.

Thanks.

0 Kudos
4 Replies
asurendra
VMware Employee
VMware Employee

You can probably look at configuring SNMP trap on the vcenter alarm definitions, then on vRO use run 'Register SNMP device' and use policy to trap SNMP message followed by invoking the workflow on the onTrap event.

1.PNG

2.PNG

3.PNG

4.PNG

5.PNG6.PNG

7.PNG

0 Kudos
eoinbyrne
Expert
Expert

Thinking about this - ultimately what you want is for vRO to be notified when a VM reboots (btw, is this for all VMs or just specific ones?) and have this trigger the execution of a workflow in vRO

Since what you need is and event you could try setting up a trigger on the VC event manager in vRO

vRO API Explorer by Dr Ruurd and Flores of ITQ

Not 100% obvious how it might be used but it looks like it would be possible to do the following (assuming you want this to be for all VMs...)

1. Create a self-scheduling workflow which sets up the trigger for the VM event and waits till triggered or the timeout expires

2. If the trigger is fired, workflow should

     2.1 Spawn an async workflow to do the VM reconfig for VM identified in the event

     2.2 Immediately re-enter the trigger cycle

3. If the timeout expires, re-enter the trigger cycle

The VC api for 5.1 shows that there is a VmStoppingEvent type which might be the one to look for as you mentioned VM Power Cycle. The above strategy would leave you with one workflow which effectively runs 'forever' though so might not be for every environment.

The only other alternative might be to add a specific vRO Custom action in vCenter to do the "power down and reconfig" in one step...? If we assume that VMs are powered down from the client then this would work without the event handling / forever workflow bit..

Anyway, HTH

0 Kudos
HybskyM
Contributor
Contributor

Hello,

Thank you very much for your valuable advice.

Yes, I am looking for some way how to do this for all VMs or let's say for a long a list of VMs where we need to apply a specific changes to their config during they are down. Each VM will have it's own set of config changes (or let's say "desired state" after reboot). We do not apply the same config across all of them. The problem is that there are thousands of VMs in scope and we cannot afford to have a resources spent by waiting in vCenter and quickly applying the config as soon as the VM is down and we also cannot afford to coordinate with all thousands VM owners during their maintenance windows.

I do not understand why there is no feature in vSphere yet, like the possibility to apply specific configuration on next reboot and it is pity that it is necessary to do this in quite complicated way.

0 Kudos
00rellana
Contributor
Contributor

I was looking into doing something similar, however, it would be more like a monthly reboot of a server or list of servers associated with an APP.

I just have not been able to find the vRO Operation (built-in task) to call the vRA Reboot that vRA offers via the "Reconfigure" option.

0 Kudos