Virtual Wood Blog

VMware, vSphere, ESX, ESXi, PowerCLi and everything else

Virtual Wood Blog - VMware, vSphere, ESX, ESXi, PowerCLi and everything else

How to remove – host currently has no management network redundancy

During times when a LAB is being used with limited resources it is not always possible to have 2 network cards on the ‘Management’ vSwitch. This is not an issue during LAB or test and dev but will always produce ‘host currently has no management network redundancy’ which just makes the display look messy. This can be resolved with the addition of an extra Advanced Option for HA.

The following explains how the error can be removed but please this is only to be used when not in a production environment which should always have a redundant ‘Management’ vSwitch.

Right click on the cluster to be modified
Select Edit Settings
Click on vSphere HA
At the bottom right hand corner click on Advanced Options
Copy the following das.ignoreRedundantNetWarning and paste it under Options with a Value of True
Click Ok
Select Cluster Features
Uncheck Turn On vSphere HA and click OK

Note: This will turn off HA on the cluster but this needs to happen for the Advanced Feature to take effect

Right click on the cluster to be modified
Select Edit Settings
Click on vSphere HA
Check Turn On vSphere HA and click OK

Note: This will turn on HA for the cluster and the error regards ‘host currently has no management network redundancy’ will be gone

By Paul Wood

Changing the ip address of the vMA

During the initial setup on first boot of the vMA the configuration screen will ask questions regarding to ip address and hostname. If during this process an error has been made it is possible run the initial setup again.

I had this very issue as by mistake I selected "yes" to using DHCP. I spent some time looking at conf files but then found a reply on the VMWare forums that had the answer.

Go to the console screen of the vMA which will if it has just restarted prompting for a password to be set. Once this is complete follow the steps listed below:

  1. Press Alt F2 to get to the login screen
  2. Login using vi-admin
  3. Type cd /opt/vmware/vma/bin
  4. Type sudo ./vmware-vma-netconf.pl

This will come up with some rather comical text and the vi-admin password will need to be entered again. Once this has been entered the initial setup will run again allowing for any errors to be corrected.

By Paul Wood

Running vMA 4.1 on VMware Workstation

I came across this issue as I run my LAB as stated before on a laptop which means I cannot run x64 virtual machines on my ESX installations. After a quick search I came across a post by Kenneth van Ditmarsch which took me through the exact problem and below is the fix that I have tried and tested.

I have edited the two lines that need to be changed due to the "" that had been used. If the original version had been copied and pasted then the file would not work and the virtual machine fail.

After importing the new vSphere Management Assistant (vMA) 4.1 on my VMware Workstation 7 environment I noticed that it the virtual machine boots with a memory crash error. The error is “unable to access resume device” message and eventually ends with a kernel panic screen shown below.

The memory crash error can be ignored after checking CentOS blogs. The reason why the vMA virtual machine is hanging is due to the fact that its SCSI card and OS type needs to be changed in the .vmx file

Follow the steps below (credits to Justin for pointing this out to me!)

  • Remove the vMA from the VMware Workstation Inventory
  • Open the .vmx file and change the following to lines to be:

    scsi0.virtualDev = "lsilogic"
    guestOS = "rhel5-64"

  • Add the vMA back to VMware Workstation and boot it up.

Once the vMA has booted succesfully the configuration screen will be see. At this point follow vSphere Management Assistant Guide which will advise on how the vMA should be setup.

By Paul Wood

Configure a LAB with simple PowerCLi commands Part 2

This blog will carry on from part 1 adding more simple functionality to the LAB being created.

The LAB has not changed since part 1 so I will not list the contents again. Please refer back to part 1 for this information.

The following will be added to the LAB in this blog:

  • NTP servers
  • Configure the 1st vSwitch by adding another vmnic
  • Create a 2nd vSwitch with vmnic added
  • Move the ‘VM Network’ portgroup from vSwitch0 to 1
  • Setup a vMotion portgroup using a csv file

To start with we will configure a couple of NTP servers (No need to change the firewall on ESXi).

I will assume that a connection to the VC through PowerCLi has been established.

Please follow the simple instructions below:

  1. Adding NTP servers to the LAB and then restarting the service:
#
#adds two ntp servers and then restarts the ntpd service
#
Add-VmHostNtpServer -NtpServer "ntp1.sandvika.net" -VMHost (Get-VMHost) -Confirm:$false
Add-VmHostNtpServer -NtpServer "ntp2d.mcc.ac.uk" -VMHost (Get-VMHost) -Confirm:$false
$ntpd = Get-VMHostService -VMHost (Get-VMHost) | where {$_.Key -eq 'ntpd'}
Restart-VMHostService $ntpd -Confirm:$false
  1. At present the two hosts that are connected in the LAB only have 1 vmnic (0) attached to vSwitch0. This means that the management vSwitch has no resilience which is of course bad. I will now show the code for adding a 2nd vmnic to this vSwitch. The first example will add the 2nd vmnic to one host and the next code will configure all the host’s the same.
