I seriously struggled with this one, never used Dumper so much in my entire life.
There are likely better ways to do it but this to me is most clear and works so I'll just leave this here:
#set cpu mask to Hide NX flag my $hostCpu = HostCpuIdInfo->new('eax' => '--------------------------------',
'ebx' => '--------------------------------',
'ecx' => '--------------------------------',
'edx' => '-----------0--------------------',
'level' => '-2147483647'); my $hostCpu1 = HostCpuIdInfo->new('eax' => '--------------------------------',
'ebx' => '--------------------------------',
'ecx' => '--------------------------------',
'edx' => '-----------0--------------------',
'level' => '-2147483647',
'vendor' => 'amd');
my $cpuspec = new VirtualMachineCpuIdInfoSpec (info=>$hostCpu, operation => new ArrayUpdateOperation('edit'));
my $cpuspec1 = new VirtualMachineCpuIdInfoSpec (info=>$hostCpu1, operation => new ArrayUpdateOperation('edit'));
my @mask; push(@mask, $cpuspec); push(@mask, $cpuspec1);
my $vm_config_spec = VirtualMachineConfigSpec->new(
version => $args{vmversion},
name => $args{vmname},
memoryMB => $args{memory},
files => $files,
numCPUs => $args{num_cpus},
guestId => $args{guestid},
memoryHotAddEnabled => $args{hotmem},
cpuHotAddEnabled => $args{hotcpu},
cpuFeatureMask => \@mask,
deviceChange => \@vm_devices);