1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
make_pub!(
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[cfg_attr(
feature = "builder",
derive(derive_builder::Builder, getset::Getters),
builder(default, pattern = "owned", setter(into, strip_option)),
getset(get = "pub")
)]
/// VM contains information for virtual-machine-based containers.
struct VM {
#[serde(default, skip_serializing_if = "Option::is_none")]
/// Hypervisor specifies hypervisor-related configuration for
/// virtual-machine-based containers.
hypervisor: Option<VMHypervisor>,
/// Kernel specifies kernel-related configuration for
/// virtual-machine-based containers.
kernel: VMKernel,
#[serde(default, skip_serializing_if = "Option::is_none")]
/// Image specifies guest image related configuration for
/// virtual-machine-based containers.
image: Option<VMImage>,
}
);
make_pub!(
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[cfg_attr(
feature = "builder",
derive(derive_builder::Builder, getset::Getters),
builder(default, pattern = "owned", setter(into, strip_option)),
getset(get = "pub")
)]
/// VMHypervisor contains information about the hypervisor to use for a
/// virtual machine.
struct VMHypervisor {
/// Path is the host path to the hypervisor used to manage the virtual
/// machine.
path: PathBuf,
#[serde(default, skip_serializing_if = "Option::is_none")]
/// Parameters specifies parameters to pass to the hypervisor.
parameters: Option<Vec<String>>,
}
);
make_pub!(
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[cfg_attr(
feature = "builder",
derive(derive_builder::Builder, getset::Getters),
builder(default, pattern = "owned", setter(into, strip_option)),
getset(get = "pub")
)]
/// VMKernel contains information about the kernel to use for a virtual
/// machine.
struct VMKernel {
/// Path is the host path to the kernel used to boot the virtual
/// machine.
path: PathBuf,
#[serde(default, skip_serializing_if = "Option::is_none")]
/// Parameters specifies parameters to pass to the kernel.
parameters: Option<Vec<String>>,
#[serde(default, skip_serializing_if = "Option::is_none")]
/// InitRD is the host path to an initial ramdisk to be used by the
/// kernel.
initrd: Option<String>,
}
);
make_pub!(
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[cfg_attr(
feature = "builder",
derive(derive_builder::Builder, getset::Getters),
builder(default, pattern = "owned", setter(into, strip_option)),
getset(get = "pub")
)]
/// VMImage contains information about the virtual machine root image.
struct VMImage {
/// Path is the host path to the root image that the VM kernel would
/// boot into.
path: PathBuf,
/// Format is the root image format type (e.g. "qcow2", "raw", "vhd",
/// etc).
format: String,
}
);