Friday, July 24, 2015

Virtual Machine startup - shutdown with ESXi host

Today we got a request from client to configure some specific site server virtual machines to automatically start and stop with host as there is frequent power cut on these sites so client wanted to make sure these VMs would come online as soon as the host will power on. 

These are individual hosts so no HA or DRS configured means no need to worry about a case where you migrated VM to another host and this configuration became irrelevant. 

Note: BTW automatic startup is not supported with vSphere HA.

Configuring a VM to startup - shutdown with ESXi host is very easy,

Using #C client,
  • In the vSphere Client inventory, select the host where the virtual machine is located and click the Configuration tab.
  • Under Software, click Virtual Machine Startup/Shutdown and click Properties.
  • Select Allow virtual machines to start and stop automatically with the system, then Configure the startup and shutdown behavior.


 for detailed info about available optional settings, checkout VMware vSphere Documentation Center =>> Managing Virtual Machines section.

Using Web Client,
  • In the vSphere Web Client, navigate to the host where the virtual machine is located.
  • Select Manage > Settings.

  • Under Virtual Machines, select VM Startup/Shutdown and click Edit, edit settings dialog box will open,
  • Select Allow virtual machines to start and stop automatically with the system, then Configure the startup and shutdown behavior options.

That't it... :)


Saturday, July 4, 2015

vNIC upgrade issue: IP address already assigned to another adapter

Last week when I was upgrading VMware Tools and vNICs of few virtual machines, on two server 2003 machines faced this issue where I was not able to assign  previously assigned IP to newly added vNIC card, ended up with this error,
Some people say what a big deal its a very common post P2V or vNIC upgrade issue we face, agreed.

But I was surprised because even after following best practice during the network card upgrade why I still faced this issue. Here is what I did during the upgrade activity:
  • Updated VMware Tools and rebooted the VM 
  • Noted down the IP address then uninstalled the NIC card from device manager and powered off the VM 
  • Removed the old e1000/vmxnet vNIC and added VMXNET3 network card then powered on VM
  • Now tried to assign the previously assigned IP address to newly added vNIC
As I already removed the previous vNIC so was supposed to not face this issue anyways now come to fix. 

Most of the time we can fix the issue by simply running this env variable command 
set devmgr_show_nonpresent_devices=1, (leave the command prompt open)


and then delete the ghosted network adapters from Device manager (view=> show hidden devices),

 Now close the command prompt.

But what if you are still not seeing any ghosted network adapter in device manager ((view=> show hidden devices is checked).

If the above listed command does not work (a possibility in Windows Server 2000 and 2003), you may need to add this environment variable devmgr_show_nonpresent_devices to Windows and set its value to 1 in order view/delete the ghosted network adapter from device manager, to do so,
  • Right-click the My Computer desktop icon and choose Properties.
  • Click the Advanced tab and select Environment Variables.


    • In the System variables section, click New.


    • Set the Variable name to devmgr_show_nonpresent_devices and set the Variable value to 1 to enable the parameter.


    • Click OK to add the variable to Windows.
    Now open the Device Manager, Click View > Show Hidden Devices.
    1. Expand the Network Adapters tree 
    2. Right-click the dimmed network adapter, then click Uninstall.
    3. Once all of the grayed out NICs are uninstalled, assign the IP address to the virtual NIC.
    For more info refer to VMware KB# 1179 & Microsoft KB# 269155.

    Update, 05/10/2015: Last day when I was working on a Windows Server 2008R2 machine, found one may assign an already assigned IP to new vNIC even without removing the old ghosted vNIC. As the warning message suggest

    Once you would click Yes, then system will remove the conflicted static IP configuration from ghosted NIC card.
    But if you had assigned a name to vNIC and want to keep that same name for new network adaptor then you will have to first remove the old hidden vNIC.

    The above process works fine in case of MS server 2003 but its slightly different for Server 2008 and that might be very frustrating if you are not aware.

    The difference is, you need to start the command pormpt in elevated mode (run as Administrator) and after running the SET DEVMGR_SHOW_NONPRESENT_DEVICES=1 cmd you also need to open the device manager from same cmd by running START DEVMGMT.MSC command.

    Other steps are same.

     
    That's it.... :)