VMware Cloud Community
darren_boyd
Enthusiast
Enthusiast
Jump to solution

Enabling VMotion from command line

I have deployed ESX 3.0.1 build 35804 to a DL585G2 server via a kickstart file. I have written a small script to set up the network, however I cannot enable vmotion by this method. I am required to use the GUI.

I have attempted to 'echo 1 > /proc/vmware/config/Migrate/Enabled' however when I restart hostd (via service mgmt-vmware restart) the setting reverts to its previous value.

Has anyone successfully managed to enable/disable vmotion via command line?

Reply
0 Kudos
1 Solution

Accepted Solutions
mbrkic
Hot Shot
Hot Shot
Jump to solution

You can use the vimsh command to do this:

vimsh -n -e "/hostsvc/vmotion/vnic_set is the name of the portgroup that you want to enable vmotion on. This portgroup name must be the internal portgroup name (as obtained from 'esxcfg-vswitch -l' and not the friendly portgroup name.

This survives a reboot and reflects in the VCenter GUI and in /proc/vmware/config/Migrate/Enabled.

View solution in original post

Reply
0 Kudos
23 Replies
Jwoods
Expert
Expert
Jump to solution

I know it can be done completely using VMware's SDK. From the commandline you can configure a vmkernel port for vmotion but the function that actually enables it...as far as I know cannot be done.

Reply
0 Kudos
davidbarclay
Virtuoso
Virtuoso
Jump to solution

I don't have access to an ESX host as I type this, but wouldn't

esxcfg-advcfg

do this?

However, I have read somewhere that all esxcfg-* commands won't work in the %post section of a kickstart script as the vmkernal has not loaded/initiated at this time.

I haven't done much with kickstart on ESX yet, so someone with more experience may need to confirm this.

Dave

Reply
0 Kudos
darren_boyd
Enthusiast
Enthusiast
Jump to solution

Interesting, from command line I do the following:

\[root@ESX016PRDESN02 Migrate]# esxcfg-advcfg -g /Migrate/Enabled

Value of Enabled is 1

\[root@ESX016PRDESN02 Migrate]# cat Enabled

Enabled (Enable hot migration support) \[0-1: default = 0]: 1

\[root@ESX016PRDESN02 Migrate]# esxcfg-advcfg -s 0 /Migrate/Enabled

Value of Enabled is 0

\[root@ESX016PRDESN02 Migrate]# esxcfg-advcfg -g /Migrate/Enabled

Value of Enabled is 0

\[root@ESX016PRDESN02 Migrate]# cat Enabled

Enabled (Enable hot migration support) \[0-1: default = 0]: 0

\[root@ESX016PRDESN02 Migrate]# service mgmt-vmware restart

Stopping VMware ESX Server Management services:

VMware ESX Server Host Agent Services \[ OK ]

VMware ESX Server Host Agent Watchdog \[ OK ]

VMware ESX Server Host Agent \[ OK ]

pidof: can't read sid for pid 2191

Starting VMware ESX Server Management services:

VMware ESX Server Host Agent (background) \[ OK ]

Availability report startup (background) \[ OK ]

\[root@ESX016PRDESN02 Migrate]# esxcfg-advcfg -g /Migrate/Enabled

Value of Enabled is 1

\[root@ESX016PRDESN02 Migrate]# cat Enabled

Enabled (Enable hot migration support) \[0-1: default = 0]: 1

As you can see the value doesn't seem to persist.

Reply
0 Kudos
davidbarclay
Virtuoso
Virtuoso
Jump to solution

Seems strange.

I'll be at work in about an hour, I'll try on one of my nodes then and post my findings.

Dave

Reply
0 Kudos
Jwoods
Expert
Expert
Jump to solution

I got the same thing. I wonder is there a value in esx.conf that must be changed to make it stick. Restarting hostd will make it re-read the esx.conf. Hmmm. Interest peaked now!

Reply
0 Kudos
davidbarclay
Virtuoso
Virtuoso
Jump to solution

