Category Archives: VMware

Enhanced Vmotion

I was just reading up a little more on Enhanced Vmotion as was impressed that we no longer have to worry about CPU architecture and found the following useful information:

Enhanced VMotion Compatibility

Because new features are constantly incorporated into new CPUs, you are likely to encounter incompatibilities and therefore face problems while attempting migration with VMotion. Such CPU incompatibilities limit VMotion to a certain range of CPUs. VMware has investigated the issues and concluded that there is no software‐only solution to this problem. To minimize exacerbation of the compatibility problem with time, VMware has worked with CPU vendors to facilitate live migration of virtual machines across different CPU revisions.

VMware Enhanced VMotion Compatibility (EVC)—available in VMware Infrastructure 3 beginning with version 3.5 Update 2—facilitates VMotion between different CPU generations, taking advantage of Intel Flex Migration and AMD‐V Extended Migration technologies. When enabled for a cluster, EVC ensures that all CPUs within the cluster are VMotion compatible. CPUs starting with Intel 45nm Core 2 (Penryn) and AMD Second Generation Opteron (revision E or F) incorporate FlexMigration and Extended Migration technologies, respectively.

The EVC feature allows the virtualization layer to mask or hide certain features by modifying the semantics of the CPUID instruction and hides certain CPUID feature bits, even from nonprivileged code. For example, with support from hardware, the virtualization layer modifies the semantics of the CPUID instruction to mask or hide the SSE4.1 feature from any code (privileged or nonprivileged) to make CPUs differing in this feature compatible for VMotion.

Specifics on CPU compatibility with the Enhanced VMotion Compatibility feature are available in the Basic System Administration guide for each ESX release starting with version 3.5 Update 2.

