runtime: virtcontainers/types: fix govet fieldalignment

Fix structures alignment

Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
Julio Montes 2021-07-20 10:29:21 -05:00
parent bb9495c0b7
commit 1e4f7faa77
4 changed files with 30 additions and 29 deletions

View File

@ -36,12 +36,12 @@ type Bridge struct {
// ID is used to identify the bridge in the hypervisor // ID is used to identify the bridge in the hypervisor
ID string ID string
// Addr is the slot of the bridge
Addr int
// Type is the type of the bridge (pci, pcie, etc) // Type is the type of the bridge (pci, pcie, etc)
Type Type Type Type
// Addr is the slot of the bridge
Addr int
// MaxCapacity is the max capacity of the bridge // MaxCapacity is the max capacity of the bridge
MaxCapacity uint32 MaxCapacity uint32
} }

View File

@ -96,7 +96,7 @@ func TestNewBridge(t *testing.T) {
func TestAddRemoveDevicePCI(t *testing.T) { func TestAddRemoveDevicePCI(t *testing.T) {
// create a pci bridge // create a pci bridge
bridges := []*Bridge{{make(map[uint32]string), "rgb123", 5, PCI, PCIBridgeMaxCapacity}} bridges := []*Bridge{{make(map[uint32]string), "rgb123", PCI, 5, PCIBridgeMaxCapacity}}
testAddRemoveDevice(t, bridges[0]) testAddRemoveDevice(t, bridges[0])
} }
@ -104,7 +104,7 @@ func TestAddRemoveDevicePCI(t *testing.T) {
func TestAddRemoveDeviceCCW(t *testing.T) { func TestAddRemoveDeviceCCW(t *testing.T) {
// create a CCW bridge // create a CCW bridge
bridges := []*Bridge{{make(map[uint32]string), "rgb123", 5, CCW, CCWBridgeMaxCapacity}} bridges := []*Bridge{{make(map[uint32]string), "rgb123", CCW, 5, CCWBridgeMaxCapacity}}
testAddRemoveDevice(t, bridges[0]) testAddRemoveDevice(t, bridges[0])
} }

View File

@ -14,13 +14,13 @@ type FcConfig struct {
MachineConfig *models.MachineConfiguration `json:"machine-config"` MachineConfig *models.MachineConfiguration `json:"machine-config"`
Drives []*models.Drive `json:"drives,omitempty"`
Vsock *models.Vsock `json:"vsock,omitempty"` Vsock *models.Vsock `json:"vsock,omitempty"`
NetworkInterfaces []*models.NetworkInterface `json:"network-interfaces,omitempty"`
Logger *models.Logger `json:"logger,omitempty"` Logger *models.Logger `json:"logger,omitempty"`
Metrics *models.Metrics `json:"metrics,omitempty"` Metrics *models.Metrics `json:"metrics,omitempty"`
Drives []*models.Drive `json:"drives,omitempty"`
NetworkInterfaces []*models.NetworkInterface `json:"network-interfaces,omitempty"`
} }

View File

@ -41,29 +41,29 @@ const (
// SandboxState is a sandbox state structure // SandboxState is a sandbox state structure
type SandboxState struct { type SandboxState struct {
State StateString `json:"state"`
// Index map of the block device passed to hypervisor. // Index map of the block device passed to hypervisor.
BlockIndexMap map[int]struct{} `json:"blockIndexMap"` BlockIndexMap map[int]struct{} `json:"blockIndexMap"`
// Path to all the cgroups setup for a container. Key is cgroup subsystem name
// with the value as the path.
CgroupPaths map[string]string `json:"cgroupPaths"`
State StateString `json:"state"`
// CgroupPath is the cgroup hierarchy where sandbox's processes
// including the hypervisor are placed.
CgroupPath string `json:"cgroupPath,omitempty"`
// PersistVersion indicates current storage api version.
// It's also known as ABI version of kata-runtime.
// Note: it won't be written to disk
PersistVersion uint `json:"-"`
// GuestMemoryBlockSizeMB is the size of memory block of guestos // GuestMemoryBlockSizeMB is the size of memory block of guestos
GuestMemoryBlockSizeMB uint32 `json:"guestMemoryBlockSize"` GuestMemoryBlockSizeMB uint32 `json:"guestMemoryBlockSize"`
// GuestMemoryHotplugProbe determines whether guest kernel supports memory hotplug probe interface // GuestMemoryHotplugProbe determines whether guest kernel supports memory hotplug probe interface
GuestMemoryHotplugProbe bool `json:"guestMemoryHotplugProbe"` GuestMemoryHotplugProbe bool `json:"guestMemoryHotplugProbe"`
// CgroupPath is the cgroup hierarchy where sandbox's processes
// including the hypervisor are placed.
CgroupPath string `json:"cgroupPath,omitempty"`
// Path to all the cgroups setup for a container. Key is cgroup subsystem name
// with the value as the path.
CgroupPaths map[string]string `json:"cgroupPaths"`
// PersistVersion indicates current storage api version.
// It's also known as ABI version of kata-runtime.
// Note: it won't be written to disk
PersistVersion uint `json:"-"`
} }
// Valid checks that the sandbox state is valid. // Valid checks that the sandbox state is valid.
@ -179,9 +179,9 @@ func (v *Volumes) String() string {
// the host and any process inside the VM. // the host and any process inside the VM.
// This kind of socket is not supported in all hypervisors. // This kind of socket is not supported in all hypervisors.
type VSock struct { type VSock struct {
VhostFd *os.File
ContextID uint64 ContextID uint64
Port uint32 Port uint32
VhostFd *os.File
} }
func (s *VSock) String() string { func (s *VSock) String() string {
@ -281,9 +281,7 @@ type EnvVar struct {
// Cmd represents a command to execute in a running container. // Cmd represents a command to execute in a running container.
type Cmd struct { type Cmd struct {
Args []string Capabilities *specs.LinuxCapabilities
Envs []EnvVar
SupplementaryGroups []string
// Note that these fields *MUST* remain as strings. // Note that these fields *MUST* remain as strings.
// //
@ -311,7 +309,10 @@ type Cmd struct {
PrimaryGroup string PrimaryGroup string
WorkDir string WorkDir string
Console string Console string
Capabilities *specs.LinuxCapabilities
Args []string
Envs []EnvVar
SupplementaryGroups []string
Interactive bool Interactive bool
Detach bool Detach bool