Skip navigation
VMware

This Question is Answered (go to answer)

2 "helpful" answers available (6 pts)
2,728 Views 7 Replies Last post: Jun 4, 2008 8:26 AM by c_shanklin RSS
jessey Novice 9 posts since
Jan 9, 2007
Currently Being Moderated

Jun 2, 2008 7:32 AM

Hot to set vm's CpuFeatureMask ?

I guess I've to use something like:

 

$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec

 

 

$vmConfigSpec.CpuFeatureMask = New-Object VMware.Vim.VirtualMachineCpuIdInfoSpec

 

 

and then use the ReconfigVM_Task

 

 

But I get confused with the type VirtualMachineCpuIdInfoSpec, when I read CpuFeatureMask of an existing VM, it is an array of 10 elements, while the New-Object has only one element and not the same properties..?

 

 

 

Thanks for help.

c_shanklin Master VMware Employees 943 posts since
Dec 3, 2007
Currently Being Moderated
1. Jun 2, 2008 12:22 PM in response to: jessey
Re: Hot to set vm's CpuFeatureMask ?

There's another object under VirtualMachineCpuIdInfoSpec where the real configuration happens.

 

Here's an example that will disable SSE4.1 extensions as shown in the VMware VMotion Info Guide (Appendix C)

 



# Mask SSE 4.1 Extensions to the guest.
function Mask-Extensions($vm) {
     $view = get-view $vm.id

     $vmConfigSpec = new-object VMware.Vim.VirtualMachineConfigSpec
     $featureMask = new-object VMware.Vim.VirtualMachineCpuIdInfoSpec
     $featureMask.info = new-object VMware.Vim.HostCpuIdInfo

     $featureMask.info.ecx = "---- ---- ---- 0--- ---- ---- ---- ----"
     $featureMask.info.level = 1

     $vmConfigSpec.CpuFeatureMask = $featureMask

     $view.ReconfigVM($vmConfigSpec)
}

Mask-Extensions (get-vm "My VM")

 

The code is also attached.

Attachments:
Carter Shanklin | VMware Product Management | @cshanklin
culbeda Novice 13 posts since
Jul 13, 2006
Currently Being Moderated
3. Jun 3, 2008 1:09 PM in response to: c_shanklin
Re: Hot to set vm's CpuFeatureMask ?

 

Thanks for the script.  I've tried it and verified that the change registered in VC, but I'm still getting errors migrating from my Clovertown (X53xx) cores to my Harpertown cores (E54xx).

 

 

The error says:

 

 

Unable to migrate from <server1> to <server2>:  Host CPU is incompatible with the virtual machine's requirements at CPUID level 0x1 register 'ecx'.

 

 

host bits: 0000:0000:0000:1100:1110:0011:1011:1101

 

 

required:  0000:0000:0000:010x:xxx0:0x1x:xxx1:x101

 

 

Mismatch detected for these features:

 

 

  • SSE4.1; refer to KB article 1993 for a possible solution

 

 

 

 

 

Based on that output, I would THINK it woudl work since the one must be masked has been.

 

 

I've reviewed KB 1993 and found it lacking.  If I let VC migrate the machine cold, it puts in the following mask:

 

 

cpuid.1.eax = "xxxx--


xx--


"

cpuid.1.ecx = "--


RRR----


"

cpuid.1.edx = "--


T--"

cpuid.80000001.eax.amd = "xxxx--


xx--


"

cpuid.80000001.ecx.amd = "--


0-"

cpuid.80000001.edx = "--


H--


"

cpuid.80000001.edx.amd = "---R


H--T--"

 

 

(Certainly more involved than the cpuid.1.ecx="---- -


-


0--- -


-


-


" I was putting in.)

 

 

 

Anyway have any good ways to automate this?  Turning all of my new VMs off and migrating them to another host is a bit of a drag.

 

 

 

 

 

 

Thanks!

 

 

c_shanklin Master VMware Employees 943 posts since
Dec 3, 2007
Currently Being Moderated
4. Jun 3, 2008 1:59 PM in response to: culbeda
Re: Hot to set vm's CpuFeatureMask ?

 

I'm not much of an expert on this one, unfortunately. What I find really strange is the AMD extensions it added when you did the cold migration.

 

 

Did you restart the VMs before after you applied the CPU feature mask?

 

 

Carter Shanklin | VMware Product Management | @cshanklin
culbeda Novice 13 posts since
Jul 13, 2006
Currently Being Moderated
5. Jun 3, 2008 2:23 PM in response to: c_shanklin
Re: Hot to set vm's CpuFeatureMask ?

 

I was curious about the AMD mask as well, but it keeps putting them in.  And I performed the change while the VM was powered off.  Still no love.

 

 

culbeda Novice 13 posts since
Jul 13, 2006
Currently Being Moderated
6. Jun 4, 2008 8:06 AM in response to: culbeda
Re: Hot to set vm's CpuFeatureMask ?

 

OK, I have a workaround using a modified version of the script above since I couldn't find sufficient instructions on masking it in VirtualCenter.  (If anyone knows how, I would love to know.  KB 1993 is lacking in detail.)

 

 

Here is a modified version of the script above (thanks again) that updates all of your VMs on a server/farm that mimicks the processor masking that VC does when I cold-migrate a server (minus the AMD masking since I didn't need it):

 

 

Add-PSsnapin VMware.VimAutomation.Core

 

 

  1. Note:  use login credentials if needed

get-viserver <servername>

 

 

  1. Mask SSE 4.1 Extensions to the guest.

function Mask-Extensions($vm) {

$view = get-view $vm.id

        write-host "Setting Mask for:  "$vm.Name

$vmConfigSpec = new-object VMware.Vim.VirtualMachineConfigSpec

$featureMask = new-object VMware.Vim.VirtualMachineCpuIdInfoSpec

$featureMask.info = new-object VMware.Vim.HostCpuIdInfo

$featureMask.info.eax = "xxxx--


xx--


"

$featureMask.info.level = 1

 

 

$featureMask.info.ecx = "--


RR0----


"

$featureMask.info.level = 1

 

 

$featureMask.info.edx = "--


T--"

$featureMask.info.level = 1     

 

 

$vmConfigSpec.CpuFeatureMask = $featureMask

 

 

$view.ReconfigVM($vmConfigSpec)

}

 

get-vm | ForEach {Mask-Extensions ($_)}

 

 

 

 

 

I'm sure there is a better way, but at least I can sleep now knowing that my VMs can HA/DRS.

 

 

c_shanklin Master VMware Employees 943 posts since
Dec 3, 2007
Currently Being Moderated
7. Jun 4, 2008 8:26 AM in response to: culbeda
Re: Hot to set vm's CpuFeatureMask ?

Nice. I'll forward this thread to the people responsible for that KB.

Carter Shanklin | VMware Product Management | @cshanklin

Bookmarked By (0)

Share This Page

Communities