EVC utilizes hardware support to modify the semantics of the CPUID instruction only. It does not disable the feature itself. For example, if an attempt to disable SSE4.1 is made by applying the appropriate masks to a CPU that has these features, this feature bit indicates SSE4.1 is not available to the guest or the application, but the feature and the SSE4.1 instructions themselves (such as PTESE and PMULLD) are still available for use. This implies applications that do not use the CPUID instruction to determine the list of supported features, but use try‐catch undefined instructions (#UD) instead, can still detect the existence of this feature.

Therefore, for EVC to be useful, application developers must adhere to recommended guidelines on feature detection. CPU vendors recommend that software programmers query CPUID prior to using special instructions and features available on their CPUs. If this guideline is followed by programmers, EVC is a reliable mechanism for live migration of x86 virtual machines across varied hardware. Thus, you can use EVC to enable an entire cluster to use the same set of basic features, allowing migration with VMotion across any two nodes in the cluster. VirtualCenter can also set up new hardware add‐ons to the cluster and apply these masks.

Conclusion
Virtualization is still a relatively new technological innovation, and the area of live migration of virtual machines is still in its infancy. VMware VMotion is an extremely useful and critical feature in data centers to ensure business continuity, resource optimization, and a host of other benefits. VirtualCenter performs numerous compatibility checks before allowing migration with VMotion. Some stringent CPU compatibility checks for VMotion are necessary for proper functioning of a virtual machine after migration. Though users can override these checks and complete VMotion by applying appropriate masks, the virtual machines and applications may not function properly if they rely on features particular to the underlying hardware. The x86
CPU vendors did not initially envision live migration of virtual machines and design CPUs to support it.

VMware has worked with CPU vendors to support such features, taking advantage of Intel Flex Migration and AMD‐V Extended Migration technologies. With Enhanced VMotion Compatibility, VMware Infrastructure works in conjunction with hardware to support live migration of virtual machines in a wider range of environments. Effective use of enhanced VMotion also depends on using application software that follows recommended guidelines to support CPU feature detection.

Quick Stats from VMware for reports

I wrote another quick script today as my powershell skills grow!

The following script can be used to give you a JPG outputted graph of some stats that you can choose, handy for reports.

It can easily be adjusted to perform stats on the ESX servers (vmhost) as well.

Example output (My Test server names have been blurred):

Chart

connect-VIServer yourserver

# Set the following 3 variables for your needs
# Example stats are:
# % CPU Usage – cpu.usage.average
# Mhz CPU Usage – cpu.usageMHZ.average
# % Memory Usage – mem.usage.average
# Kbps Network Usage – net.usage.average
# Kbps Disk Usage – disk.usage.average

$Caption = "CPU Usage"
$Stat = "cpu.usage.average"
$NumToReturn = 20

$categories = @()
$values = @()
$chart = new-object -com OWC11.ChartSpace.11
$chart.Clear()
$c = $chart.charts.Add(0)
$c.Type = 4
$c.HasTitle = "True"
$series = ([array] $chart.charts)[0].SeriesCollection.Add(0)

Get-Stat -Entity (Get-vm) -Stat $stat -MaxSamples 1 -Realtime |Sort-Object Value -Descending | Select-Object Entity, Value -First $NumToReturn | foreach-object {

$categories += $_.Entity.Name
$values += $_.Value * 1
}
$series.Caption = $Caption
$series.SetData(1, -1, $categories)
$series.SetData(2, -1, $values)
$filename = (resolve-path .).Path + "\Chart.jpg"
$chart.ExportPicture($filename, "jpg", 800, 500)
invoke-item $filename

ESXi Free from 28 July

Today, VMware is taking another step towards making virtualisation ubiquitous by announcing that VMware ESXi will be available for download at no cost as of the week of July 28, 2008.

VMware has always believed that virtualisation needs to be ubiquitous. Since 2001, VMware has provided the industry’s most popular and reliable hypervisor used by more than 100,000 customers. During this evolution, partners like you have been critical in educating and delivering virtualisation to customers of all sizes. In December 2007, VMware announced significant improvements with ESXi – its third-generation, stand-alone hypervisor. With its smaller footprint and OS-independence, ESXi ensures even higher levels of security and reliability while making virtualisation easier than ever to deploy.

More info can be found here http://www.chriswolf.com/?p=175

Give the users a console again

Granting Console Access and Power On/Off functions to your Users

Sometimes a user will complain that they need console access to there servers or permission to turn on/off or reset there machines if there is a problem, as the servers become virtualised this can be achieved in a number of ways, I have documented a couple of these ways below…

  1. Apply the correct permissions for the user you wish to access the virtual machine limiting them to there required security permissions.

If you’re using VirtualCenter, you can use roles and groups to assign permission to users such that they would only see the VM’s that they have permission to and could have various levels of rights over those VM’s. This is covered in depth starting at page 261 here – http://www.vmware.com/pdf/vi3_35/esx_3/r35/vi3_35_25_admin_guide.pdf.

You could do something similar with ESX 3.0.x but that was removed with ESX 3.5.

With ESX 3.5 you can create individual users, but you can’t grant permissions to specific VM’s without VirtualCenter.

  1. Once you have completed the permissions side of things start your favourite web browser and browse to your VC or ESX server web interface by using https://yourservername/ui

clip_image002

  1. Log into the web interface using your own Administrator account details, we will use this to create the link which you will be providing to the end user.
  1. clip_image004

    Use the navigation bar (blue area) on the left hand side of the screen to navigate to and click on the Virtual Machine you wish to give access to

  1. clip_image006

    Click the “Generate Remote Console URL” on the right hand side of the screen

  1. clip_image008

    Use this form to customise what you would like the user to see.

  1. Once completed you can copy the link from the light blue area and send this to the user.

There is also a dedicated client for accessing machines on the VC/ESX servers which also works very well, this can be downloaded from the following area: http://www.ntpro.nl/blog/archives/170-The-games-have-begun.html

clip_image010

More Powershell

I have now updated my first powershell script, this enables you to open a pre-configured spreadsheet with graphs and fill in the cells needed to populate the graphs and produce a nice 2 minute report on the state of the infrastructure, this is currently customised to my particular clusters but can be easily modified…

For a copy of the spreadsheet drop me a mail or a comment on this post.

Get-VIServer yourservername

$Excel = New-Object -Com Excel.Application
$Excel.visible = $True
$Excel = $Excel.Workbooks.Open("C:\Resource.xls")
$Sheet = $Excel.WorkSheets.Item(2)

$intRow = 11
$colItems = Get-Datastore | Select-Object -property "Name","FreeSpaceMB","CapacityMB" | Sort-Object Name
$totalcapacity = 0

foreach ($objItem in $colItems)
{
    $Sheet.Cells.Item($intRow,2) = $objItem.Name
$used = $objItem.CapacityMB – $objItem.FreeSpaceMB
$Sheet.Cells.Item($intRow,3) = $used
$totalcapacity = $totalcapacity + $objItem.CapacityMB

$intRow = $intRow + 1

}
$Sheet = $Excel.WorkSheets.Item(1)
$Sheet.Cells.Item(5,4) = $totalcapacity

$Sheet = $Excel.WorkSheets.Item(3)
$Sheet.Cells.Item(4,3) = "Done"
$Sheet = $Excel.WorkSheets.Item(1)

$intRow = 17
foreach ($objItem in $colItems)
{
    $Sheet.Cells.Item($intRow,2) = $objItem.Name
$Sheet.Cells.Item($intRow,3) = $objItem.CapacityMB

$intRow = $intRow + 1

}

$totalmem = 0
$cpumhz = 0
$totalcpu = 0

Get-VMHost | %{Get-View $_.ID} | %{
$esx = "" | select NumCpuCores, Hz, Memory
$esx.NumCpuCores = $_.Hardware.CpuInfo.NumCpuCores
$esx.Hz = $_.Hardware.CpuInfo.Hz
$esx.Memory = $_.Hardware.MemorySize
 
$totalmem = $totalmem + $esx.Memory
$cpumhz = $esx.numCpuCores * $esx.Hz
$totalcpu = $totalcpu + $cpumhz
}
$formatedmem = ($totalmem /1024) /1024
$formatedcpu = ($totalcpu /1000) /1000
 
$Sheet = $Excel.WorkSheets.Item(1)
$Sheet.Cells.Item(6,4) = $formatedmem
$Sheet = $Excel.WorkSheets.Item(3)
$Sheet.Cells.Item(5,3) = "Done"
$Sheet = $Excel.WorkSheets.Item(1)
$Sheet.Cells.Item(7,4) = $formatedcpu
$Sheet = $Excel.WorkSheets.Item(3)
$Sheet.Cells.Item(6,3) = "Done"

$Sheet = $Excel.WorkSheets.Item(2)
$colItems = Get-Stat -Entity (Get-ResourcePool -Name "Live") -Stat cpu.usagemhz.average -MaxSamples 1 -Realtime
foreach ($objItem in $colItems)
{
    $Sheet.Cells.Item(4,4) = $objItem.Value
}

$Sheet = $Excel.WorkSheets.Item(3)
$Sheet.Cells.Item(7,3) = "Done"
$Sheet = $Excel.WorkSheets.Item(2)

$colItems = Get-Stat -Entity (Get-ResourcePool -Name "Test") -Stat cpu.usagemhz.average -MaxSamples 1 -Realtime
foreach ($objItem in $colItems)
{
    $Sheet.Cells.Item(5,4) = $objItem.Value
}
$Sheet = $Excel.WorkSheets.Item(3)
$Sheet.Cells.Item(8,3) = "Done"
$Sheet = $Excel.WorkSheets.Item(2)
$colItems = Get-Stat -Entity (Get-ResourcePool -Name "Live") -Stat mem.active.average -MaxSamples 1 -Realtime
foreach ($objItem in $colItems)
{
    $promem = ($objItem.Value /1000)
$Sheet.Cells.Item(4,3) = $promem
}

$Sheet = $Excel.WorkSheets.Item(3)
$Sheet.Cells.Item(9,3) = "Done"
$Sheet = $Excel.WorkSheets.Item(2)
$colItems = Get-Stat -Entity (Get-ResourcePool -Name "Test") -Stat mem.active.average -MaxSamples 1 -Realtime
foreach ($objItem in $colItems)
{
    $nonpromem = ($objItem.Value /1000)
$Sheet.Cells.Item(5,3) = $nonpromem
}
$Sheet = $Excel.WorkSheets.Item(3)
$Sheet.Cells.Item(10,3) = "Done"
$Sheet.Cells.Item(13,3) = "Done"

My first Powershell

I have seen on many if the VMware followers forums a way to use Excel to send commands to the VI server to create machines, alter vlans etc.

I wanted a way to export information and could not find anyone doing this yet other than using the export-csv so I created the following script which will export all the information for all Virtual machines in your virtual center straight to excel ready for you to manipulate. 

Don't forget to change yourservername for your virtual center server.

Get-VIServer yourservername

$Excel = New-Object -Com Excel.Application
$Excel.visible = $True
$Excel = $Excel.Workbooks.Add(1)

$Sheet = $Excel.WorkSheets.Item(1)
$Sheet.Cells.Item(1,1) = "Name"
$Sheet.Cells.Item(1,2) = "Power State"
$Sheet.Cells.Item(1,3) = "Description"
$Sheet.Cells.Item(1,4) = "Number of CPUs"
$Sheet.Cells.Item(1,5) = "Memory (MB)"

$WorkBook = $Sheet.UsedRange
$WorkBook.Font.Bold = $True

$intRow = 2
$colItems = Get-VM | Select-Object -property "Name","PowerState","Description","NumCPU","MemoryMB"

foreach ($objItem in $colItems) {
    $Sheet.Cells.Item($intRow,1) = $objItem.Name
           
    $powerstate = $objItem.PowerState
    If ($PowerState -eq 1) {$power = "Powerd On"}
        Else {$power = "Powerd Off"}
       
    $Sheet.Cells.Item($intRow,2) = $power
    $Sheet.Cells.Item($intRow,3) = $objItem.Description
    $Sheet.Cells.Item($intRow,4) = $objItem.NumCPU
    $Sheet.Cells.Item($intRow,5) = $objItem.MemoryMB

$intRow = $intRow + 1

}
$WorkBook.EntireColumn.AutoFit()
Clear

Virtualisation Congress

Virtualization.info, the leading virtualisation news and analysis site since 2003 has announced the launch of Virtualization Congress (http://www.virtualizationcongress.com), the world’s first vendor independent virtualisation event, bringing together the industry’s biggest selection of virtualisation players, from the recognized leaders to the newest start-ups.

The conference, to be held at London’s ExCel, 14th-16th October, 2008, presents an ideal opportunity for current and prospective users of virtualisation technologies to hear directly from the companies at the cutting edge of their development; at the same time, in the same place for the first time ever.

VMware Certified Design Expert

The VMware Certified Design Engineer certification will be available later this year. The certification involved taking several courses and exams, including:

  • Courses
    Install and Configure
    DSA
    Design course (currently under development)
  • Exam
    VCP on VI3
    Enterprise Exam (currently in private beta)
    Design Exam (currently under development)

Once all of this has been completed the candidate must present a defensible design to a panel of VMware Solution Architects for consideration. As you may guess, this is a certification specifically targeted for VMware partners that will be assisting VMware in design and deployment and is only intended for a relatively small audience. That being said, the Enterprise Exam, which has a number of live lab style questions, should be available to the public in the next few months and may become part of a mid-line certification between VCP on VI3 and VCDX. That is also under consideration.