Updated: Enabling VMotion from the CLI/Kickstart Script

Whilst esxcfg-vswitch and esxcfg-vmnic can be used to create vSwitch with VMKernel port groups what they are unable to do is set the attribute of “VMotion” on a portgroup which enables the VMotion feature. However, fortunately a separate command-line tool called vimsh can. To use vimsh you must find out what the portgroups “Internal ID”. Each portgroup that gets created is given a name of portgroup 0 and portgroup1. You can find out the portgroup internal ID with the command

esxcfg-vswitch -l

You can then enable the VMotion attribute with the command:

esxcfg-vswitch -a vSwitch3
esxcfg-vswitch -A VMotion vSwitch3
esxcfg-vswitch -L vmnic3 vSwitch3
esxcfg-vmknic -a VMotion -i 10.0.0.3 -n 255.255.255.0
service mgmt-vmware restart
sleep 20
vimsh -n -e “/hostsvc/vmotion/vnic_set portgroup
N

Note:
-n tells vimsh to use non-interactive mode which is suitable for scripting purposes. -e instructors vimsh to execute a command form the prompt. If you wish to learn more about vimsh xtravirt.com now has two whitepapers about the utility which has no man page and little command-line help from VMware. One is about general usage and the other is about using the tools to do advanced network configuration.

I would like to thank Jörg Lew for putting me on to this tip!

Update:
The guys at xtravirt.com and myself were discussing the use of vimsh – I raised the issue of using vimish to advanced network configuration like load-balancing, failover orders, and so on. They/we discovered that for vimish to work affectively you need both restart of the VMware Management Service and sleep – before executing the vimish command in a script. Thanks to the xtravirt.com guys for figuring this one out…

Comments are closed.



Podcast

LinkedIn

If you want to add Mike Laverick on LinkedIn, click on this button:

Mike Laverick

Categories

My Pages

Archives

Other VMware Bloggers