array
Contributor
Contributor

VMotion from command line?

Hello everyone,

I'm currently working for a client that wants to be able to initiate VMotion (not Storage VMotion) from a command line. Does anyone know how to do this?

Thanks in advance,

Remko

0 Kudos
7 Replies
TomHowarth
Leadership
Leadership

have a look at this it appears to give a proceedure for a CLI based VMotion like process, there is no VMware equivilent

Tom Howarth

VMware Communities User Moderator

Tom Howarth VCP / VCAP / vExpert
VMware Communities User Moderator
Blog: http://www.planetvm.net
Contributing author on VMware vSphere and Virtual Infrastructure Security: Securing ESX and the Virtual Environment
Contributing author on VCP VMware Certified Professional on VSphere 4 Study Guide: Exam VCP-410
0 Kudos
array
Contributor
Contributor

Thanks for your answer,

I think it must be possible usinge the SDK, see

MigrateVM_Task

Migrates a virtual machine's execution to a specific resource pool or host.

Requires Resource.HotMigrate privilege if the virtual machine is powered on or Resource.ColdMigrate privilege if the virtual machine is powered off or suspended.

Required Privileges

Dynamic - See discussion above

Parameters

Name

Type

Description

_this

ManagedObjectReference

A reference to the VirtualMachine used to make the method call.

pool* P

ManagedObjectReference

to a ResourcePool

The target resource pool for the virtual machine. If the pool parameter is left unset, the virtual machine's current pool is used as the target pool.

host*

ManagedObjectReference

to a HostSystem

The target host to which the virtual machine is intended to migrate. The host parameter may be left unset if the compute resource associated with the target pool represents a stand-alone host or a DRS-enabled cluster. In the former case the stand-alone host is used as the target host. In the latter case, the DRS system selects an appropriate target host from the cluster.

priority

VirtualMachineMovePriority

The priority of the migration task.

state*

VirtualMachinePowerState

If specified, the virtual machine migrates only if its state matches the specified state.

*Need not be set P Required privilege: Resource.AssignVMToPool

0 Kudos
rossb2b
Hot Shot
Hot Shot

I found a script that was written for a performance test Dell was doing on th 1955 blade Server. The script is at the end of this PDF - http://www.dell.com/downloads/global/solutions/vmware_1955.pdf

It's not exactly what you are looking for but I hope it will help.

-rick

0 Kudos
TomHowarth
Leadership
Leadership

you can use VIMSH but it is a steep learning curve

Tom Howarth

VMware Communities User Moderator

Tom Howarth VCP / VCAP / vExpert
VMware Communities User Moderator
Blog: http://www.planetvm.net
Contributing author on VMware vSphere and Virtual Infrastructure Security: Securing ESX and the Virtual Environment
Contributing author on VCP VMware Certified Professional on VSphere 4 Study Guide: Exam VCP-410
0 Kudos
rossb2b
Hot Shot
Hot Shot

Here is some sample code: http://communities.vmware.com/thread/92766

0 Kudos
jfields
Enthusiast
Enthusiast

Have you tried the new VI toolkit? See this referenece:

http://www.vmware.com/beta/vitk_win/

Note this is still a Beta release of the toolkit, but it looks like it might solve the customer's issue. The Cmdlets reference manual shows the command would be Move-VM.

0 Kudos
array
Contributor
Contributor

Thanks everyone!

I'm going to try the vi perl toolkit this afternoon. Seems like this is what is going to work! I'll let you know what the results are....

Remko

0 Kudos