Skip to main content

clientapi_pve/models/
qemu_create_vm_request.rs

1/*
2 * Proxmox Virtual Environment API
3 *
4 * Generated from apidoc.js. NOT an official Proxmox specification. See https://pve.proxmox.com/pve-docs/api-viewer/ for the upstream documentation.
5 *
6 * The version of the OpenAPI document: 9.x
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq)]
15pub struct QemuCreateVmRequest {
16
17
18    /// Enable/disable ACPI.
19    pub acpi: Option<models::PveBoolean>,
20
21    /// List of host cores used to execute guest processes, for example: 0,5,8-11
22    pub affinity: Option<String>,
23
24    /// Enable/disable communication with the QEMU Guest Agent and its properties.
25    pub agent: Option<Box<models::PveAgentField>>,
26
27    /// Allow memory pages of this guest to be merged via KSM (Kernel Samepage Merging).
28    pub allow_ksm: Option<models::PveBoolean>,
29
30    /// Secure Encrypted Virtualization (SEV) features by AMD CPUs
31    pub amd_sev: Option<String>,
32
33    /// Virtual processor architecture. Defaults to the host architecture.
34    pub arch: Option<models::PveArchEnum>,
35
36    /// The backup archive. Either the file system path to a .tar or .vma file (use '-' to pipe data from stdin) or a proxmox storage backup volume identifier.
37    pub archive: Option<String>,
38
39    /// Arbitrary arguments passed to kvm, for example:  args: -no-reboot -smbios 'type=0,vendor=FOO'  NOTE: this option is for experts only. 
40    pub args: Option<String>,
41
42    /// Configure a audio device, useful in combination with QXL/Spice.
43    pub audio0: Option<Box<models::PveAudioField>>,
44
45    /// Automatic restart after crash (currently ignored).
46    pub autostart: Option<models::PveBoolean>,
47
48    /// Amount of target RAM for the VM in MiB. The balloon driver is enabled by default, unless it is explicitly disabled by setting the value to zero.
49    pub balloon: Option<i64>,
50
51    /// Select BIOS implementation.
52    pub bios: Option<models::PveBiosEnum>,
53
54    /// Specify guest boot order. Use the 'order=' sub-property as usage with no key or 'legacy=' is deprecated.
55    pub boot: Option<String>,
56
57    /// Enable booting from specified disk. Deprecated: Use 'boot: order=foo;bar' instead.
58    pub bootdisk: Option<String>,
59
60    /// Override I/O bandwidth limit (in KiB/s).
61    pub bwlimit: Option<i64>,
62
63    /// This is an alias for option -ide2
64    pub cdrom: Option<String>,
65
66    /// cloud-init: Specify custom files to replace the automatically generated ones at start.
67    pub cicustom: Option<String>,
68
69    /// cloud-init: Password to assign the user. Using this is generally not recommended. Use ssh keys instead. Also note that older cloud-init versions do not support hashed passwords.
70    pub cipassword: Option<String>,
71
72    /// Specifies the cloud-init configuration format. The default depends on the configured operating system type (`ostype`. We use the `nocloud` format for Linux, and `configdrive2` for windows.
73    pub citype: Option<models::PveCitypeEnum>,
74
75    /// cloud-init: do an automatic package upgrade after the first boot.
76    pub ciupgrade: Option<models::PveBoolean>,
77
78    /// cloud-init: User name to change ssh keys and password for instead of the image's configured default user.
79    pub ciuser: Option<String>,
80
81    /// The number of cores per socket.
82    pub cores: Option<i64>,
83
84    /// Emulated CPU type.
85    pub cpu: Option<String>,
86
87    /// Limit of CPU usage.  NOTE: If the computer has 2 CPUs, it has total of '2' CPU time. Value '0' indicates no CPU limit.
88    pub cpulimit: Option<f64>,
89
90    /// CPU weight for a VM. Argument is used in the kernel fair scheduler. The larger the number is, the more CPU time this VM gets. Number is relative to weights of all the other running VMs.
91    pub cpuunits: Option<i32>,
92
93    /// Description for the VM. Shown in the web-interface VM's summary. This is saved as comment inside the configuration file.
94    pub description: Option<String>,
95
96    /// Configure a disk for storing EFI vars. Use the special syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume. Note that SIZE_IN_GiB is ignored here and that the default EFI vars are copied to the volume instead. Use STORAGE_ID:0 and the 'import-from' parameter to import from an existing volume.
97    pub efidisk0: Option<Box<models::PveEfidiskField>>,
98
99    /// Allow to overwrite existing VM.
100    pub force: Option<models::PveBoolean>,
101
102    /// Freeze CPU at startup (use 'c' monitor command to start execution).
103    pub freeze: Option<models::PveBoolean>,
104
105    /// Add the VM as a HA resource after it was created.
106    pub ha_managed: Option<models::PveBoolean>,
107
108    /// Script that will be executed during various steps in the vms lifetime.
109    pub hookscript: Option<String>,
110
111    /// Selectively enable hotplug features. This is a comma separated list of hotplug features: 'network', 'disk', 'cpu', 'memory', 'usb' and 'cloudinit'. Use '0' to disable hotplug completely. Using '1' as value is an alias for the default `network,disk,usb`. USB hotplugging is possible for guests with machine version >= 7.1 and ostype l26 or windows > 7.
112    pub hotplug: Option<String>,
113
114    /// Enables hugepages memory.  Sets the size of hugepages in MiB. If the value is set to 'any' then 1 GiB hugepages will be used if possible, otherwise the size will fall back to 2 MiB.
115    pub hugepages: Option<models::PveHugepagesEnum>,
116
117    /// A file-based storage with 'images' content-type enabled, which is used as an intermediary extraction storage during import. Defaults to the source storage.
118    pub import_working_storage: Option<String>,
119
120    /// Trusted Domain Extension (TDX) features by Intel CPUs
121    pub intel_tdx: Option<String>,
122
123    /// Inter-VM shared memory. Useful for direct communication between VMs, or to the host.
124    pub ivshmem: Option<Box<models::PveIvshmemField>>,
125
126    /// Use together with hugepages. If enabled, hugepages will not not be deleted after VM shutdown and can be used for subsequent starts.
127    pub keephugepages: Option<models::PveBoolean>,
128
129    /// Keyboard layout for VNC server. This option is generally not required and is often better handled from within the guest OS.
130    pub keyboard: Option<models::PveKeyboardEnum>,
131
132    /// Enable/disable KVM hardware virtualization.
133    pub kvm: Option<models::PveBoolean>,
134
135    /// Start the VM immediately while importing or restoring in the background.
136    pub live_restore: Option<models::PveBoolean>,
137
138    /// Set the real time clock (RTC) to local time. This is enabled by default if the `ostype` indicates a Microsoft Windows OS.
139    pub localtime: Option<models::PveBoolean>,
140
141    /// Lock/unlock the VM.
142    pub lock: Option<models::PveQemuLockEnum>,
143
144    /// Specify the QEMU machine.
145    pub machine: Option<Box<models::PveMachineField>>,
146
147    /// Memory properties.
148    pub memory: Option<Box<models::PveMemoryField>>,
149
150    /// Set maximum tolerated downtime (in seconds) for migrations. Should the migration not be able to converge in the very end, because too much newly dirtied RAM needs to be transferred, the limit will be increased automatically step-by-step until migration can converge. Will be capped to 2000 seconds (maximum in QEMU).
151    pub migrate_downtime: Option<f64>,
152
153    /// Set maximum speed (in MB/s) for migrations. Value 0 is no limit.
154    pub migrate_speed: Option<i64>,
155
156    /// Set a name for the VM. Only used on the configuration web interface.
157    pub name: Option<String>,
158
159    /// cloud-init: Sets DNS server IP address for a container. Create will automatically use the setting from the host if neither searchdomain nor nameserver are set.
160    pub nameserver: Option<String>,
161
162    /// Enable/disable NUMA.
163    pub numa: Option<models::PveBoolean>,
164
165    /// Specifies whether a VM will be started during system bootup.
166    pub onboot: Option<models::PveBoolean>,
167
168    /// Specify guest operating system. This is used to enable special optimization/features for specific operating systems:  [horizontal] other;; unspecified OS wxp;; Microsoft Windows XP w2k;; Microsoft Windows 2000 w2k3;; Microsoft Windows 2003 w2k8;; Microsoft Windows 2008 wvista;; Microsoft Windows Vista win7;; Microsoft Windows 7 win8;; Microsoft Windows 8/2012/2012r2 win10;; Microsoft Windows 10/2016/2019 win11;; Microsoft Windows 11/2022/2025 l24;; Linux 2.4 Kernel l26;; Linux 2.6 - 7.X Kernel solaris;; Solaris/OpenSolaris/OpenIndiania kernel 
169    pub ostype: Option<models::PveQemuOstypeEnum>,
170
171    /// Add the VM to the specified pool.
172    pub pool: Option<String>,
173
174    /// Sets the protection flag of the VM. This will disable the remove VM and remove disk operations.
175    pub protection: Option<models::PveBoolean>,
176
177    /// Allow reboot. If set to '0' the VM exit on reboot.
178    pub reboot: Option<models::PveBoolean>,
179
180    /// Configure a VirtIO-based Random Number Generator.
181    pub rng0: Option<String>,
182
183    /// SCSI controller model
184    pub scsihw: Option<models::PveScsihwEnum>,
185
186    /// cloud-init: Sets DNS search domains for a container. Create will automatically use the setting from the host if neither searchdomain nor nameserver are set.
187    pub searchdomain: Option<String>,
188
189    /// Amount of memory shares for auto-ballooning. The larger the number is, the more memory this VM gets. Number is relative to weights of all other running VMs. Using zero disables auto-ballooning. Auto-ballooning is done by pvestatd.
190    pub shares: Option<i32>,
191
192    /// Specify SMBIOS type 1 fields.
193    pub smbios1: Option<String>,
194
195    /// The number of CPUs. Please use option -sockets instead.
196    pub smp: Option<i64>,
197
198    /// The number of CPU sockets.
199    pub sockets: Option<i64>,
200
201    /// Configure additional enhancements for SPICE.
202    pub spice_enhancements: Option<Box<models::PveSpiceEnhancementsField>>,
203
204    /// cloud-init: Setup public SSH keys (one key per line, OpenSSH format).
205    pub sshkeys: Option<String>,
206
207    /// Start VM after it was created successfully.
208    pub start: Option<models::PveBoolean>,
209
210    /// Set the initial date of the real time clock. Valid format for date are:'now' or '2006-06-17T16:01:21' or '2006-06-17'.
211    pub startdate: Option<String>,
212
213    /// Startup and shutdown behavior. Order is a non-negative number defining the general startup order. Shutdown in done with reverse ordering. Additionally you can set the 'up' or 'down' delay in seconds, which specifies a delay to wait before the next VM is started or stopped.
214    pub startup: Option<String>,
215
216    /// Default storage.
217    pub storage: Option<String>,
218
219    /// Enable/disable the USB tablet device. This device is usually needed to allow absolute mouse positioning with VNC. Else the mouse runs out of sync with normal VNC clients. If you're running lots of console-only guests on one host, you may consider disabling this to save some context switches. This is turned off by default if you use spice (`qm set <vmid> --vga qxl`).
220    pub tablet: Option<models::PveBoolean>,
221
222    /// Tags of the VM. This is only meta information.
223    pub tags: Option<String>,
224
225    /// Enable/disable time drift fix.
226    pub tdf: Option<models::PveBoolean>,
227
228    /// Enable/disable Template.
229    pub template: Option<models::PveBoolean>,
230
231    /// Configure a Disk for storing TPM state. The format is fixed to 'raw'. Use the special syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume. Note that SIZE_IN_GiB is ignored here and 4 MiB will be used instead. Use STORAGE_ID:0 and the 'import-from' parameter to import from an existing volume.
232    pub tpmstate0: Option<Box<models::PveTpmstateField>>,
233
234    /// Assign a unique random ethernet address.
235    pub unique: Option<models::PveBoolean>,
236
237    /// Number of hotplugged vcpus.
238    pub vcpus: Option<i64>,
239
240    /// Configure the VGA Hardware. If you want to use high resolution modes (>= 1280x1024x16) you may need to increase the vga memory option. Since QEMU 2.9 the default VGA display type is 'std' for all OS types besides some Windows versions (XP and older) which use 'cirrus'. The 'qxl' option enables the SPICE display server. For win* OS you can select how many independent displays you want, Linux guests can add displays them self. You can also run without any graphic card, using a serial device as terminal.
241    pub vga: Option<Box<models::PveVgaField>>,
242
243    /// The VM generation ID (vmgenid) device exposes a 128-bit integer value identifier to the guest OS. This allows to notify the guest operating system when the virtual machine is executed with a different configuration (e.g. snapshot execution or creation from a template). The guest operating system notices the change, and is then able to react as appropriate by marking its copies of distributed databases as dirty, re-initializing its random number generator, etc. Note that auto-creation only works when done through API/CLI create or update methods, but not when manually editing the config file.
244    pub vmgenid: Option<String>,
245
246    /// The (unique) ID of the VM.
247    pub vmid: i32,
248
249    /// Default storage for VM state volumes/files.
250    pub vmstatestorage: Option<String>,
251
252    /// Create a virtual hardware watchdog device. Once enabled (by a guest action), the watchdog must be periodically polled by an agent inside the guest or else the watchdog will reset the guest (or execute the respective action specified)
253    pub watchdog: Option<String>,
254
255    /// Hostpcis family. Wire form: `hostpci0..hostpci15`. Serialised by the manual impls below.
256    pub hostpcis: Option<std::collections::HashMap<u32, String>>,
257    /// Ides family. Wire form: `ide0..ide3`. Serialised by the manual impls below.
258    pub ides: Option<std::collections::HashMap<u32, models::PveIdeField>>,
259    /// Ipconfigs family. Wire form: `ipconfig0..ipconfig31`. Serialised by the manual impls below.
260    pub ipconfigs: Option<std::collections::HashMap<u32, String>>,
261    /// Nets family. Wire form: `net0..net31`. Serialised by the manual impls below.
262    pub nets: Option<std::collections::HashMap<u32, models::PveQemuNetField>>,
263    /// Numas family. Wire form: `numa0..numa7`. Serialised by the manual impls below.
264    pub numas: Option<std::collections::HashMap<u32, models::PveNumaField>>,
265    /// Parallels family. Wire form: `parallel0..parallel2`. Serialised by the manual impls below.
266    pub parallels: Option<std::collections::HashMap<u32, String>>,
267    /// Satas family. Wire form: `sata0..sata5`. Serialised by the manual impls below.
268    pub satas: Option<std::collections::HashMap<u32, models::PveSataField>>,
269    /// Scsis family. Wire form: `scsi0..scsi30`. Serialised by the manual impls below.
270    pub scsis: Option<std::collections::HashMap<u32, models::PveScsiField>>,
271    /// Serials family. Wire form: `serial0..serial3`. Serialised by the manual impls below.
272    pub serials: Option<std::collections::HashMap<u32, String>>,
273    /// Unuseds family. Wire form: `unused0..unused255`. Serialised by the manual impls below.
274    pub unuseds: Option<std::collections::HashMap<u32, models::PveQemuUnusedField>>,
275    /// Usbs family. Wire form: `usb0..usb4`. Serialised by the manual impls below.
276    pub usbs: Option<std::collections::HashMap<u32, models::PveUsbField>>,
277    /// Virtiofs family. Wire form: `virtiofs0..virtiofs8`. Serialised by the manual impls below.
278    pub virtiofs: Option<std::collections::HashMap<u32, models::PveVirtiofsField>>,
279    /// Virtios family. Wire form: `virtio0..virtio15`. Serialised by the manual impls below.
280    pub virtios: Option<std::collections::HashMap<u32, models::PveVirtioField>>,
281}
282
283impl QemuCreateVmRequest {
284    pub fn new(vmid: i32) -> QemuCreateVmRequest {
285        QemuCreateVmRequest {
286            
287            acpi: None,
288            
289            affinity: None,
290            
291            agent: None,
292            
293            allow_ksm: None,
294            
295            amd_sev: None,
296            
297            arch: None,
298            
299            archive: None,
300            
301            args: None,
302            
303            audio0: None,
304            
305            autostart: None,
306            
307            balloon: None,
308            
309            bios: None,
310            
311            boot: None,
312            
313            bootdisk: None,
314            
315            bwlimit: None,
316            
317            cdrom: None,
318            
319            cicustom: None,
320            
321            cipassword: None,
322            
323            citype: None,
324            
325            ciupgrade: None,
326            
327            ciuser: None,
328            
329            cores: None,
330            
331            cpu: None,
332            
333            cpulimit: None,
334            
335            cpuunits: None,
336            
337            description: None,
338            
339            efidisk0: None,
340            
341            force: None,
342            
343            freeze: None,
344            
345            ha_managed: None,
346            
347            hookscript: None,
348            
349            hotplug: None,
350            
351            hugepages: None,
352            
353            import_working_storage: None,
354            
355            intel_tdx: None,
356            
357            ivshmem: None,
358            
359            keephugepages: None,
360            
361            keyboard: None,
362            
363            kvm: None,
364            
365            live_restore: None,
366            
367            localtime: None,
368            
369            lock: None,
370            
371            machine: None,
372            
373            memory: None,
374            
375            migrate_downtime: None,
376            
377            migrate_speed: None,
378            
379            name: None,
380            
381            nameserver: None,
382            
383            numa: None,
384            
385            onboot: None,
386            
387            ostype: None,
388            
389            pool: None,
390            
391            protection: None,
392            
393            reboot: None,
394            
395            rng0: None,
396            
397            scsihw: None,
398            
399            searchdomain: None,
400            
401            shares: None,
402            
403            smbios1: None,
404            
405            smp: None,
406            
407            sockets: None,
408            
409            spice_enhancements: None,
410            
411            sshkeys: None,
412            
413            start: None,
414            
415            startdate: None,
416            
417            startup: None,
418            
419            storage: None,
420            
421            tablet: None,
422            
423            tags: None,
424            
425            tdf: None,
426            
427            template: None,
428            
429            tpmstate0: None,
430            
431            unique: None,
432            
433            vcpus: None,
434            
435            vga: None,
436            
437            vmgenid: None,
438            
439            vmid,
440            
441            vmstatestorage: None,
442            
443            watchdog: None,
444            
445            hostpcis: None,
446            ides: None,
447            ipconfigs: None,
448            nets: None,
449            numas: None,
450            parallels: None,
451            satas: None,
452            scsis: None,
453            serials: None,
454            unuseds: None,
455            usbs: None,
456            virtiofs: None,
457            virtios: None,
458        }
459    }
460}
461
462
463// Flattens indexed-family maps to/from `<base><idx>` wire keys.
464impl serde::Serialize for QemuCreateVmRequest {
465    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
466        use serde::ser::Error;
467        let mut map = serde_json::Map::new();
468        
469        {
470            let _v = serde_json::to_value(&self.acpi).map_err(Error::custom)?;
471            if !_v.is_null() {
472                map.insert("acpi".to_string(), _v);
473            }
474        }
475        
476        {
477            let _v = serde_json::to_value(&self.affinity).map_err(Error::custom)?;
478            if !_v.is_null() {
479                map.insert("affinity".to_string(), _v);
480            }
481        }
482        
483        {
484            let _v = serde_json::to_value(&self.agent).map_err(Error::custom)?;
485            if !_v.is_null() {
486                map.insert("agent".to_string(), _v);
487            }
488        }
489        
490        {
491            let _v = serde_json::to_value(&self.allow_ksm).map_err(Error::custom)?;
492            if !_v.is_null() {
493                map.insert("allow-ksm".to_string(), _v);
494            }
495        }
496        
497        {
498            let _v = serde_json::to_value(&self.amd_sev).map_err(Error::custom)?;
499            if !_v.is_null() {
500                map.insert("amd-sev".to_string(), _v);
501            }
502        }
503        
504        {
505            let _v = serde_json::to_value(&self.arch).map_err(Error::custom)?;
506            if !_v.is_null() {
507                map.insert("arch".to_string(), _v);
508            }
509        }
510        
511        {
512            let _v = serde_json::to_value(&self.archive).map_err(Error::custom)?;
513            if !_v.is_null() {
514                map.insert("archive".to_string(), _v);
515            }
516        }
517        
518        {
519            let _v = serde_json::to_value(&self.args).map_err(Error::custom)?;
520            if !_v.is_null() {
521                map.insert("args".to_string(), _v);
522            }
523        }
524        
525        {
526            let _v = serde_json::to_value(&self.audio0).map_err(Error::custom)?;
527            if !_v.is_null() {
528                map.insert("audio0".to_string(), _v);
529            }
530        }
531        
532        {
533            let _v = serde_json::to_value(&self.autostart).map_err(Error::custom)?;
534            if !_v.is_null() {
535                map.insert("autostart".to_string(), _v);
536            }
537        }
538        
539        {
540            let _v = serde_json::to_value(&self.balloon).map_err(Error::custom)?;
541            if !_v.is_null() {
542                map.insert("balloon".to_string(), _v);
543            }
544        }
545        
546        {
547            let _v = serde_json::to_value(&self.bios).map_err(Error::custom)?;
548            if !_v.is_null() {
549                map.insert("bios".to_string(), _v);
550            }
551        }
552        
553        {
554            let _v = serde_json::to_value(&self.boot).map_err(Error::custom)?;
555            if !_v.is_null() {
556                map.insert("boot".to_string(), _v);
557            }
558        }
559        
560        {
561            let _v = serde_json::to_value(&self.bootdisk).map_err(Error::custom)?;
562            if !_v.is_null() {
563                map.insert("bootdisk".to_string(), _v);
564            }
565        }
566        
567        {
568            let _v = serde_json::to_value(&self.bwlimit).map_err(Error::custom)?;
569            if !_v.is_null() {
570                map.insert("bwlimit".to_string(), _v);
571            }
572        }
573        
574        {
575            let _v = serde_json::to_value(&self.cdrom).map_err(Error::custom)?;
576            if !_v.is_null() {
577                map.insert("cdrom".to_string(), _v);
578            }
579        }
580        
581        {
582            let _v = serde_json::to_value(&self.cicustom).map_err(Error::custom)?;
583            if !_v.is_null() {
584                map.insert("cicustom".to_string(), _v);
585            }
586        }
587        
588        {
589            let _v = serde_json::to_value(&self.cipassword).map_err(Error::custom)?;
590            if !_v.is_null() {
591                map.insert("cipassword".to_string(), _v);
592            }
593        }
594        
595        {
596            let _v = serde_json::to_value(&self.citype).map_err(Error::custom)?;
597            if !_v.is_null() {
598                map.insert("citype".to_string(), _v);
599            }
600        }
601        
602        {
603            let _v = serde_json::to_value(&self.ciupgrade).map_err(Error::custom)?;
604            if !_v.is_null() {
605                map.insert("ciupgrade".to_string(), _v);
606            }
607        }
608        
609        {
610            let _v = serde_json::to_value(&self.ciuser).map_err(Error::custom)?;
611            if !_v.is_null() {
612                map.insert("ciuser".to_string(), _v);
613            }
614        }
615        
616        {
617            let _v = serde_json::to_value(&self.cores).map_err(Error::custom)?;
618            if !_v.is_null() {
619                map.insert("cores".to_string(), _v);
620            }
621        }
622        
623        {
624            let _v = serde_json::to_value(&self.cpu).map_err(Error::custom)?;
625            if !_v.is_null() {
626                map.insert("cpu".to_string(), _v);
627            }
628        }
629        
630        {
631            let _v = serde_json::to_value(&self.cpulimit).map_err(Error::custom)?;
632            if !_v.is_null() {
633                map.insert("cpulimit".to_string(), _v);
634            }
635        }
636        
637        {
638            let _v = serde_json::to_value(&self.cpuunits).map_err(Error::custom)?;
639            if !_v.is_null() {
640                map.insert("cpuunits".to_string(), _v);
641            }
642        }
643        
644        {
645            let _v = serde_json::to_value(&self.description).map_err(Error::custom)?;
646            if !_v.is_null() {
647                map.insert("description".to_string(), _v);
648            }
649        }
650        
651        {
652            let _v = serde_json::to_value(&self.efidisk0).map_err(Error::custom)?;
653            if !_v.is_null() {
654                map.insert("efidisk0".to_string(), _v);
655            }
656        }
657        
658        {
659            let _v = serde_json::to_value(&self.force).map_err(Error::custom)?;
660            if !_v.is_null() {
661                map.insert("force".to_string(), _v);
662            }
663        }
664        
665        {
666            let _v = serde_json::to_value(&self.freeze).map_err(Error::custom)?;
667            if !_v.is_null() {
668                map.insert("freeze".to_string(), _v);
669            }
670        }
671        
672        {
673            let _v = serde_json::to_value(&self.ha_managed).map_err(Error::custom)?;
674            if !_v.is_null() {
675                map.insert("ha-managed".to_string(), _v);
676            }
677        }
678        
679        {
680            let _v = serde_json::to_value(&self.hookscript).map_err(Error::custom)?;
681            if !_v.is_null() {
682                map.insert("hookscript".to_string(), _v);
683            }
684        }
685        
686        {
687            let _v = serde_json::to_value(&self.hotplug).map_err(Error::custom)?;
688            if !_v.is_null() {
689                map.insert("hotplug".to_string(), _v);
690            }
691        }
692        
693        {
694            let _v = serde_json::to_value(&self.hugepages).map_err(Error::custom)?;
695            if !_v.is_null() {
696                map.insert("hugepages".to_string(), _v);
697            }
698        }
699        
700        {
701            let _v = serde_json::to_value(&self.import_working_storage).map_err(Error::custom)?;
702            if !_v.is_null() {
703                map.insert("import-working-storage".to_string(), _v);
704            }
705        }
706        
707        {
708            let _v = serde_json::to_value(&self.intel_tdx).map_err(Error::custom)?;
709            if !_v.is_null() {
710                map.insert("intel-tdx".to_string(), _v);
711            }
712        }
713        
714        {
715            let _v = serde_json::to_value(&self.ivshmem).map_err(Error::custom)?;
716            if !_v.is_null() {
717                map.insert("ivshmem".to_string(), _v);
718            }
719        }
720        
721        {
722            let _v = serde_json::to_value(&self.keephugepages).map_err(Error::custom)?;
723            if !_v.is_null() {
724                map.insert("keephugepages".to_string(), _v);
725            }
726        }
727        
728        {
729            let _v = serde_json::to_value(&self.keyboard).map_err(Error::custom)?;
730            if !_v.is_null() {
731                map.insert("keyboard".to_string(), _v);
732            }
733        }
734        
735        {
736            let _v = serde_json::to_value(&self.kvm).map_err(Error::custom)?;
737            if !_v.is_null() {
738                map.insert("kvm".to_string(), _v);
739            }
740        }
741        
742        {
743            let _v = serde_json::to_value(&self.live_restore).map_err(Error::custom)?;
744            if !_v.is_null() {
745                map.insert("live-restore".to_string(), _v);
746            }
747        }
748        
749        {
750            let _v = serde_json::to_value(&self.localtime).map_err(Error::custom)?;
751            if !_v.is_null() {
752                map.insert("localtime".to_string(), _v);
753            }
754        }
755        
756        {
757            let _v = serde_json::to_value(&self.lock).map_err(Error::custom)?;
758            if !_v.is_null() {
759                map.insert("lock".to_string(), _v);
760            }
761        }
762        
763        {
764            let _v = serde_json::to_value(&self.machine).map_err(Error::custom)?;
765            if !_v.is_null() {
766                map.insert("machine".to_string(), _v);
767            }
768        }
769        
770        {
771            let _v = serde_json::to_value(&self.memory).map_err(Error::custom)?;
772            if !_v.is_null() {
773                map.insert("memory".to_string(), _v);
774            }
775        }
776        
777        {
778            let _v = serde_json::to_value(&self.migrate_downtime).map_err(Error::custom)?;
779            if !_v.is_null() {
780                map.insert("migrate_downtime".to_string(), _v);
781            }
782        }
783        
784        {
785            let _v = serde_json::to_value(&self.migrate_speed).map_err(Error::custom)?;
786            if !_v.is_null() {
787                map.insert("migrate_speed".to_string(), _v);
788            }
789        }
790        
791        {
792            let _v = serde_json::to_value(&self.name).map_err(Error::custom)?;
793            if !_v.is_null() {
794                map.insert("name".to_string(), _v);
795            }
796        }
797        
798        {
799            let _v = serde_json::to_value(&self.nameserver).map_err(Error::custom)?;
800            if !_v.is_null() {
801                map.insert("nameserver".to_string(), _v);
802            }
803        }
804        
805        {
806            let _v = serde_json::to_value(&self.numa).map_err(Error::custom)?;
807            if !_v.is_null() {
808                map.insert("numa".to_string(), _v);
809            }
810        }
811        
812        {
813            let _v = serde_json::to_value(&self.onboot).map_err(Error::custom)?;
814            if !_v.is_null() {
815                map.insert("onboot".to_string(), _v);
816            }
817        }
818        
819        {
820            let _v = serde_json::to_value(&self.ostype).map_err(Error::custom)?;
821            if !_v.is_null() {
822                map.insert("ostype".to_string(), _v);
823            }
824        }
825        
826        {
827            let _v = serde_json::to_value(&self.pool).map_err(Error::custom)?;
828            if !_v.is_null() {
829                map.insert("pool".to_string(), _v);
830            }
831        }
832        
833        {
834            let _v = serde_json::to_value(&self.protection).map_err(Error::custom)?;
835            if !_v.is_null() {
836                map.insert("protection".to_string(), _v);
837            }
838        }
839        
840        {
841            let _v = serde_json::to_value(&self.reboot).map_err(Error::custom)?;
842            if !_v.is_null() {
843                map.insert("reboot".to_string(), _v);
844            }
845        }
846        
847        {
848            let _v = serde_json::to_value(&self.rng0).map_err(Error::custom)?;
849            if !_v.is_null() {
850                map.insert("rng0".to_string(), _v);
851            }
852        }
853        
854        {
855            let _v = serde_json::to_value(&self.scsihw).map_err(Error::custom)?;
856            if !_v.is_null() {
857                map.insert("scsihw".to_string(), _v);
858            }
859        }
860        
861        {
862            let _v = serde_json::to_value(&self.searchdomain).map_err(Error::custom)?;
863            if !_v.is_null() {
864                map.insert("searchdomain".to_string(), _v);
865            }
866        }
867        
868        {
869            let _v = serde_json::to_value(&self.shares).map_err(Error::custom)?;
870            if !_v.is_null() {
871                map.insert("shares".to_string(), _v);
872            }
873        }
874        
875        {
876            let _v = serde_json::to_value(&self.smbios1).map_err(Error::custom)?;
877            if !_v.is_null() {
878                map.insert("smbios1".to_string(), _v);
879            }
880        }
881        
882        {
883            let _v = serde_json::to_value(&self.smp).map_err(Error::custom)?;
884            if !_v.is_null() {
885                map.insert("smp".to_string(), _v);
886            }
887        }
888        
889        {
890            let _v = serde_json::to_value(&self.sockets).map_err(Error::custom)?;
891            if !_v.is_null() {
892                map.insert("sockets".to_string(), _v);
893            }
894        }
895        
896        {
897            let _v = serde_json::to_value(&self.spice_enhancements).map_err(Error::custom)?;
898            if !_v.is_null() {
899                map.insert("spice_enhancements".to_string(), _v);
900            }
901        }
902        
903        {
904            let _v = serde_json::to_value(&self.sshkeys).map_err(Error::custom)?;
905            if !_v.is_null() {
906                map.insert("sshkeys".to_string(), _v);
907            }
908        }
909        
910        {
911            let _v = serde_json::to_value(&self.start).map_err(Error::custom)?;
912            if !_v.is_null() {
913                map.insert("start".to_string(), _v);
914            }
915        }
916        
917        {
918            let _v = serde_json::to_value(&self.startdate).map_err(Error::custom)?;
919            if !_v.is_null() {
920                map.insert("startdate".to_string(), _v);
921            }
922        }
923        
924        {
925            let _v = serde_json::to_value(&self.startup).map_err(Error::custom)?;
926            if !_v.is_null() {
927                map.insert("startup".to_string(), _v);
928            }
929        }
930        
931        {
932            let _v = serde_json::to_value(&self.storage).map_err(Error::custom)?;
933            if !_v.is_null() {
934                map.insert("storage".to_string(), _v);
935            }
936        }
937        
938        {
939            let _v = serde_json::to_value(&self.tablet).map_err(Error::custom)?;
940            if !_v.is_null() {
941                map.insert("tablet".to_string(), _v);
942            }
943        }
944        
945        {
946            let _v = serde_json::to_value(&self.tags).map_err(Error::custom)?;
947            if !_v.is_null() {
948                map.insert("tags".to_string(), _v);
949            }
950        }
951        
952        {
953            let _v = serde_json::to_value(&self.tdf).map_err(Error::custom)?;
954            if !_v.is_null() {
955                map.insert("tdf".to_string(), _v);
956            }
957        }
958        
959        {
960            let _v = serde_json::to_value(&self.template).map_err(Error::custom)?;
961            if !_v.is_null() {
962                map.insert("template".to_string(), _v);
963            }
964        }
965        
966        {
967            let _v = serde_json::to_value(&self.tpmstate0).map_err(Error::custom)?;
968            if !_v.is_null() {
969                map.insert("tpmstate0".to_string(), _v);
970            }
971        }
972        
973        {
974            let _v = serde_json::to_value(&self.unique).map_err(Error::custom)?;
975            if !_v.is_null() {
976                map.insert("unique".to_string(), _v);
977            }
978        }
979        
980        {
981            let _v = serde_json::to_value(&self.vcpus).map_err(Error::custom)?;
982            if !_v.is_null() {
983                map.insert("vcpus".to_string(), _v);
984            }
985        }
986        
987        {
988            let _v = serde_json::to_value(&self.vga).map_err(Error::custom)?;
989            if !_v.is_null() {
990                map.insert("vga".to_string(), _v);
991            }
992        }
993        
994        {
995            let _v = serde_json::to_value(&self.vmgenid).map_err(Error::custom)?;
996            if !_v.is_null() {
997                map.insert("vmgenid".to_string(), _v);
998            }
999        }
1000        
1001        {
1002            let _v = serde_json::to_value(&self.vmid).map_err(Error::custom)?;
1003            if !_v.is_null() {
1004                map.insert("vmid".to_string(), _v);
1005            }
1006        }
1007        
1008        {
1009            let _v = serde_json::to_value(&self.vmstatestorage).map_err(Error::custom)?;
1010            if !_v.is_null() {
1011                map.insert("vmstatestorage".to_string(), _v);
1012            }
1013        }
1014        
1015        {
1016            let _v = serde_json::to_value(&self.watchdog).map_err(Error::custom)?;
1017            if !_v.is_null() {
1018                map.insert("watchdog".to_string(), _v);
1019            }
1020        }
1021        
1022        if let Some(ref _m) = self.hostpcis {
1023            for (_idx, _val) in _m.iter() {
1024                map.insert(format!("hostpci{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
1025            }
1026        }
1027        if let Some(ref _m) = self.ides {
1028            for (_idx, _val) in _m.iter() {
1029                map.insert(format!("ide{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
1030            }
1031        }
1032        if let Some(ref _m) = self.ipconfigs {
1033            for (_idx, _val) in _m.iter() {
1034                map.insert(format!("ipconfig{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
1035            }
1036        }
1037        if let Some(ref _m) = self.nets {
1038            for (_idx, _val) in _m.iter() {
1039                map.insert(format!("net{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
1040            }
1041        }
1042        if let Some(ref _m) = self.numas {
1043            for (_idx, _val) in _m.iter() {
1044                map.insert(format!("numa{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
1045            }
1046        }
1047        if let Some(ref _m) = self.parallels {
1048            for (_idx, _val) in _m.iter() {
1049                map.insert(format!("parallel{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
1050            }
1051        }
1052        if let Some(ref _m) = self.satas {
1053            for (_idx, _val) in _m.iter() {
1054                map.insert(format!("sata{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
1055            }
1056        }
1057        if let Some(ref _m) = self.scsis {
1058            for (_idx, _val) in _m.iter() {
1059                map.insert(format!("scsi{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
1060            }
1061        }
1062        if let Some(ref _m) = self.serials {
1063            for (_idx, _val) in _m.iter() {
1064                map.insert(format!("serial{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
1065            }
1066        }
1067        if let Some(ref _m) = self.unuseds {
1068            for (_idx, _val) in _m.iter() {
1069                map.insert(format!("unused{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
1070            }
1071        }
1072        if let Some(ref _m) = self.usbs {
1073            for (_idx, _val) in _m.iter() {
1074                map.insert(format!("usb{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
1075            }
1076        }
1077        if let Some(ref _m) = self.virtiofs {
1078            for (_idx, _val) in _m.iter() {
1079                map.insert(format!("virtiofs{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
1080            }
1081        }
1082        if let Some(ref _m) = self.virtios {
1083            for (_idx, _val) in _m.iter() {
1084                map.insert(format!("virtio{}", _idx), serde_json::to_value(_val).map_err(Error::custom)?);
1085            }
1086        }
1087        serde_json::Value::Object(map).serialize(serializer)
1088    }
1089}
1090
1091impl<'de> serde::Deserialize<'de> for QemuCreateVmRequest {
1092    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1093        use serde::de::Error;
1094        let mut raw: serde_json::Map<String, serde_json::Value> =
1095            serde::Deserialize::deserialize(deserializer)?;
1096        let mut __hostpcis: std::collections::HashMap<u32, String> = std::collections::HashMap::new();
1097        {
1098            let _prefix = "hostpci";
1099            let _keys: Vec<String> = raw.keys()
1100                .filter(|k| {
1101                    if let Some(_suffix) = k.strip_prefix(_prefix) {
1102                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
1103                    } else {
1104                        false
1105                    }
1106                })
1107                .cloned()
1108                .collect();
1109            for _key in _keys {
1110                let _suffix = _key.strip_prefix(_prefix).unwrap();
1111                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
1112                let _value = raw.remove(&_key).unwrap();
1113                let _item: String = serde_json::from_value(_value).map_err(Error::custom)?;
1114                __hostpcis.insert(_idx, _item);
1115            }
1116        }
1117        let mut __ides: std::collections::HashMap<u32, models::PveIdeField> = std::collections::HashMap::new();
1118        {
1119            let _prefix = "ide";
1120            let _keys: Vec<String> = raw.keys()
1121                .filter(|k| {
1122                    if let Some(_suffix) = k.strip_prefix(_prefix) {
1123                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
1124                    } else {
1125                        false
1126                    }
1127                })
1128                .cloned()
1129                .collect();
1130            for _key in _keys {
1131                let _suffix = _key.strip_prefix(_prefix).unwrap();
1132                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
1133                let _value = raw.remove(&_key).unwrap();
1134                let _item: models::PveIdeField = serde_json::from_value(_value).map_err(Error::custom)?;
1135                __ides.insert(_idx, _item);
1136            }
1137        }
1138        let mut __ipconfigs: std::collections::HashMap<u32, String> = std::collections::HashMap::new();
1139        {
1140            let _prefix = "ipconfig";
1141            let _keys: Vec<String> = raw.keys()
1142                .filter(|k| {
1143                    if let Some(_suffix) = k.strip_prefix(_prefix) {
1144                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
1145                    } else {
1146                        false
1147                    }
1148                })
1149                .cloned()
1150                .collect();
1151            for _key in _keys {
1152                let _suffix = _key.strip_prefix(_prefix).unwrap();
1153                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
1154                let _value = raw.remove(&_key).unwrap();
1155                let _item: String = serde_json::from_value(_value).map_err(Error::custom)?;
1156                __ipconfigs.insert(_idx, _item);
1157            }
1158        }
1159        let mut __nets: std::collections::HashMap<u32, models::PveQemuNetField> = std::collections::HashMap::new();
1160        {
1161            let _prefix = "net";
1162            let _keys: Vec<String> = raw.keys()
1163                .filter(|k| {
1164                    if let Some(_suffix) = k.strip_prefix(_prefix) {
1165                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
1166                    } else {
1167                        false
1168                    }
1169                })
1170                .cloned()
1171                .collect();
1172            for _key in _keys {
1173                let _suffix = _key.strip_prefix(_prefix).unwrap();
1174                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
1175                let _value = raw.remove(&_key).unwrap();
1176                let _item: models::PveQemuNetField = serde_json::from_value(_value).map_err(Error::custom)?;
1177                __nets.insert(_idx, _item);
1178            }
1179        }
1180        let mut __numas: std::collections::HashMap<u32, models::PveNumaField> = std::collections::HashMap::new();
1181        {
1182            let _prefix = "numa";
1183            let _keys: Vec<String> = raw.keys()
1184                .filter(|k| {
1185                    if let Some(_suffix) = k.strip_prefix(_prefix) {
1186                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
1187                    } else {
1188                        false
1189                    }
1190                })
1191                .cloned()
1192                .collect();
1193            for _key in _keys {
1194                let _suffix = _key.strip_prefix(_prefix).unwrap();
1195                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
1196                let _value = raw.remove(&_key).unwrap();
1197                let _item: models::PveNumaField = serde_json::from_value(_value).map_err(Error::custom)?;
1198                __numas.insert(_idx, _item);
1199            }
1200        }
1201        let mut __parallels: std::collections::HashMap<u32, String> = std::collections::HashMap::new();
1202        {
1203            let _prefix = "parallel";
1204            let _keys: Vec<String> = raw.keys()
1205                .filter(|k| {
1206                    if let Some(_suffix) = k.strip_prefix(_prefix) {
1207                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
1208                    } else {
1209                        false
1210                    }
1211                })
1212                .cloned()
1213                .collect();
1214            for _key in _keys {
1215                let _suffix = _key.strip_prefix(_prefix).unwrap();
1216                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
1217                let _value = raw.remove(&_key).unwrap();
1218                let _item: String = serde_json::from_value(_value).map_err(Error::custom)?;
1219                __parallels.insert(_idx, _item);
1220            }
1221        }
1222        let mut __satas: std::collections::HashMap<u32, models::PveSataField> = std::collections::HashMap::new();
1223        {
1224            let _prefix = "sata";
1225            let _keys: Vec<String> = raw.keys()
1226                .filter(|k| {
1227                    if let Some(_suffix) = k.strip_prefix(_prefix) {
1228                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
1229                    } else {
1230                        false
1231                    }
1232                })
1233                .cloned()
1234                .collect();
1235            for _key in _keys {
1236                let _suffix = _key.strip_prefix(_prefix).unwrap();
1237                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
1238                let _value = raw.remove(&_key).unwrap();
1239                let _item: models::PveSataField = serde_json::from_value(_value).map_err(Error::custom)?;
1240                __satas.insert(_idx, _item);
1241            }
1242        }
1243        let mut __scsis: std::collections::HashMap<u32, models::PveScsiField> = std::collections::HashMap::new();
1244        {
1245            let _prefix = "scsi";
1246            let _keys: Vec<String> = raw.keys()
1247                .filter(|k| {
1248                    if let Some(_suffix) = k.strip_prefix(_prefix) {
1249                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
1250                    } else {
1251                        false
1252                    }
1253                })
1254                .cloned()
1255                .collect();
1256            for _key in _keys {
1257                let _suffix = _key.strip_prefix(_prefix).unwrap();
1258                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
1259                let _value = raw.remove(&_key).unwrap();
1260                let _item: models::PveScsiField = serde_json::from_value(_value).map_err(Error::custom)?;
1261                __scsis.insert(_idx, _item);
1262            }
1263        }
1264        let mut __serials: std::collections::HashMap<u32, String> = std::collections::HashMap::new();
1265        {
1266            let _prefix = "serial";
1267            let _keys: Vec<String> = raw.keys()
1268                .filter(|k| {
1269                    if let Some(_suffix) = k.strip_prefix(_prefix) {
1270                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
1271                    } else {
1272                        false
1273                    }
1274                })
1275                .cloned()
1276                .collect();
1277            for _key in _keys {
1278                let _suffix = _key.strip_prefix(_prefix).unwrap();
1279                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
1280                let _value = raw.remove(&_key).unwrap();
1281                let _item: String = serde_json::from_value(_value).map_err(Error::custom)?;
1282                __serials.insert(_idx, _item);
1283            }
1284        }
1285        let mut __unuseds: std::collections::HashMap<u32, models::PveQemuUnusedField> = std::collections::HashMap::new();
1286        {
1287            let _prefix = "unused";
1288            let _keys: Vec<String> = raw.keys()
1289                .filter(|k| {
1290                    if let Some(_suffix) = k.strip_prefix(_prefix) {
1291                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
1292                    } else {
1293                        false
1294                    }
1295                })
1296                .cloned()
1297                .collect();
1298            for _key in _keys {
1299                let _suffix = _key.strip_prefix(_prefix).unwrap();
1300                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
1301                let _value = raw.remove(&_key).unwrap();
1302                let _item: models::PveQemuUnusedField = serde_json::from_value(_value).map_err(Error::custom)?;
1303                __unuseds.insert(_idx, _item);
1304            }
1305        }
1306        let mut __usbs: std::collections::HashMap<u32, models::PveUsbField> = std::collections::HashMap::new();
1307        {
1308            let _prefix = "usb";
1309            let _keys: Vec<String> = raw.keys()
1310                .filter(|k| {
1311                    if let Some(_suffix) = k.strip_prefix(_prefix) {
1312                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
1313                    } else {
1314                        false
1315                    }
1316                })
1317                .cloned()
1318                .collect();
1319            for _key in _keys {
1320                let _suffix = _key.strip_prefix(_prefix).unwrap();
1321                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
1322                let _value = raw.remove(&_key).unwrap();
1323                let _item: models::PveUsbField = serde_json::from_value(_value).map_err(Error::custom)?;
1324                __usbs.insert(_idx, _item);
1325            }
1326        }
1327        let mut __virtiofs: std::collections::HashMap<u32, models::PveVirtiofsField> = std::collections::HashMap::new();
1328        {
1329            let _prefix = "virtiofs";
1330            let _keys: Vec<String> = raw.keys()
1331                .filter(|k| {
1332                    if let Some(_suffix) = k.strip_prefix(_prefix) {
1333                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
1334                    } else {
1335                        false
1336                    }
1337                })
1338                .cloned()
1339                .collect();
1340            for _key in _keys {
1341                let _suffix = _key.strip_prefix(_prefix).unwrap();
1342                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
1343                let _value = raw.remove(&_key).unwrap();
1344                let _item: models::PveVirtiofsField = serde_json::from_value(_value).map_err(Error::custom)?;
1345                __virtiofs.insert(_idx, _item);
1346            }
1347        }
1348        let mut __virtios: std::collections::HashMap<u32, models::PveVirtioField> = std::collections::HashMap::new();
1349        {
1350            let _prefix = "virtio";
1351            let _keys: Vec<String> = raw.keys()
1352                .filter(|k| {
1353                    if let Some(_suffix) = k.strip_prefix(_prefix) {
1354                        !_suffix.is_empty() && _suffix.chars().all(|c| c.is_ascii_digit())
1355                    } else {
1356                        false
1357                    }
1358                })
1359                .cloned()
1360                .collect();
1361            for _key in _keys {
1362                let _suffix = _key.strip_prefix(_prefix).unwrap();
1363                let _idx: u32 = _suffix.parse().map_err(Error::custom)?;
1364                let _value = raw.remove(&_key).unwrap();
1365                let _item: models::PveVirtioField = serde_json::from_value(_value).map_err(Error::custom)?;
1366                __virtios.insert(_idx, _item);
1367            }
1368        }
1369        Ok(QemuCreateVmRequest {
1370            
1371            acpi: serde_json::from_value(raw.remove("acpi").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1372            
1373            affinity: serde_json::from_value(raw.remove("affinity").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1374            
1375            agent: serde_json::from_value(raw.remove("agent").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1376            
1377            allow_ksm: serde_json::from_value(raw.remove("allow-ksm").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1378            
1379            amd_sev: serde_json::from_value(raw.remove("amd-sev").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1380            
1381            arch: serde_json::from_value(raw.remove("arch").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1382            
1383            archive: serde_json::from_value(raw.remove("archive").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1384            
1385            args: serde_json::from_value(raw.remove("args").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1386            
1387            audio0: serde_json::from_value(raw.remove("audio0").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1388            
1389            autostart: serde_json::from_value(raw.remove("autostart").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1390            
1391            balloon: serde_json::from_value(raw.remove("balloon").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1392            
1393            bios: serde_json::from_value(raw.remove("bios").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1394            
1395            boot: serde_json::from_value(raw.remove("boot").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1396            
1397            bootdisk: serde_json::from_value(raw.remove("bootdisk").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1398            
1399            bwlimit: serde_json::from_value(raw.remove("bwlimit").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1400            
1401            cdrom: serde_json::from_value(raw.remove("cdrom").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1402            
1403            cicustom: serde_json::from_value(raw.remove("cicustom").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1404            
1405            cipassword: serde_json::from_value(raw.remove("cipassword").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1406            
1407            citype: serde_json::from_value(raw.remove("citype").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1408            
1409            ciupgrade: serde_json::from_value(raw.remove("ciupgrade").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1410            
1411            ciuser: serde_json::from_value(raw.remove("ciuser").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1412            
1413            cores: serde_json::from_value(raw.remove("cores").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1414            
1415            cpu: serde_json::from_value(raw.remove("cpu").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1416            
1417            cpulimit: serde_json::from_value(raw.remove("cpulimit").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1418            
1419            cpuunits: serde_json::from_value(raw.remove("cpuunits").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1420            
1421            description: serde_json::from_value(raw.remove("description").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1422            
1423            efidisk0: serde_json::from_value(raw.remove("efidisk0").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1424            
1425            force: serde_json::from_value(raw.remove("force").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1426            
1427            freeze: serde_json::from_value(raw.remove("freeze").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1428            
1429            ha_managed: serde_json::from_value(raw.remove("ha-managed").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1430            
1431            hookscript: serde_json::from_value(raw.remove("hookscript").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1432            
1433            hotplug: serde_json::from_value(raw.remove("hotplug").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1434            
1435            hugepages: serde_json::from_value(raw.remove("hugepages").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1436            
1437            import_working_storage: serde_json::from_value(raw.remove("import-working-storage").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1438            
1439            intel_tdx: serde_json::from_value(raw.remove("intel-tdx").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1440            
1441            ivshmem: serde_json::from_value(raw.remove("ivshmem").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1442            
1443            keephugepages: serde_json::from_value(raw.remove("keephugepages").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1444            
1445            keyboard: serde_json::from_value(raw.remove("keyboard").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1446            
1447            kvm: serde_json::from_value(raw.remove("kvm").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1448            
1449            live_restore: serde_json::from_value(raw.remove("live-restore").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1450            
1451            localtime: serde_json::from_value(raw.remove("localtime").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1452            
1453            lock: serde_json::from_value(raw.remove("lock").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1454            
1455            machine: serde_json::from_value(raw.remove("machine").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1456            
1457            memory: serde_json::from_value(raw.remove("memory").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1458            
1459            migrate_downtime: serde_json::from_value(raw.remove("migrate_downtime").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1460            
1461            migrate_speed: serde_json::from_value(raw.remove("migrate_speed").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1462            
1463            name: serde_json::from_value(raw.remove("name").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1464            
1465            nameserver: serde_json::from_value(raw.remove("nameserver").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1466            
1467            numa: serde_json::from_value(raw.remove("numa").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1468            
1469            onboot: serde_json::from_value(raw.remove("onboot").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1470            
1471            ostype: serde_json::from_value(raw.remove("ostype").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1472            
1473            pool: serde_json::from_value(raw.remove("pool").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1474            
1475            protection: serde_json::from_value(raw.remove("protection").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1476            
1477            reboot: serde_json::from_value(raw.remove("reboot").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1478            
1479            rng0: serde_json::from_value(raw.remove("rng0").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1480            
1481            scsihw: serde_json::from_value(raw.remove("scsihw").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1482            
1483            searchdomain: serde_json::from_value(raw.remove("searchdomain").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1484            
1485            shares: serde_json::from_value(raw.remove("shares").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1486            
1487            smbios1: serde_json::from_value(raw.remove("smbios1").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1488            
1489            smp: serde_json::from_value(raw.remove("smp").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1490            
1491            sockets: serde_json::from_value(raw.remove("sockets").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1492            
1493            spice_enhancements: serde_json::from_value(raw.remove("spice_enhancements").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1494            
1495            sshkeys: serde_json::from_value(raw.remove("sshkeys").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1496            
1497            start: serde_json::from_value(raw.remove("start").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1498            
1499            startdate: serde_json::from_value(raw.remove("startdate").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1500            
1501            startup: serde_json::from_value(raw.remove("startup").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1502            
1503            storage: serde_json::from_value(raw.remove("storage").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1504            
1505            tablet: serde_json::from_value(raw.remove("tablet").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1506            
1507            tags: serde_json::from_value(raw.remove("tags").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1508            
1509            tdf: serde_json::from_value(raw.remove("tdf").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1510            
1511            template: serde_json::from_value(raw.remove("template").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1512            
1513            tpmstate0: serde_json::from_value(raw.remove("tpmstate0").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1514            
1515            unique: serde_json::from_value(raw.remove("unique").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1516            
1517            vcpus: serde_json::from_value(raw.remove("vcpus").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1518            
1519            vga: serde_json::from_value(raw.remove("vga").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1520            
1521            vmgenid: serde_json::from_value(raw.remove("vmgenid").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1522            
1523            vmid: serde_json::from_value(raw.remove("vmid").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1524            
1525            vmstatestorage: serde_json::from_value(raw.remove("vmstatestorage").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1526            
1527            watchdog: serde_json::from_value(raw.remove("watchdog").unwrap_or(serde_json::Value::Null)).map_err(Error::custom)?,
1528            
1529            hostpcis: if __hostpcis.is_empty() { None } else { Some(__hostpcis) },
1530            ides: if __ides.is_empty() { None } else { Some(__ides) },
1531            ipconfigs: if __ipconfigs.is_empty() { None } else { Some(__ipconfigs) },
1532            nets: if __nets.is_empty() { None } else { Some(__nets) },
1533            numas: if __numas.is_empty() { None } else { Some(__numas) },
1534            parallels: if __parallels.is_empty() { None } else { Some(__parallels) },
1535            satas: if __satas.is_empty() { None } else { Some(__satas) },
1536            scsis: if __scsis.is_empty() { None } else { Some(__scsis) },
1537            serials: if __serials.is_empty() { None } else { Some(__serials) },
1538            unuseds: if __unuseds.is_empty() { None } else { Some(__unuseds) },
1539            usbs: if __usbs.is_empty() { None } else { Some(__usbs) },
1540            virtiofs: if __virtiofs.is_empty() { None } else { Some(__virtiofs) },
1541            virtios: if __virtios.is_empty() { None } else { Some(__virtios) },
1542        })
1543    }
1544}
1545
1546