1pub mod vmid;
2pub struct QemuClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> QemuClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T, parent_path: &str) -> Self {
11 Self {
12 client,
13 path: format!("{}{}", parent_path, "/qemu"),
14 }
15 }
16}
17impl<T> QemuClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Virtual machine index (per node)."]
22 pub fn get(&self, params: GetParams) -> Result<Vec<GetOutputItems>, T::Error> {
23 let path = self.path.to_string();
24 self.client.get(&path, ¶ms)
25 }
26}
27impl<T> QemuClient<T>
28where
29 T: crate::client::Client,
30{
31 #[doc = "Create or restore a virtual machine."]
32 pub fn post(&self, params: PostParams) -> Result<String, T::Error> {
33 let path = self.path.to_string();
34 self.client.post(&path, ¶ms)
35 }
36}
37impl GetOutputItems {
38 pub fn new(status: Status, vmid: crate::types::VmId) -> Self {
39 Self {
40 status,
41 vmid,
42 cpus: Default::default(),
43 lock: Default::default(),
44 maxdisk: Default::default(),
45 maxmem: Default::default(),
46 name: Default::default(),
47 pid: Default::default(),
48 qmpstatus: Default::default(),
49 running_machine: Default::default(),
50 running_qemu: Default::default(),
51 tags: Default::default(),
52 uptime: Default::default(),
53 additional_properties: Default::default(),
54 }
55 }
56}
57#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
58pub struct GetOutputItems {
59 #[serde(
60 serialize_with = "crate::types::serialize_number_optional",
61 deserialize_with = "crate::types::deserialize_number_optional"
62 )]
63 #[serde(skip_serializing_if = "Option::is_none", default)]
64 #[doc = "Maximum usable CPUs."]
65 pub cpus: Option<f64>,
66 #[serde(skip_serializing_if = "Option::is_none", default)]
67 #[doc = "The current config lock, if any."]
68 pub lock: Option<String>,
69 #[serde(
70 serialize_with = "crate::types::serialize_int_optional",
71 deserialize_with = "crate::types::deserialize_int_optional"
72 )]
73 #[serde(skip_serializing_if = "Option::is_none", default)]
74 #[doc = "Root disk size in bytes."]
75 pub maxdisk: Option<u64>,
76 #[serde(
77 serialize_with = "crate::types::serialize_int_optional",
78 deserialize_with = "crate::types::deserialize_int_optional"
79 )]
80 #[serde(skip_serializing_if = "Option::is_none", default)]
81 #[doc = "Maximum memory in bytes."]
82 pub maxmem: Option<u64>,
83 #[serde(skip_serializing_if = "Option::is_none", default)]
84 #[doc = "VM name."]
85 pub name: Option<String>,
86 #[serde(
87 serialize_with = "crate::types::serialize_int_optional",
88 deserialize_with = "crate::types::deserialize_int_optional"
89 )]
90 #[serde(skip_serializing_if = "Option::is_none", default)]
91 #[doc = "PID of running qemu process."]
92 pub pid: Option<u64>,
93 #[serde(skip_serializing_if = "Option::is_none", default)]
94 #[doc = "VM run state from the 'query-status' QMP monitor command."]
95 pub qmpstatus: Option<String>,
96 #[serde(rename = "running-machine")]
97 #[serde(skip_serializing_if = "Option::is_none", default)]
98 #[doc = "The currently running machine type (if running)."]
99 pub running_machine: Option<String>,
100 #[serde(rename = "running-qemu")]
101 #[serde(skip_serializing_if = "Option::is_none", default)]
102 #[doc = "The currently running QEMU version (if running)."]
103 pub running_qemu: Option<String>,
104 #[doc = "QEMU process status."]
105 pub status: Status,
106 #[serde(skip_serializing_if = "Option::is_none", default)]
107 #[doc = "The current configured tags, if any"]
108 pub tags: Option<String>,
109 #[serde(
110 serialize_with = "crate::types::serialize_int_optional",
111 deserialize_with = "crate::types::deserialize_int_optional"
112 )]
113 #[serde(skip_serializing_if = "Option::is_none", default)]
114 #[doc = "Uptime."]
115 pub uptime: Option<u64>,
116 #[doc = "The (unique) ID of the VM."]
117 pub vmid: crate::types::VmId,
118 #[serde(
119 flatten,
120 default,
121 skip_serializing_if = "::std::collections::HashMap::is_empty"
122 )]
123 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
124}
125#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
126pub struct GetParams {
127 #[serde(
128 serialize_with = "crate::types::serialize_bool_optional",
129 deserialize_with = "crate::types::deserialize_bool_optional"
130 )]
131 #[serde(skip_serializing_if = "Option::is_none", default)]
132 #[doc = "Determine the full status of active VMs."]
133 pub full: Option<bool>,
134 #[serde(
135 flatten,
136 default,
137 skip_serializing_if = "::std::collections::HashMap::is_empty"
138 )]
139 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
140}
141impl PostParams {
142 pub fn new(vmid: crate::types::VmId) -> Self {
143 Self {
144 vmid,
145 acpi: Default::default(),
146 affinity: Default::default(),
147 agent: Default::default(),
148 arch: Default::default(),
149 archive: Default::default(),
150 args: Default::default(),
151 audio0: Default::default(),
152 autostart: Default::default(),
153 balloon: Default::default(),
154 bios: Default::default(),
155 boot: Default::default(),
156 bootdisk: Default::default(),
157 bwlimit: Default::default(),
158 cdrom: Default::default(),
159 cicustom: Default::default(),
160 cipassword: Default::default(),
161 citype: Default::default(),
162 ciupgrade: Default::default(),
163 ciuser: Default::default(),
164 cores: Default::default(),
165 cpu: Default::default(),
166 cpulimit: Default::default(),
167 cpuunits: Default::default(),
168 description: Default::default(),
169 efidisk0: Default::default(),
170 force: Default::default(),
171 freeze: Default::default(),
172 hookscript: Default::default(),
173 hostpcis: Default::default(),
174 hotplug: Default::default(),
175 hugepages: Default::default(),
176 ides: Default::default(),
177 ipconfigs: Default::default(),
178 ivshmem: Default::default(),
179 keephugepages: Default::default(),
180 keyboard: Default::default(),
181 kvm: Default::default(),
182 live_restore: Default::default(),
183 localtime: Default::default(),
184 lock: Default::default(),
185 machine: Default::default(),
186 memory: Default::default(),
187 migrate_downtime: Default::default(),
188 migrate_speed: Default::default(),
189 name: Default::default(),
190 nameserver: Default::default(),
191 nets: Default::default(),
192 numa: Default::default(),
193 numas: Default::default(),
194 onboot: Default::default(),
195 ostype: Default::default(),
196 parallels: Default::default(),
197 pool: Default::default(),
198 protection: Default::default(),
199 reboot: Default::default(),
200 rng0: Default::default(),
201 satas: Default::default(),
202 scsis: Default::default(),
203 scsihw: Default::default(),
204 searchdomain: Default::default(),
205 serials: Default::default(),
206 shares: Default::default(),
207 smbios1: Default::default(),
208 smp: Default::default(),
209 sockets: Default::default(),
210 spice_enhancements: Default::default(),
211 sshkeys: Default::default(),
212 start: Default::default(),
213 startdate: Default::default(),
214 startup: Default::default(),
215 storage: Default::default(),
216 tablet: Default::default(),
217 tags: Default::default(),
218 tdf: Default::default(),
219 template: Default::default(),
220 tpmstate0: Default::default(),
221 unique: Default::default(),
222 unuseds: Default::default(),
223 usbs: Default::default(),
224 vcpus: Default::default(),
225 vga: Default::default(),
226 virtios: Default::default(),
227 vmgenid: Default::default(),
228 vmstatestorage: Default::default(),
229 watchdog: Default::default(),
230 additional_properties: Default::default(),
231 }
232 }
233}
234#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
235pub struct PostParams {
236 #[serde(
237 serialize_with = "crate::types::serialize_bool_optional",
238 deserialize_with = "crate::types::deserialize_bool_optional"
239 )]
240 #[serde(skip_serializing_if = "Option::is_none", default)]
241 #[doc = "Enable/disable ACPI."]
242 pub acpi: Option<bool>,
243 #[serde(skip_serializing_if = "Option::is_none", default)]
244 #[doc = "List of host cores used to execute guest processes, for example: 0,5,8-11"]
245 pub affinity: Option<String>,
246 #[serde(skip_serializing_if = "Option::is_none", default)]
247 #[doc = "Enable/disable communication with the QEMU Guest Agent and its properties."]
248 pub agent: Option<String>,
249 #[serde(skip_serializing_if = "Option::is_none", default)]
250 #[doc = "Virtual processor architecture. Defaults to the host."]
251 pub arch: Option<Arch>,
252 #[serde(skip_serializing_if = "Option::is_none", default)]
253 #[doc = "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."]
254 pub archive: Option<String>,
255 #[serde(skip_serializing_if = "Option::is_none", default)]
256 #[doc = "Arbitrary arguments passed to kvm."]
257 #[doc = "Arbitrary arguments passed to kvm, for example:\n\nargs: -no-reboot -smbios 'type=0,vendor=FOO'\n\nNOTE: this option is for experts only.\n"]
258 pub args: Option<String>,
259 #[serde(skip_serializing_if = "Option::is_none", default)]
260 #[doc = "Configure a audio device, useful in combination with QXL/Spice."]
261 pub audio0: Option<String>,
262 #[serde(
263 serialize_with = "crate::types::serialize_bool_optional",
264 deserialize_with = "crate::types::deserialize_bool_optional"
265 )]
266 #[serde(skip_serializing_if = "Option::is_none", default)]
267 #[doc = "Automatic restart after crash (currently ignored)."]
268 pub autostart: Option<bool>,
269 #[serde(
270 serialize_with = "crate::types::serialize_int_optional",
271 deserialize_with = "crate::types::deserialize_int_optional"
272 )]
273 #[serde(skip_serializing_if = "Option::is_none", default)]
274 #[doc = "Amount of target RAM for the VM in MiB. Using zero disables the ballon driver."]
275 pub balloon: Option<u64>,
276 #[serde(skip_serializing_if = "Option::is_none", default)]
277 #[doc = "Select BIOS implementation."]
278 pub bios: Option<Bios>,
279 #[serde(skip_serializing_if = "Option::is_none", default)]
280 #[doc = "Specify guest boot order. Use the 'order=' sub-property as usage with no key or 'legacy=' is deprecated."]
281 pub boot: Option<String>,
282 #[serde(skip_serializing_if = "Option::is_none", default)]
283 #[doc = "Enable booting from specified disk. Deprecated: Use 'boot: order=foo;bar' instead."]
284 pub bootdisk: Option<String>,
285 #[serde(skip_serializing_if = "Option::is_none", default)]
286 #[doc = "Override I/O bandwidth limit (in KiB/s)."]
287 pub bwlimit: Option<()>,
288 #[serde(skip_serializing_if = "Option::is_none", default)]
289 #[doc = "This is an alias for option -ide2"]
290 pub cdrom: Option<String>,
291 #[serde(skip_serializing_if = "Option::is_none", default)]
292 #[doc = "cloud-init: Specify custom files to replace the automatically generated ones at start."]
293 pub cicustom: Option<String>,
294 #[serde(skip_serializing_if = "Option::is_none", default)]
295 #[doc = "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."]
296 pub cipassword: Option<String>,
297 #[serde(skip_serializing_if = "Option::is_none", default)]
298 #[doc = "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."]
299 pub citype: Option<Citype>,
300 #[serde(
301 serialize_with = "crate::types::serialize_bool_optional",
302 deserialize_with = "crate::types::deserialize_bool_optional"
303 )]
304 #[serde(skip_serializing_if = "Option::is_none", default)]
305 #[doc = "cloud-init: do an automatic package upgrade after the first boot."]
306 pub ciupgrade: Option<bool>,
307 #[serde(skip_serializing_if = "Option::is_none", default)]
308 #[doc = "cloud-init: User name to change ssh keys and password for instead of the image's configured default user."]
309 pub ciuser: Option<String>,
310 #[serde(
311 serialize_with = "crate::types::serialize_int_optional",
312 deserialize_with = "crate::types::deserialize_int_optional"
313 )]
314 #[serde(skip_serializing_if = "Option::is_none", default)]
315 #[doc = "The number of cores per socket."]
316 pub cores: Option<u64>,
317 #[serde(skip_serializing_if = "Option::is_none", default)]
318 #[doc = "Emulated CPU type."]
319 pub cpu: Option<String>,
320 #[serde(
321 serialize_with = "crate::types::serialize_number_optional",
322 deserialize_with = "crate::types::deserialize_number_optional"
323 )]
324 #[serde(skip_serializing_if = "Option::is_none", default)]
325 #[doc = "Limit of CPU usage."]
326 #[doc = "Limit of CPU usage.\n\nNOTE: If the computer has 2 CPUs, it has total of '2' CPU time. Value '0' indicates no CPU limit."]
327 pub cpulimit: Option<f64>,
328 #[serde(skip_serializing_if = "Option::is_none", default)]
329 #[doc = "CPU weight for a VM, will be clamped to [1, 10000] in cgroup v2."]
330 #[doc = "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."]
331 pub cpuunits: Option<()>,
332 #[serde(skip_serializing_if = "Option::is_none", default)]
333 #[doc = "Description for the VM. Shown in the web-interface VM's summary. This is saved as comment inside the configuration file."]
334 pub description: Option<String>,
335 #[serde(skip_serializing_if = "Option::is_none", default)]
336 #[doc = "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."]
337 pub efidisk0: Option<String>,
338 #[serde(
339 serialize_with = "crate::types::serialize_bool_optional",
340 deserialize_with = "crate::types::deserialize_bool_optional"
341 )]
342 #[serde(skip_serializing_if = "Option::is_none", default)]
343 #[doc = "Allow to overwrite existing VM."]
344 pub force: Option<bool>,
345 #[serde(
346 serialize_with = "crate::types::serialize_bool_optional",
347 deserialize_with = "crate::types::deserialize_bool_optional"
348 )]
349 #[serde(skip_serializing_if = "Option::is_none", default)]
350 #[doc = "Freeze CPU at startup (use 'c' monitor command to start execution)."]
351 pub freeze: Option<bool>,
352 #[serde(skip_serializing_if = "Option::is_none", default)]
353 #[doc = "Script that will be executed during various steps in the vms lifetime."]
354 pub hookscript: Option<String>,
355 #[serde(rename = "hostpci[n]")]
356 #[serde(
357 serialize_with = "crate::types::serialize_multi::<NumberedHostpcis, _>",
358 deserialize_with = "crate::types::deserialize_multi::<NumberedHostpcis, _>"
359 )]
360 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
361 #[serde(flatten)]
362 #[doc = "Map host PCI devices into guest."]
363 #[doc = "Map host PCI devices into guest.\n\nNOTE: This option allows direct access to host hardware. So it is no longer\npossible to migrate such machines - use with special care.\n\nCAUTION: Experimental! User reported problems with this option.\n"]
364 pub hostpcis: ::std::collections::HashMap<u32, String>,
365 #[serde(skip_serializing_if = "Option::is_none", default)]
366 #[doc = "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."]
367 pub hotplug: Option<String>,
368 #[serde(skip_serializing_if = "Option::is_none", default)]
369 #[doc = "Enable/disable hugepages memory."]
370 pub hugepages: Option<Hugepages>,
371 #[serde(rename = "ide[n]")]
372 #[serde(
373 serialize_with = "crate::types::serialize_multi::<NumberedIdes, _>",
374 deserialize_with = "crate::types::deserialize_multi::<NumberedIdes, _>"
375 )]
376 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
377 #[serde(flatten)]
378 #[doc = "Use volume as IDE hard disk or CD-ROM (n is 0 to 3). Use the special syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume. Use STORAGE_ID:0 and the 'import-from' parameter to import from an existing volume."]
379 pub ides: ::std::collections::HashMap<u32, String>,
380 #[serde(rename = "ipconfig[n]")]
381 #[serde(
382 serialize_with = "crate::types::serialize_multi::<NumberedIpconfigs, _>",
383 deserialize_with = "crate::types::deserialize_multi::<NumberedIpconfigs, _>"
384 )]
385 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
386 #[serde(flatten)]
387 #[doc = "cloud-init: Specify IP addresses and gateways for the corresponding interface.\n\nIP addresses use CIDR notation, gateways are optional but need an IP of the same type specified.\n\nThe special string 'dhcp' can be used for IP addresses to use DHCP, in which case no explicit\ngateway should be provided.\nFor IPv6 the special string 'auto' can be used to use stateless autoconfiguration. This requires\ncloud-init 19.4 or newer.\n\nIf cloud-init is enabled and neither an IPv4 nor an IPv6 address is specified, it defaults to using\ndhcp on IPv4.\n"]
388 pub ipconfigs: ::std::collections::HashMap<u32, String>,
389 #[serde(skip_serializing_if = "Option::is_none", default)]
390 #[doc = "Inter-VM shared memory. Useful for direct communication between VMs, or to the host."]
391 pub ivshmem: Option<String>,
392 #[serde(
393 serialize_with = "crate::types::serialize_bool_optional",
394 deserialize_with = "crate::types::deserialize_bool_optional"
395 )]
396 #[serde(skip_serializing_if = "Option::is_none", default)]
397 #[doc = "Use together with hugepages. If enabled, hugepages will not not be deleted after VM shutdown and can be used for subsequent starts."]
398 pub keephugepages: Option<bool>,
399 #[serde(skip_serializing_if = "Option::is_none", default)]
400 #[doc = "Keyboard layout for VNC server. This option is generally not required and is often better handled from within the guest OS."]
401 pub keyboard: Option<Keyboard>,
402 #[serde(
403 serialize_with = "crate::types::serialize_bool_optional",
404 deserialize_with = "crate::types::deserialize_bool_optional"
405 )]
406 #[serde(skip_serializing_if = "Option::is_none", default)]
407 #[doc = "Enable/disable KVM hardware virtualization."]
408 pub kvm: Option<bool>,
409 #[serde(rename = "live-restore")]
410 #[serde(
411 serialize_with = "crate::types::serialize_bool_optional",
412 deserialize_with = "crate::types::deserialize_bool_optional"
413 )]
414 #[serde(skip_serializing_if = "Option::is_none", default)]
415 #[doc = "Start the VM immediately while importing or restoring in the background."]
416 pub live_restore: Option<bool>,
417 #[serde(
418 serialize_with = "crate::types::serialize_bool_optional",
419 deserialize_with = "crate::types::deserialize_bool_optional"
420 )]
421 #[serde(skip_serializing_if = "Option::is_none", default)]
422 #[doc = "Set the real time clock (RTC) to local time. This is enabled by default if the `ostype` indicates a Microsoft Windows OS."]
423 pub localtime: Option<bool>,
424 #[serde(skip_serializing_if = "Option::is_none", default)]
425 #[doc = "Lock/unlock the VM."]
426 pub lock: Option<Lock>,
427 #[serde(skip_serializing_if = "Option::is_none", default)]
428 #[doc = "Specifies the QEMU machine type."]
429 pub machine: Option<String>,
430 #[serde(skip_serializing_if = "Option::is_none", default)]
431 #[doc = "Memory properties."]
432 pub memory: Option<String>,
433 #[serde(
434 serialize_with = "crate::types::serialize_number_optional",
435 deserialize_with = "crate::types::deserialize_number_optional"
436 )]
437 #[serde(skip_serializing_if = "Option::is_none", default)]
438 #[doc = "Set maximum tolerated downtime (in seconds) for migrations."]
439 pub migrate_downtime: Option<f64>,
440 #[serde(
441 serialize_with = "crate::types::serialize_int_optional",
442 deserialize_with = "crate::types::deserialize_int_optional"
443 )]
444 #[serde(skip_serializing_if = "Option::is_none", default)]
445 #[doc = "Set maximum speed (in MB/s) for migrations. Value 0 is no limit."]
446 pub migrate_speed: Option<u64>,
447 #[serde(skip_serializing_if = "Option::is_none", default)]
448 #[doc = "Set a name for the VM. Only used on the configuration web interface."]
449 pub name: Option<String>,
450 #[serde(skip_serializing_if = "Option::is_none", default)]
451 #[doc = "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."]
452 pub nameserver: Option<String>,
453 #[serde(rename = "net[n]")]
454 #[serde(
455 serialize_with = "crate::types::serialize_multi::<NumberedNets, _>",
456 deserialize_with = "crate::types::deserialize_multi::<NumberedNets, _>"
457 )]
458 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
459 #[serde(flatten)]
460 #[doc = "Specify network devices."]
461 pub nets: ::std::collections::HashMap<u32, String>,
462 #[serde(
463 serialize_with = "crate::types::serialize_bool_optional",
464 deserialize_with = "crate::types::deserialize_bool_optional"
465 )]
466 #[serde(skip_serializing_if = "Option::is_none", default)]
467 #[doc = "Enable/disable NUMA."]
468 pub numa: Option<bool>,
469 #[serde(rename = "numa[n]")]
470 #[serde(
471 serialize_with = "crate::types::serialize_multi::<NumberedNumas, _>",
472 deserialize_with = "crate::types::deserialize_multi::<NumberedNumas, _>"
473 )]
474 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
475 #[serde(flatten)]
476 #[doc = "NUMA topology."]
477 pub numas: ::std::collections::HashMap<u32, String>,
478 #[serde(
479 serialize_with = "crate::types::serialize_bool_optional",
480 deserialize_with = "crate::types::deserialize_bool_optional"
481 )]
482 #[serde(skip_serializing_if = "Option::is_none", default)]
483 #[doc = "Specifies whether a VM will be started during system bootup."]
484 pub onboot: Option<bool>,
485 #[serde(skip_serializing_if = "Option::is_none", default)]
486 #[doc = "Specify guest operating system."]
487 #[doc = "Specify guest operating system. This is used to enable special\noptimization/features for specific operating systems:\n\n[horizontal]\nother;; unspecified OS\nwxp;; Microsoft Windows XP\nw2k;; Microsoft Windows 2000\nw2k3;; Microsoft Windows 2003\nw2k8;; Microsoft Windows 2008\nwvista;; Microsoft Windows Vista\nwin7;; Microsoft Windows 7\nwin8;; Microsoft Windows 8/2012/2012r2\nwin10;; Microsoft Windows 10/2016/2019\nwin11;; Microsoft Windows 11/2022\nl24;; Linux 2.4 Kernel\nl26;; Linux 2.6 - 6.X Kernel\nsolaris;; Solaris/OpenSolaris/OpenIndiania kernel\n"]
488 pub ostype: Option<Ostype>,
489 #[serde(rename = "parallel[n]")]
490 #[serde(
491 serialize_with = "crate::types::serialize_multi::<NumberedParallels, _>",
492 deserialize_with = "crate::types::deserialize_multi::<NumberedParallels, _>"
493 )]
494 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
495 #[serde(flatten)]
496 #[doc = "Map host parallel devices (n is 0 to 2)."]
497 #[doc = "Map host parallel devices (n is 0 to 2).\n\nNOTE: This option allows direct access to host hardware. So it is no longer possible to migrate such\nmachines - use with special care.\n\nCAUTION: Experimental! User reported problems with this option.\n"]
498 pub parallels: ::std::collections::HashMap<u32, String>,
499 #[serde(skip_serializing_if = "Option::is_none", default)]
500 #[doc = "Add the VM to the specified pool."]
501 pub pool: Option<String>,
502 #[serde(
503 serialize_with = "crate::types::serialize_bool_optional",
504 deserialize_with = "crate::types::deserialize_bool_optional"
505 )]
506 #[serde(skip_serializing_if = "Option::is_none", default)]
507 #[doc = "Sets the protection flag of the VM. This will disable the remove VM and remove disk operations."]
508 pub protection: Option<bool>,
509 #[serde(
510 serialize_with = "crate::types::serialize_bool_optional",
511 deserialize_with = "crate::types::deserialize_bool_optional"
512 )]
513 #[serde(skip_serializing_if = "Option::is_none", default)]
514 #[doc = "Allow reboot. If set to '0' the VM exit on reboot."]
515 pub reboot: Option<bool>,
516 #[serde(skip_serializing_if = "Option::is_none", default)]
517 #[doc = "Configure a VirtIO-based Random Number Generator."]
518 pub rng0: Option<String>,
519 #[serde(rename = "sata[n]")]
520 #[serde(
521 serialize_with = "crate::types::serialize_multi::<NumberedSatas, _>",
522 deserialize_with = "crate::types::deserialize_multi::<NumberedSatas, _>"
523 )]
524 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
525 #[serde(flatten)]
526 #[doc = "Use volume as SATA hard disk or CD-ROM (n is 0 to 5). Use the special syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume. Use STORAGE_ID:0 and the 'import-from' parameter to import from an existing volume."]
527 pub satas: ::std::collections::HashMap<u32, String>,
528 #[serde(rename = "scsi[n]")]
529 #[serde(
530 serialize_with = "crate::types::serialize_multi::<NumberedScsis, _>",
531 deserialize_with = "crate::types::deserialize_multi::<NumberedScsis, _>"
532 )]
533 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
534 #[serde(flatten)]
535 #[doc = "Use volume as SCSI hard disk or CD-ROM (n is 0 to 30). Use the special syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume. Use STORAGE_ID:0 and the 'import-from' parameter to import from an existing volume."]
536 pub scsis: ::std::collections::HashMap<u32, String>,
537 #[serde(skip_serializing_if = "Option::is_none", default)]
538 #[doc = "SCSI controller model"]
539 pub scsihw: Option<Scsihw>,
540 #[serde(skip_serializing_if = "Option::is_none", default)]
541 #[doc = "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."]
542 pub searchdomain: Option<String>,
543 #[serde(rename = "serial[n]")]
544 #[serde(
545 serialize_with = "crate::types::serialize_multi::<NumberedSerials, _>",
546 deserialize_with = "crate::types::deserialize_multi::<NumberedSerials, _>"
547 )]
548 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
549 #[serde(flatten)]
550 #[doc = "Create a serial device inside the VM (n is 0 to 3)"]
551 #[doc = "Create a serial device inside the VM (n is 0 to 3), and pass through a\nhost serial device (i.e. /dev/ttyS0), or create a unix socket on the\nhost side (use 'qm terminal' to open a terminal connection).\n\nNOTE: If you pass through a host serial device, it is no longer possible to migrate such machines -\nuse with special care.\n\nCAUTION: Experimental! User reported problems with this option.\n"]
552 pub serials: ::std::collections::HashMap<u32, String>,
553 #[serde(
554 serialize_with = "crate::types::serialize_int_optional",
555 deserialize_with = "crate::types::deserialize_int_optional"
556 )]
557 #[serde(skip_serializing_if = "Option::is_none", default)]
558 #[doc = "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."]
559 pub shares: Option<u64>,
560 #[serde(skip_serializing_if = "Option::is_none", default)]
561 #[doc = "Specify SMBIOS type 1 fields."]
562 pub smbios1: Option<String>,
563 #[serde(
564 serialize_with = "crate::types::serialize_int_optional",
565 deserialize_with = "crate::types::deserialize_int_optional"
566 )]
567 #[serde(skip_serializing_if = "Option::is_none", default)]
568 #[doc = "The number of CPUs. Please use option -sockets instead."]
569 pub smp: Option<u64>,
570 #[serde(
571 serialize_with = "crate::types::serialize_int_optional",
572 deserialize_with = "crate::types::deserialize_int_optional"
573 )]
574 #[serde(skip_serializing_if = "Option::is_none", default)]
575 #[doc = "The number of CPU sockets."]
576 pub sockets: Option<u64>,
577 #[serde(skip_serializing_if = "Option::is_none", default)]
578 #[doc = "Configure additional enhancements for SPICE."]
579 pub spice_enhancements: Option<String>,
580 #[serde(skip_serializing_if = "Option::is_none", default)]
581 #[doc = "cloud-init: Setup public SSH keys (one key per line, OpenSSH format)."]
582 pub sshkeys: Option<String>,
583 #[serde(
584 serialize_with = "crate::types::serialize_bool_optional",
585 deserialize_with = "crate::types::deserialize_bool_optional"
586 )]
587 #[serde(skip_serializing_if = "Option::is_none", default)]
588 #[doc = "Start VM after it was created successfully."]
589 pub start: Option<bool>,
590 #[serde(skip_serializing_if = "Option::is_none", default)]
591 #[doc = "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'."]
592 pub startdate: Option<String>,
593 #[serde(skip_serializing_if = "Option::is_none", default)]
594 #[doc = "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."]
595 pub startup: Option<String>,
596 #[serde(skip_serializing_if = "Option::is_none", default)]
597 #[doc = "Default storage."]
598 pub storage: Option<String>,
599 #[serde(
600 serialize_with = "crate::types::serialize_bool_optional",
601 deserialize_with = "crate::types::deserialize_bool_optional"
602 )]
603 #[serde(skip_serializing_if = "Option::is_none", default)]
604 #[doc = "Enable/disable the USB tablet device."]
605 #[doc = "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`)."]
606 pub tablet: Option<bool>,
607 #[serde(skip_serializing_if = "Option::is_none", default)]
608 #[doc = "Tags of the VM. This is only meta information."]
609 pub tags: Option<String>,
610 #[serde(
611 serialize_with = "crate::types::serialize_bool_optional",
612 deserialize_with = "crate::types::deserialize_bool_optional"
613 )]
614 #[serde(skip_serializing_if = "Option::is_none", default)]
615 #[doc = "Enable/disable time drift fix."]
616 pub tdf: Option<bool>,
617 #[serde(
618 serialize_with = "crate::types::serialize_bool_optional",
619 deserialize_with = "crate::types::deserialize_bool_optional"
620 )]
621 #[serde(skip_serializing_if = "Option::is_none", default)]
622 #[doc = "Enable/disable Template."]
623 pub template: Option<bool>,
624 #[serde(skip_serializing_if = "Option::is_none", default)]
625 #[doc = "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."]
626 pub tpmstate0: Option<String>,
627 #[serde(
628 serialize_with = "crate::types::serialize_bool_optional",
629 deserialize_with = "crate::types::deserialize_bool_optional"
630 )]
631 #[serde(skip_serializing_if = "Option::is_none", default)]
632 #[doc = "Assign a unique random ethernet address."]
633 pub unique: Option<bool>,
634 #[serde(rename = "unused[n]")]
635 #[serde(
636 serialize_with = "crate::types::serialize_multi::<NumberedUnuseds, _>",
637 deserialize_with = "crate::types::deserialize_multi::<NumberedUnuseds, _>"
638 )]
639 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
640 #[serde(flatten)]
641 #[doc = "Reference to unused volumes. This is used internally, and should not be modified manually."]
642 pub unuseds: ::std::collections::HashMap<u32, String>,
643 #[serde(rename = "usb[n]")]
644 #[serde(
645 serialize_with = "crate::types::serialize_multi::<NumberedUsbs, _>",
646 deserialize_with = "crate::types::deserialize_multi::<NumberedUsbs, _>"
647 )]
648 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
649 #[serde(flatten)]
650 #[doc = "Configure an USB device (n is 0 to 4, for machine version \\>= 7.1 and ostype l26 or windows \\> 7, n can be up to 14)."]
651 pub usbs: ::std::collections::HashMap<u32, String>,
652 #[serde(
653 serialize_with = "crate::types::serialize_int_optional",
654 deserialize_with = "crate::types::deserialize_int_optional"
655 )]
656 #[serde(skip_serializing_if = "Option::is_none", default)]
657 #[doc = "Number of hotplugged vcpus."]
658 pub vcpus: Option<u64>,
659 #[serde(skip_serializing_if = "Option::is_none", default)]
660 #[doc = "Configure the VGA hardware."]
661 #[doc = "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.\nYou can also run without any graphic card, using a serial device as terminal."]
662 pub vga: Option<String>,
663 #[serde(rename = "virtio[n]")]
664 #[serde(
665 serialize_with = "crate::types::serialize_multi::<NumberedVirtios, _>",
666 deserialize_with = "crate::types::deserialize_multi::<NumberedVirtios, _>"
667 )]
668 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
669 #[serde(flatten)]
670 #[doc = "Use volume as VIRTIO hard disk (n is 0 to 15). Use the special syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume. Use STORAGE_ID:0 and the 'import-from' parameter to import from an existing volume."]
671 pub virtios: ::std::collections::HashMap<u32, String>,
672 #[serde(skip_serializing_if = "Option::is_none", default)]
673 #[doc = "Set VM Generation ID. Use '1' to autogenerate on create or update, pass '0' to disable explicitly."]
674 #[doc = "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.\nNote that auto-creation only works when done through API/CLI create or update methods, but not when manually editing the config file."]
675 pub vmgenid: Option<String>,
676 #[doc = "The (unique) ID of the VM."]
677 pub vmid: crate::types::VmId,
678 #[serde(skip_serializing_if = "Option::is_none", default)]
679 #[doc = "Default storage for VM state volumes/files."]
680 pub vmstatestorage: Option<String>,
681 #[serde(skip_serializing_if = "Option::is_none", default)]
682 #[doc = "Create a virtual hardware watchdog device."]
683 #[doc = "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)"]
684 pub watchdog: Option<String>,
685 #[serde(
686 flatten,
687 deserialize_with = "crate::types::multi::deserialize_additional_data::<'_, PostParams, _, _>"
688 )]
689 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
690}
691impl crate::types::multi::Test for PostParams {
692 fn test_fn() -> fn(&str) -> bool {
693 fn the_test(input: &str) -> bool {
694 let array = [
695 <NumberedHostpcis as crate::types::multi::NumberedItems>::key_matches
696 as fn(&str) -> bool,
697 <NumberedIdes as crate::types::multi::NumberedItems>::key_matches
698 as fn(&str) -> bool,
699 <NumberedIpconfigs as crate::types::multi::NumberedItems>::key_matches
700 as fn(&str) -> bool,
701 <NumberedNets as crate::types::multi::NumberedItems>::key_matches
702 as fn(&str) -> bool,
703 <NumberedNumas as crate::types::multi::NumberedItems>::key_matches
704 as fn(&str) -> bool,
705 <NumberedParallels as crate::types::multi::NumberedItems>::key_matches
706 as fn(&str) -> bool,
707 <NumberedSatas as crate::types::multi::NumberedItems>::key_matches
708 as fn(&str) -> bool,
709 <NumberedScsis as crate::types::multi::NumberedItems>::key_matches
710 as fn(&str) -> bool,
711 <NumberedSerials as crate::types::multi::NumberedItems>::key_matches
712 as fn(&str) -> bool,
713 <NumberedUnuseds as crate::types::multi::NumberedItems>::key_matches
714 as fn(&str) -> bool,
715 <NumberedUsbs as crate::types::multi::NumberedItems>::key_matches
716 as fn(&str) -> bool,
717 <NumberedVirtios as crate::types::multi::NumberedItems>::key_matches
718 as fn(&str) -> bool,
719 ];
720 array.iter().any(|f| f(input))
721 }
722 the_test as _
723 }
724}
725#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
726pub enum Arch {
727 #[serde(rename = "aarch64")]
728 Aarch64,
729 #[serde(rename = "x86_64")]
730 X8664,
731}
732#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
733pub enum Bios {
734 #[serde(rename = "ovmf")]
735 Ovmf,
736 #[serde(rename = "seabios")]
737 Seabios,
738}
739impl Default for Bios {
740 fn default() -> Self {
741 Self::Seabios
742 }
743}
744#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
745pub enum Citype {
746 #[serde(rename = "configdrive2")]
747 Configdrive2,
748 #[serde(rename = "nocloud")]
749 Nocloud,
750 #[serde(rename = "opennebula")]
751 Opennebula,
752}
753#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
754pub enum Hugepages {
755 #[serde(rename = "1024")]
756 _1024,
757 #[serde(rename = "2")]
758 _2,
759 #[serde(rename = "any")]
760 Any,
761}
762#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
763pub enum Keyboard {
764 #[serde(rename = "da")]
765 Da,
766 #[serde(rename = "de")]
767 De,
768 #[serde(rename = "de-ch")]
769 DeCh,
770 #[serde(rename = "en-gb")]
771 EnGb,
772 #[serde(rename = "en-us")]
773 EnUs,
774 #[serde(rename = "es")]
775 Es,
776 #[serde(rename = "fi")]
777 Fi,
778 #[serde(rename = "fr")]
779 Fr,
780 #[serde(rename = "fr-be")]
781 FrBe,
782 #[serde(rename = "fr-ca")]
783 FrCa,
784 #[serde(rename = "fr-ch")]
785 FrCh,
786 #[serde(rename = "hu")]
787 Hu,
788 #[serde(rename = "is")]
789 Is,
790 #[serde(rename = "it")]
791 It,
792 #[serde(rename = "ja")]
793 Ja,
794 #[serde(rename = "lt")]
795 Lt,
796 #[serde(rename = "mk")]
797 Mk,
798 #[serde(rename = "nl")]
799 Nl,
800 #[serde(rename = "no")]
801 No,
802 #[serde(rename = "pl")]
803 Pl,
804 #[serde(rename = "pt")]
805 Pt,
806 #[serde(rename = "pt-br")]
807 PtBr,
808 #[serde(rename = "sl")]
809 Sl,
810 #[serde(rename = "sv")]
811 Sv,
812 #[serde(rename = "tr")]
813 Tr,
814}
815#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
816pub enum Lock {
817 #[serde(rename = "backup")]
818 Backup,
819 #[serde(rename = "clone")]
820 Clone,
821 #[serde(rename = "create")]
822 Create,
823 #[serde(rename = "migrate")]
824 Migrate,
825 #[serde(rename = "rollback")]
826 Rollback,
827 #[serde(rename = "snapshot")]
828 Snapshot,
829 #[serde(rename = "snapshot-delete")]
830 SnapshotDelete,
831 #[serde(rename = "suspended")]
832 Suspended,
833 #[serde(rename = "suspending")]
834 Suspending,
835}
836#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
837pub enum Ostype {
838 #[serde(rename = "l24")]
839 L24,
840 #[serde(rename = "l26")]
841 L26,
842 #[serde(rename = "other")]
843 Other,
844 #[serde(rename = "solaris")]
845 Solaris,
846 #[serde(rename = "w2k")]
847 W2k,
848 #[serde(rename = "w2k3")]
849 W2k3,
850 #[serde(rename = "w2k8")]
851 W2k8,
852 #[serde(rename = "win10")]
853 Win10,
854 #[serde(rename = "win11")]
855 Win11,
856 #[serde(rename = "win7")]
857 Win7,
858 #[serde(rename = "win8")]
859 Win8,
860 #[serde(rename = "wvista")]
861 Wvista,
862 #[serde(rename = "wxp")]
863 Wxp,
864}
865#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
866pub enum Scsihw {
867 #[serde(rename = "lsi")]
868 Lsi,
869 #[serde(rename = "lsi53c810")]
870 Lsi53c810,
871 #[serde(rename = "megasas")]
872 Megasas,
873 #[serde(rename = "pvscsi")]
874 Pvscsi,
875 #[serde(rename = "virtio-scsi-pci")]
876 VirtioScsiPci,
877 #[serde(rename = "virtio-scsi-single")]
878 VirtioScsiSingle,
879}
880impl Default for Scsihw {
881 fn default() -> Self {
882 Self::Lsi
883 }
884}
885#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
886pub enum Status {
887 #[serde(rename = "running")]
888 Running,
889 #[serde(rename = "stopped")]
890 Stopped,
891}
892#[derive(Default)]
893struct NumberedHostpcis;
894impl crate::types::multi::NumberedItems for NumberedHostpcis {
895 type Item = String;
896 const PREFIX: &'static str = "hostpci";
897}
898#[derive(Default)]
899struct NumberedIdes;
900impl crate::types::multi::NumberedItems for NumberedIdes {
901 type Item = String;
902 const PREFIX: &'static str = "ide";
903}
904#[derive(Default)]
905struct NumberedIpconfigs;
906impl crate::types::multi::NumberedItems for NumberedIpconfigs {
907 type Item = String;
908 const PREFIX: &'static str = "ipconfig";
909}
910#[derive(Default)]
911struct NumberedNets;
912impl crate::types::multi::NumberedItems for NumberedNets {
913 type Item = String;
914 const PREFIX: &'static str = "net";
915}
916#[derive(Default)]
917struct NumberedNumas;
918impl crate::types::multi::NumberedItems for NumberedNumas {
919 type Item = String;
920 const PREFIX: &'static str = "numa";
921}
922#[derive(Default)]
923struct NumberedParallels;
924impl crate::types::multi::NumberedItems for NumberedParallels {
925 type Item = String;
926 const PREFIX: &'static str = "parallel";
927}
928#[derive(Default)]
929struct NumberedSatas;
930impl crate::types::multi::NumberedItems for NumberedSatas {
931 type Item = String;
932 const PREFIX: &'static str = "sata";
933}
934#[derive(Default)]
935struct NumberedScsis;
936impl crate::types::multi::NumberedItems for NumberedScsis {
937 type Item = String;
938 const PREFIX: &'static str = "scsi";
939}
940#[derive(Default)]
941struct NumberedSerials;
942impl crate::types::multi::NumberedItems for NumberedSerials {
943 type Item = String;
944 const PREFIX: &'static str = "serial";
945}
946#[derive(Default)]
947struct NumberedUnuseds;
948impl crate::types::multi::NumberedItems for NumberedUnuseds {
949 type Item = String;
950 const PREFIX: &'static str = "unused";
951}
952#[derive(Default)]
953struct NumberedUsbs;
954impl crate::types::multi::NumberedItems for NumberedUsbs {
955 type Item = String;
956 const PREFIX: &'static str = "usb";
957}
958#[derive(Default)]
959struct NumberedVirtios;
960impl crate::types::multi::NumberedItems for NumberedVirtios {
961 type Item = String;
962 const PREFIX: &'static str = "virtio";
963}
964impl<T> QemuClient<T>
965where
966 T: crate::client::Client,
967{
968 pub fn vmid(&self, vmid: crate::types::VmId) -> vmid::VmidClient<T> {
969 vmid::VmidClient::<T>::new(self.client.clone(), &self.path, vmid)
970 }
971}