Automation

 View Only

make a VM auto power off / on / affinity with a Host?

  • 1.  make a VM auto power off / on / affinity with a Host?

    Posted Apr 16, 2014 06:23 PM

    cross post from ESXi forums..  got a suggestion to create a script attached to a maintenance event to power off the VM's in question.

    specifically to that proposed solution, running into a couple roadblocks... would like to make a generic script which i can just attach at the cluster alarm level, but I haven't been able to find any way to enumerate hosts and find the host that is 'ENTERING maintenance mode' to shut down the VM's on it. (either status is running, or maintenance.. no in between)  So could write specific scripts for each host, but that seems just wrong..

    -----

    So...

    I have vShield deployed.  vshield has a vApp VM which resides on each host.  When i put a host into maintenance mode, that vapp will automatically power down (it's the last one to shut off), and when that host comes out of maint mode, that VM automatically powers back on.  Works great.  never gets DRS'ed off the host, doesn't move on maintenance mode (get registered with another host)..

    There are NO DRS affinity rules defined for this vapp, or any other type of affinity setting i can see.  this works regardless of DRS settings on the cluster.

    next, Trend deep security (or any other AV which uses endpoint), also has an agent VM which must be deployed to each host.

    I have setup affinity rules to keep the apps on their individual host (which is annoying, as you have to create a group for each host, and a group for each app, then link the two together)..

    this accomplishes the keeping the VM on the host.. however, when you enter maintenance mode, you have to manually power down this VM before the host can successfully enter maint mode.

    (Outside of affinity rules, you can also just disable DRS for those specific machines.. the annoying part there, is if you leave the 'register powered off machines to a different host' it will still move the powered down VM to a new host, even with DRS disabled on that VM.)

    setting the power down with host / power on with host rules doesn't work in this case either.. we aren't shutting the host down, so it doesn't trigger the power event.

    I would love to have the Trend VM behave in the same manner as the vShield VM, but not sure how the vShield vm accomplishes the automation which it does.

    Anyone have any ideas?

    Thanks