forked from kubevirt/kubevirt
/
defaults.go
41 lines (33 loc) · 883 Bytes
/
defaults.go
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
package api
const (
resolvConf = "/etc/resolv.conf"
DefaultProtocol = "TCP"
DefaultVMCIDR = "10.0.2.0/24"
DefaultBridgeName = "k6t-eth0"
)
func SetDefaults_Devices(devices *Devices) {
// Set default memballoon, "none" means that controller disabled
devices.Ballooning = &Ballooning{
Model: "none",
}
}
func SetDefaults_OSType(ostype *OSType) {
ostype.OS = "hvm"
if ostype.Arch == "" {
ostype.Arch = "x86_64"
}
// q35 is an alias of the newest q35 machine type.
// TODO: we probably want to select concrete type in the future for "future-backwards" compatibility.
if ostype.Machine == "" {
ostype.Machine = "q35"
}
}
func SetDefaults_DomainSpec(spec *DomainSpec) {
spec.XmlNS = "http://libvirt.org/schemas/domain/qemu/1.0"
if spec.Type == "" {
spec.Type = "kvm"
}
}
func SetDefaults_SysInfo(sysinfo *SysInfo) {
sysinfo.Type = "smbios"
}