<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>57358</bug_id>
          
          <creation_ts>2025-12-25 12:57:09 +0300</creation_ts>
          <short_desc>Не используется значение по умолчанию для CPU при импорте ВМ из OVA, OVF</short_desc>
          <delta_ts>2026-07-23 21:53:29 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>pve-qemu-server</component>
          <version>unstable</version>
          <rep_platform>x86_64</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P5</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Vladislav Glinkin">glinkinvd</reporter>
          <assigned_to name="kozorizki@altlinux.org">kozorizki</assigned_to>
          <cc>andy</cc>
    
    <cc>darisishe</cc>
    
    <cc>shaba</cc>
    
    <cc>shrek</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>279579</commentid>
    <comment_count>0</comment_count>
    <who name="Vladislav Glinkin">glinkinvd</who>
    <bug_when>2025-12-25 12:57:09 +0300</bug_when>
    <thetext>Версия пакета: pve-qemu-server-9.0.18-alt1

Шаги воспроизведения:
1) Импортировать виртуальную машину из OVF файла без явного указания типа CPU, используя значение по умолчанию.

Фактический результат:
Если при импорте виртуальной машины не указать тип CPU явно, то возникает ошибка &quot;cpu: invalid format - CPU is missing cputype&quot;. Значение по умолчанию (kvm64) не используется.

Похоже, что дело в функции validate_cpu_conf, объявленной в /usr/share/perl5/PVE/QemuServer/CPUConfig.pm:

sub validate_cpu_conf {  
   my ($cpu) = @_;    
   # required, but can&apos;t be forced in schema since it&apos;s encoded in section header for custom models  
   die &quot;CPU is missing cputype\n&quot; if !$cpu-&gt;{cputype};  
   return $cpu;  
}
В случае, если тип CPU не определён - то она даже не пытается использовать значением по умолчанию.

При создании виртуальных машин такое поведение не воспроизводится - значение по умолчанию используется.

Если в функцию validate_cpu_conf добавить установку значения по умолчанию, то данное поведение не воспроизводится. Как пример:

--- a/usr/share/perl5/PVE/QemuServer/CPUConfig.pm  
+++ b/usr/share/perl5/PVE/QemuServer/CPUConfig.pm  
@@ -310,6 +310,9 @@ PVE::JSONSchema::register_format(&apos;pve-cpu-conf&apos;, $cpu_fmt, \&amp;validate_cpu_conf);  
sub validate_cpu_conf {  
    my ($cpu) = @_;  
    # required, but can&apos;t be forced in schema since it&apos;s encoded in section header for custom models  
+    if (!defined($cpu-&gt;{cputype}) || $cpu-&gt;{cputype} eq &apos;&apos;) {  
+        $cpu-&gt;{cputype} = $cpu_fmt-&gt;{cputype}-&gt;{default};  
+    }  
    die &quot;CPU is missing cputype\n&quot; if !$cpu-&gt;{cputype};  
    return $cpu;  
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>291583</commentid>
    <comment_count>1</comment_count>
    <who name="Repository Robot">repository-robot</who>
    <bug_when>2026-07-23 21:53:29 +0300</bug_when>
    <thetext>pve-qemu-server-9.2.0-alt1 -&gt; sisyphus:

Thu Jul 23 2026 Sergey Konev &lt;darisishe@altlinux&gt; 9.2.0-alt1
- 9.2.0
- API: QEMU: fail resize if disk is already at requested size (Closes: 57305)
- cpu config: use default cputype when validating CPU config (Closes: 57358)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>