add 'flags' property to cpu option

Currently this only allows specifying '+pcid' or '-pcid'
but might be extended in the future.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
(cherry picked from commit 39fd79e2ad)
This commit is contained in:
Wolfgang Bumiller 2018-01-09 15:30:14 +01:00 committed by Fabian Grünbichler
parent 77539e629d
commit 484262894f

View File

@ -151,6 +151,16 @@ my $cpu_fmt = {
optional => 1, optional => 1,
default => 0 default => 0
}, },
flags => {
description => "Override CPU flags. Currently only the 'pcid' flag is supported."
. " Use '+pcid' or '-pcid' to enable or disable."
. " This takes precedence over flags coming from the cpu type or changed implicitly via the OS type.",
format_description => 'flaglist',
type => 'string',
pattern => '[+-]pcid',
optional => 1,
default => '',
},
}; };
my $watchdog_fmt = { my $watchdog_fmt = {
@ -3081,6 +3091,10 @@ sub config_to_command {
or die "Cannot parse cpu description: $cputype\n"; or die "Cannot parse cpu description: $cputype\n";
$cpu = $cpuconf->{cputype}; $cpu = $cpuconf->{cputype};
$kvm_off = 1 if $cpuconf->{hidden}; $kvm_off = 1 if $cpuconf->{hidden};
if (defined(my $flags = $cpuconf->{flags})) {
push @$cpuFlags, $flags;
}
} }
push @$cpuFlags , '+lahf_lm' if $cpu eq 'kvm64'; push @$cpuFlags , '+lahf_lm' if $cpu eq 'kvm64';