Re: [PATCH qemu-server v4 07/17] cpu config: set 'type' field before writing

Arthur Bied-Charreton
2026-05-08T07:49:00Z

On Thu, May 07, 2026 at 02:24:22PM +0200, Fiona Ebner wrote:
> Am 30.04.26 um 6:00 PM schrieb Arthur Bied-Charreton:
> > Fix write_config by adding 'type' to every section, otherwise SectionConfig
> > fails, because it requires each entry in $cfg->{ids} to have a 'type'
> > key.
> >
> > Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
> > ---
> > src/PVE/QemuServer/CPUConfig.pm | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/src/PVE/QemuServer/CPUConfig.pm b/src/PVE/QemuServer/CPUConfig.pm
> > index 78603acc..b606aaa5 100644
> > --- a/src/PVE/QemuServer/CPUConfig.pm
> > +++ b/src/PVE/QemuServer/CPUConfig.pm
> > @@ -537,6 +537,7 @@ sub write_config {
> >
> > # saved in section header
> > delete $model_conf->{cputype};
> > + $model_conf->{type} = $class->type();
>
> Maybe we should rather call check_config() in the API endpoints like
> other section config users do? Or would that not work nicely here?
>
It works well, will switch to that. I was not aware of this helper,
thanks for the tip!
> > }
> >
> > $class->SUPER::write_config($filename, $cfg);
>