#
#configures a single host vSwitch0 to have two vmnic for resilience
#
$vswitch = Get-VirtualSwitch -VMHost labnode1.lab.local -Name vSwitch0
Set-VirtualSwitch -VirtualSwitch $vswitch -Nic vmnic0, vmnic2 -Confirm:$false

Note: In the above code a single host is being interrogated and only the vSwitch called vSwitch0 is being checked. It is better to specify using –Name

#
#configures all hosts' vSwithc0 to have two vmnic for resilience
#
$hosts = Get-VMHost
$name = $hosts
Foreach ($name in $hosts)
{
$vswitch = Get-VirtualSwitch -VMHost $name -Name vSwitch0
Set-VirtualSwitch -VirtualSwitch $vswitch -Nic vmnic0, vmnic2 -Confirm:$false
}

Note In the above code I have made the code work for us. It is now reading in all the host and then passing this on to an ‘Foreach’ statement so changing all the host’s in a few lines.

  1. We will now configure a 2nd vSwitch with 4 vmnic. This will then be used for the ‘VM Network’. This will of course need to be moved from vSwitch0. The following scripts will add a new vSwitch (1) and then the following script will remove the ‘VM Network’ portgroup from vSwitch0 and create a new one on vSwitch1.
#
#creates a new switch called vSwitch1 and then adds 4 vmnic for all host's
#
$hosts = Get-VMHost
$name = $hosts
Foreach ($name in $hosts)
{
New-VirtualSwitch -VMHost $name -Name vSwitch1
$vswitch = Get-VirtualSwitch -VMHost $name -Name vSwitch1
Set-VirtualSwitch -VirtualSwitch $vswitch -Nic vmnic1, vmnic3, vmnic4, vmnic5 -Confirm:$false
}
  1. We will now remove and then create the ‘VM Network’ portgroup from vSwitch0 to vSwitch1. This will leave the management network free of virtual machine traffic.
#
#removes the 'VM Network' portgroup then creates a new one on a different switch
#
$hosts = Get-VMHost
$name = $hosts
Foreach ($name in $hosts)
{
$vswitch = Get-VirtualSwitch -VMHost $name -Name vSwitch1
$pg = Get-VirtualPortgroup -VMHost $name -Name 'VM Network'
Remove-VirtualPortgroup -VirtualPortgroup $pg -Confirm:$false
$nvmpg =  New-VirtualPortGroup -VirtualSwitch $vswitch -Name 'VM Network'
}
  1. Next we will setup a vMotion portgroup on vSwitch0 for all hosts using a csv file. Thanks has to be given to the following post which helped me get the idea for using the csv file the end product is very different. The csv file needs to be populated with the relevant information for the LAB that is being worked on. This includes the location of the csv file that will be used.
#
#for all hosts this script reads a csv file for vMotion information. This information is then used to add a vMotion portgroup to vSwitch0 adding ip, subnet and then enabling. Once that is complete the gateway is also added
#The location of the .CSV file. This can be local or on a share
#
$getinfo = Import-Csv <a href="file://\\server\share\information.csv">\\server\share\information.csv</a>
$getinfo | % {
$Type = $_.Type #!!!! Case Sensitive  !!!!!!
$gethost = Get-VMHost -Name $_.HostName
$name = $gethosts
$PortGroup = $_.PortGroupName
$IP = $_.IP
$Subnet = $_.Subnet
$kernelGW = $_.KernelGW

#Creates vMotion switch and configures vmkernel gateway (located under DNS and Routing in configuration tab)
Foreach ($name in $gethost) {
IF ($Type -eq "vMotion") {

$vswitch = Get-VirtualSwitch -VMHost $name -Name vSwitch0
$vmotion = New-VirtualPortGroup -VirtualSwitch $vswitch -Name $PortGroup
New-VMHostNetworkAdapter -VMHost $name -PortGroup $PortGroup -VirtualSwitch $vswitch -IP $IP -SubnetMask $subnet -VMotionEnabled: $true

$vmhostnetwork = get-vmhostnetwork $gethost
set-vmhostnetwork -network $vmhostnetwork -vmkernelgateway $kernelGW
}
}
}

This is all for now and I hope it has helped understand in simple examples how powerful PowerCLi is to anyone who needs to manage many hosts. I will cover in the next blog how to add storage amongst other things.

By Paul Wood

Opening PowerCLi fails

Updated

I run Windows 7 x64 and the issue I had is when installing the latest PowerCLi the command box flashes on the screen and then disappears. It seems the issue is related to the target line in the shortcut that is used to launch PowerCLi.

Below is the original line from the installation shortcut with the bold being what causes the issue:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -psc “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1″ -noe -c “. \”C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-VIToolkitEnvironment.ps1\”"

Below is what the line should be changed to again with the text in bold that has been change:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noe -c “Add-PSSnapin VMware.VimAutomation.Core; . \”C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1\”"

Once the line has been changed PowerCLi will launch and open without issue. All that is needed then is to set the signed scripts to run which is done by running the following command at the prompt:

set-executionpolicy remotesigned

Select ‘yes’ and type exit

Open PowerCLi again and you will be prompted with a fully functioning PowerCLi installation to start working with.

By Paul Wood