lint: Fix virtcontainers maligned errors

Correct `maligned` linter issues.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
James O. D. Hunt 2018-03-19 18:52:33 +00:00
parent cc09b01ab2
commit 9b98c26a80
3 changed files with 46 additions and 40 deletions

View File

@ -145,6 +145,12 @@ type Param struct {
// HypervisorConfig is the hypervisor configuration.
type HypervisorConfig struct {
// KernelParams are additional guest kernel parameters.
KernelParams []Param
// HypervisorParams are additional hypervisor parameters.
HypervisorParams []Param
// KernelPath is the guest kernel host path.
KernelPath string
@ -160,26 +166,19 @@ type HypervisorConfig struct {
// HypervisorPath is the hypervisor executable host path.
HypervisorPath string
// DisableBlockDeviceUse disallows a block device from being used.
DisableBlockDeviceUse bool
// BlockDeviceDriver specifies the driver to be used for block device
// either VirtioSCSI or VirtioBlock with the default driver being defaultBlockDriver
BlockDeviceDriver string
// KernelParams are additional guest kernel parameters.
KernelParams []Param
// HypervisorParams are additional hypervisor parameters.
HypervisorParams []Param
// HypervisorMachineType specifies the type of machine being
// emulated.
HypervisorMachineType string
// Debug changes the default hypervisor and kernel parameters to
// enable debug output where available.
Debug bool
// customAssets is a map of assets.
// Each value in that map takes precedence over the configured assets.
// For example, if there is a value for the "kernel" key in this map,
// it will be used for the pod's kernel path instead of KernelPath.
customAssets map[assetType]*asset
// DefaultVCPUs specifies default number of vCPUs for the VM.
DefaultVCPUs uint32
@ -195,6 +194,13 @@ type HypervisorConfig struct {
// Bridges can be used to hot plug devices
DefaultBridges uint32
// DisableBlockDeviceUse disallows a block device from being used.
DisableBlockDeviceUse bool
// Debug changes the default hypervisor and kernel parameters to
// enable debug output where available.
Debug bool
// MemPrealloc specifies if the memory should be pre-allocated
MemPrealloc bool
@ -212,12 +218,6 @@ type HypervisorConfig struct {
// DisableNestingChecks is used to override customizations performed
// when running on top of another VMM.
DisableNestingChecks bool
// customAssets is a map of assets.
// Each value in that map takes precedence over the configured assets.
// For example, if there is a value for the "kernel" key in this map,
// it will be used for the pod's kernel path instead of KernelPath.
customAssets map[assetType]*asset
}
func (conf *HypervisorConfig) valid() (bool, error) {

View File

@ -168,28 +168,34 @@ type Capabilities struct {
// Process describes a process running on a container inside a pod.
type Process struct {
User string `json:"user,omitempty"`
Group string `json:"group,omitempty"`
// Args specifies the binary and arguments for the application to execute.
Args []string `json:"args"`
// Rlimits specifies rlimit options to apply to the process.
Rlimits []Rlimit `json:"rlimits,omitempty"`
// Envs populates the process environment for the process.
Envs []EnvironmentVar `json:"envs,omitempty"`
AdditionalGroups []string `json:"additionalGroups,omitempty"`
// Terminal creates an interactive terminal for the process.
Terminal bool `json:"terminal"`
// Workdir is the current working directory for the process and must be
// relative to the container's root.
Workdir string `json:"workdir"`
User string `json:"user,omitempty"`
Group string `json:"group,omitempty"`
// Sequeue number for stdin and stdout
Stdio uint64 `json:"stdio,omitempty"`
// Sequeue number for stderr if it is not shared with stdout
Stderr uint64 `json:"stderr,omitempty"`
// Args specifies the binary and arguments for the application to execute.
Args []string `json:"args"`
// Envs populates the process environment for the process.
Envs []EnvironmentVar `json:"envs,omitempty"`
// Workdir is the current working directory for the process and must be
// relative to the container's root.
Workdir string `json:"workdir"`
// Rlimits specifies rlimit options to apply to the process.
Rlimits []Rlimit `json:"rlimits,omitempty"`
// NoNewPrivileges indicates that the process should not gain any additional privileges
Capabilities Capabilities `json:"capabilities"`
NoNewPrivileges bool `json:"noNewPrivileges"`
// Capabilities specifies the sets of capabilities for the process(es) inside the container.
Capabilities Capabilities `json:"capabilities"`
// Terminal creates an interactive terminal for the process.
Terminal bool `json:"terminal"`
}
// SystemMountsInfo describes additional information for system mounts that the agent

View File

@ -274,9 +274,9 @@ type LinuxCapabilities struct {
// Cmd represents a command to execute in a running container.
type Cmd struct {
Args []string
Envs []EnvVar
WorkDir string
Args []string
Envs []EnvVar
SupplementaryGroups []string
// Note that these fields *MUST* remain as strings.
//
@ -300,15 +300,15 @@ type Cmd struct {
// all the user and group mapping is handled by the container manager
// and specified to the runtime in terms of UID/GID's in the
// configuration file generated by the container manager.
User string
PrimaryGroup string
SupplementaryGroups []string
User string
PrimaryGroup string
WorkDir string
Console string
Capabilities LinuxCapabilities
Interactive bool
Console string
Detach bool
NoNewPrivileges bool
Capabilities LinuxCapabilities
}
// Resources describes VM resources configuration.