This repository has been archived by the owner on Feb 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
limits.go
66 lines (61 loc) · 2.02 KB
/
limits.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
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
package vm
import (
schematypes "github.com/taskcluster/go-schematypes"
"github.com/taskcluster/taskcluster-worker/runtime/util"
)
// MachineLimits imposes limits on a virtual machine definition.
type MachineLimits struct {
MaxMemory int `json:"maxMemory"`
MaxCPUs int `json:"maxCPUs"`
DefaultThreads int `json:"defaultThreads"`
}
// MachineLimitsSchema is the schema for MachineOptions.
var MachineLimitsSchema = schematypes.Object{
Title: "Machine Limits",
Description: util.Markdown(`
Limitations and default values for the virtual machine
configuration. Tasks with machine images that does not satisfy
these limitations will be resolved 'malformed-payload'.
`),
Properties: schematypes.Properties{
"maxMemory": schematypes.Integer{
Title: "Max Memory",
Description: util.Markdown(`
Maximum allowed virtual machine memory in MiB. This is
also the default memory if the machine image does not
specify memory requirements. If the machine specifies a
memory higher than this, the task will fail to run.
`),
Minimum: 0,
Maximum: 1024 * 1024, // 1 TiB
},
"maxCPUs": schematypes.Integer{
Title: "Max CPUs",
Description: util.Markdown(`
Maximum number of CPUs a virtual machine can use.
This is the product of 'threads', 'cores' and 'sockets' as specified
in the machine definition 'machine.json'. If the virtual machine image
does not specify CPU requires it will be given
'maxCPUs / defaultThreads' number of cores in a single socket.
`),
Minimum: 1,
Maximum: 255, // Maximum allowed by QEMU
},
"defaultThreads": schematypes.Integer{
Title: "Default CPU Threads",
Description: util.Markdown(`
Number of CPU threads to assign, if assigning default values for
'threads', 'cores' and 'sockets' based on 'maxCPUs'.
This should generally default to 2, if the host features hyperthreading,
otherwise 1 is likely ideal.
`),
Minimum: 1,
Maximum: 255,
},
},
Required: []string{
"maxMemory",
"maxCPUs",
"defaultThreads",
},
}