I have been reading a lot of older posts recently looking for information on setting qlogic queue depths and found several posts from VMware staff saying not to modify the esx.conf file asit would be lost of reboot. They recommend esxcfg-advcfg* instead...

Interesting it doesn't hold.

Have you tried a restart of the server instead of the service? Perhaps there is another init process that commits the changes. Just restarting that one service may reinitialise the .conf file, so the change is never commited

(wild guessing here)

Dave

Reply
0 Kudos
Jwoods
Expert
Expert
Jump to solution

Yep, its a no-no to manually edit the esx.conf ...BUT, I modify it via ks.cfg during the setup. I change the SC mem setting from 256 to 512MB (thanks to Steve Beaver for the script). I also modify grub.conf to make sure the change sticks on reboot. Maybe thats the trick.

BTW, Restart of the server didn't work.

Reply
0 Kudos
havok3114
Contributor
Contributor
Jump to solution

I would love to see a solution for this. I was looking at this as well, but my research told me you could not do it because VMotion is a function of virtual center, not ESX.

I hope someone can figure this out because it is one of the final manual configurations I need to make deploying an ESX host.

Reply
0 Kudos
davidbarclay
Virtuoso
Virtuoso
Jump to solution

I never posted back, but the same happens to me. I now want to make this work. i'll post back if I find anything.

Dave

Reply
0 Kudos
davidbarclay
Virtuoso
Virtuoso
Jump to solution

The last post on this:

http://www.vmware.com/community/thread.jspa?threadID=46887&start=50&tstart=0

Is the best I can find.....not quite what I was hoping for Smiley Sad

Dave

Reply
0 Kudos
mbrkic
Hot Shot
Hot Shot
Jump to solution

You can use the vimsh command to do this:

vimsh -n -e "/hostsvc/vmotion/vnic_set is the name of the portgroup that you want to enable vmotion on. This portgroup name must be the internal portgroup name (as obtained from 'esxcfg-vswitch -l' and not the friendly portgroup name.

This survives a reboot and reflects in the VCenter GUI and in /proc/vmware/config/Migrate/Enabled.

Reply
0 Kudos
darren_boyd
Enthusiast
Enthusiast
Jump to solution

This is Golden!!! What other tricks do you have up your sleeve? This is a very powerful tool you've uncovered. Thanks for all your help.

Reply
0 Kudos
davidbarclay
Virtuoso
Virtuoso
Jump to solution

Well done, I'm impressed. I'll try it out soon.

Dave

Reply
0 Kudos
virtech
Expert
Expert
Jump to solution

This sounds promising. good post!

Reply
0 Kudos
mattpound
Hot Shot
Hot Shot
Jump to solution

This is Golden!!! What other tricks do you have up

your sleeve? This is a very powerful tool you've

uncovered. Thanks for all your help.

Quite alot it would seem. It's well worth a look. I found you can use it to control the startup/shutdown of VMs as well.

http://www.vmware.com/community/message.jspa?messageID=598475#598475

Message was edited by:

mattpound

Reply
0 Kudos
cduffy
VMware Employee
VMware Employee
Jump to solution

This worked:

Put in a script. Make executable.

#!/bin/bash

portvar=$(esxcfg-vswitch -l | awk '/VMotion/ \{print $2}')

cat > /etc/vmware/hostd/hostsvc.xml

EOF

esxcfg-advcfg -s 1 /Migrate/Enabled

Reply
0 Kudos
davidbarclay
Virtuoso
Virtuoso
Jump to solution

...can we assume VMware support have no concerns with this method?

Dave

Reply
0 Kudos
cduffy
VMware Employee
VMware Employee
Jump to solution

Sadly, works and supported may not neccessarily be the same thing.

(insert use at own risk verbage here)

Reply
0 Kudos
etamir
Enthusiast
Enthusiast
Jump to solution

cduffy,

Thanks for that scripted portion...

Reply
0 Kudos