VMware Cloud Community
StoneLund
Contributor
Contributor
Jump to solution

vSphere Replication and PowerCLI

Hi

I´ve seen some discussion about this in the forum, however no recently.

Would it be possible to trigger a failover from PowerCLI?

My thought is to trigger a script from our UPS in case of PowerFailure to shutdown a VM and power it up on another host on another location. I have only one virtual center and both hosts attached to it.

The script should do the following.

  1. Shutdown the source machine
  2. Enable failover
  3. Power on the destination machine on the new host.

Would this be possible?

0 Kudos
1 Solution

Accepted Solutions
mvalkanov
VMware Employee
VMware Employee
Jump to solution

Hi,

The original question was about powering on the VM another host on another location. I assume there is no shared storage between the two locations. vSphere Replication could be used to replicated the vmdks, but yes, currently there is no automation (except if using SRM API and SRM currently requires two vCenter Servers - each managing its location).

Regards,

Martin

View solution in original post

0 Kudos
10 Replies
Sreejesh_D
Virtuoso
Virtuoso
Jump to solution

I am not sure about PowerCLI solution but definitely the UPS vendor may have solution for it, like APC.

APC UPS has options to shutdown the vSphere hosts incase of power failures. Please refer http://www.vuemuer.it/wp-content/uploads/2012/07/wp_en_vSphere_shutdown_PCNS.pdf

0 Kudos
vilinski
VMware Employee
VMware Employee
Jump to solution

Not really... there's currently no powerCLI support available for vSphere replication.

StoneLund
Contributor
Contributor
Jump to solution

Hi

Yea, we use Eaton UPS and they also have integration with vCenter. Though, only to shutdown host etc and to trigger scripts. I would like to let the Eaton UPS trigger the script to force a replication of the VM and to restart it on the new host while vCenter is running.

0 Kudos
StoneLund
Contributor
Contributor
Jump to solution

Okey.. Thats too bad. Do you know if it will be any PowerCLI integration in the future?

0 Kudos
Sreejesh_D
Virtuoso
Virtuoso
Jump to solution

If so vCenter HA will do the job. Once the host is powered down by UPS the VMs will be powered on on other available hosts if HA configured in the cluster.

Its basic, Im sure you know this. Something else is the requirement here. Please explain.

0 Kudos
mvalkanov
VMware Employee
VMware Employee
Jump to solution

Hi,

The original question was about powering on the VM another host on another location. I assume there is no shared storage between the two locations. vSphere Replication could be used to replicated the vmdks, but yes, currently there is no automation (except if using SRM API and SRM currently requires two vCenter Servers - each managing its location).

Regards,

Martin

0 Kudos
StoneLund
Contributor
Contributor
Jump to solution

Hi, that is correct and what i´m trying to do.

But, thats a shame that there is now way to script this. It would be very helpful.

I should work though to shutdown the machine in case of powerfailure by PowerCLI.

Rename the machine vmx, nvram and so on files on the destination datastore with PowerCLI so the become usable.

Then register and PowerON the machine with PowerCLI on the destination host.

I found a blog post on the net with the commands...

Next question is though, will vSphere Replication contunue to replicate the powered off machine. Or does it stop automaticly when the machine is powered off?

0 Kudos
mvalkanov
VMware Employee
VMware Employee
Jump to solution

Hi,

Currently vSphere Replication does not automatically sync changes done to the disks to the target replica site when the virtual machine is powered off, unless as part of failover initiated by SRM or VR UI recovery wizard, in order to sync the latest changes (made during the shutdown).

Also, beware that the disks on the replica site have replica redo logs attached to them as child disks and attempting to manually rename the some of these numbered files and use them (with or without consolidation with the base disk files) will highly likely not represent a consistent view of the source data and it is not supported.

Regards,

Martin

0 Kudos
StoneLund
Contributor
Contributor
Jump to solution

HI

Ok..

But, in my case, with a host in another location, only one vCenter and vSphere Replication enabled.

What could be a appropriate soultion for automated failover with vSphere Replication?

Since the UPS has around 1h battery time, failover to loss of power would be unlikely, and could be done manually if needed. However, at offours and holidays etc. it would be nice with an automated soultion.

0 Kudos
kwerneburg
VMware Employee
VMware Employee
Jump to solution

SRM is exactly designed for automating the failover.  SRM even has an API call you can do to initiate the failover...  But you'd need a second VC and SRM licenses. 

There is no automation entry point for vSphere Replication outside of SRM for the purpose you're looking at.

| @vmKen | VMware Technical Marketing |
0 Kudos