mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-25 18:53:44 +00:00
Merge pull request #19 from markdryan/static-checks
Add two additional static analysis tools to the travis builds
This commit is contained in:
@@ -19,4 +19,4 @@ before_install:
|
|||||||
script:
|
script:
|
||||||
- go env
|
- go env
|
||||||
- $GOPATH/bin/goveralls -v -service=travis-ci
|
- $GOPATH/bin/goveralls -v -service=travis-ci
|
||||||
- gometalinter --tests --vendor --disable-all --enable=misspell --enable=vet --enable=ineffassign --enable=gofmt --enable=gocyclo --cyclo-over=15 --enable=golint --enable=errcheck --enable=deadcode ./...
|
- gometalinter --tests --vendor --disable-all --enable=misspell --enable=vet --enable=ineffassign --enable=gofmt --enable=gocyclo --cyclo-over=15 --enable=golint --enable=errcheck --enable=deadcode --enable=staticcheck -enable=gas ./...
|
||||||
|
@@ -45,9 +45,11 @@ func CreateCloudInitISO(ctx context.Context, scratchDir, isoPath string,
|
|||||||
userDataPath := path.Join(dataDirPath, "user_data")
|
userDataPath := path.Join(dataDirPath, "user_data")
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
|
/* #nosec */
|
||||||
_ = os.RemoveAll(configDrivePath)
|
_ = os.RemoveAll(configDrivePath)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
/* #nosec */
|
||||||
err := os.MkdirAll(dataDirPath, 0755)
|
err := os.MkdirAll(dataDirPath, 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Unable to create config drive directory %s : %v",
|
return fmt.Errorf("Unable to create config drive directory %s : %v",
|
||||||
|
59
qemu/qemu.go
59
qemu/qemu.go
@@ -63,28 +63,28 @@ const (
|
|||||||
NVDIMM DeviceDriver = "nvdimm"
|
NVDIMM DeviceDriver = "nvdimm"
|
||||||
|
|
||||||
// Virtio9P is the 9pfs device driver.
|
// Virtio9P is the 9pfs device driver.
|
||||||
Virtio9P = "virtio-9p-pci"
|
Virtio9P DeviceDriver = "virtio-9p-pci"
|
||||||
|
|
||||||
// VirtioNet is the virt-io networking device driver.
|
// VirtioNet is the virt-io networking device driver.
|
||||||
VirtioNet = "virtio-net"
|
VirtioNet DeviceDriver = "virtio-net"
|
||||||
|
|
||||||
// VirtioNetPCI is the virt-io pci networking device driver.
|
// VirtioNetPCI is the virt-io pci networking device driver.
|
||||||
VirtioNetPCI = "virtio-net-pci"
|
VirtioNetPCI DeviceDriver = "virtio-net-pci"
|
||||||
|
|
||||||
// VirtioSerial is the serial device driver.
|
// VirtioSerial is the serial device driver.
|
||||||
VirtioSerial = "virtio-serial-pci"
|
VirtioSerial DeviceDriver = "virtio-serial-pci"
|
||||||
|
|
||||||
// VirtioBlock is the block device driver.
|
// VirtioBlock is the block device driver.
|
||||||
VirtioBlock = "virtio-blk"
|
VirtioBlock DeviceDriver = "virtio-blk"
|
||||||
|
|
||||||
// Console is the console device driver.
|
// Console is the console device driver.
|
||||||
Console = "virtconsole"
|
Console DeviceDriver = "virtconsole"
|
||||||
|
|
||||||
// VirtioSerialPort is the serial port device driver.
|
// VirtioSerialPort is the serial port device driver.
|
||||||
VirtioSerialPort = "virtserialport"
|
VirtioSerialPort DeviceDriver = "virtserialport"
|
||||||
|
|
||||||
// VHostVSockPCI is the vhost vsock pci driver.
|
// VHostVSockPCI is the vhost vsock pci driver.
|
||||||
VHostVSockPCI = "vhost-vsock-pci"
|
VHostVSockPCI DeviceDriver = "vhost-vsock-pci"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ObjectType is a string representing a qemu object type.
|
// ObjectType is a string representing a qemu object type.
|
||||||
@@ -171,10 +171,10 @@ const (
|
|||||||
Local FSDriver = "local"
|
Local FSDriver = "local"
|
||||||
|
|
||||||
// Handle is the handle qemu filesystem driver.
|
// Handle is the handle qemu filesystem driver.
|
||||||
Handle = "handle"
|
Handle FSDriver = "handle"
|
||||||
|
|
||||||
// Proxy is the proxy qemu filesystem driver.
|
// Proxy is the proxy qemu filesystem driver.
|
||||||
Proxy = "proxy"
|
Proxy FSDriver = "proxy"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -182,13 +182,13 @@ const (
|
|||||||
None SecurityModelType = "none"
|
None SecurityModelType = "none"
|
||||||
|
|
||||||
// PassThrough uses the same credentials on both the host and guest.
|
// PassThrough uses the same credentials on both the host and guest.
|
||||||
PassThrough = "passthrough"
|
PassThrough SecurityModelType = "passthrough"
|
||||||
|
|
||||||
// MappedXattr stores some files attributes as extended attributes.
|
// MappedXattr stores some files attributes as extended attributes.
|
||||||
MappedXattr = "mapped-xattr"
|
MappedXattr SecurityModelType = "mapped-xattr"
|
||||||
|
|
||||||
// MappedFile stores some files attributes in the .virtfs directory.
|
// MappedFile stores some files attributes in the .virtfs directory.
|
||||||
MappedFile = "mapped-file"
|
MappedFile SecurityModelType = "mapped-file"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FSDevice represents a qemu filesystem configuration.
|
// FSDevice represents a qemu filesystem configuration.
|
||||||
@@ -259,19 +259,19 @@ const (
|
|||||||
Pipe CharDeviceBackend = "pipe"
|
Pipe CharDeviceBackend = "pipe"
|
||||||
|
|
||||||
// Socket creates a 2 way stream socket (TCP or Unix).
|
// Socket creates a 2 way stream socket (TCP or Unix).
|
||||||
Socket = "socket"
|
Socket CharDeviceBackend = "socket"
|
||||||
|
|
||||||
// CharConsole sends traffic from the guest to QEMU's standard output.
|
// CharConsole sends traffic from the guest to QEMU's standard output.
|
||||||
CharConsole = "console"
|
CharConsole CharDeviceBackend = "console"
|
||||||
|
|
||||||
// Serial sends traffic from the guest to a serial device on the host.
|
// Serial sends traffic from the guest to a serial device on the host.
|
||||||
Serial = "serial"
|
Serial CharDeviceBackend = "serial"
|
||||||
|
|
||||||
// TTY is an alias for Serial.
|
// TTY is an alias for Serial.
|
||||||
TTY = "tty"
|
TTY CharDeviceBackend = "tty"
|
||||||
|
|
||||||
// PTY creates a new pseudo-terminal on the host and connect to it.
|
// PTY creates a new pseudo-terminal on the host and connect to it.
|
||||||
PTY = "pty"
|
PTY CharDeviceBackend = "pty"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CharDevice represents a qemu character device.
|
// CharDevice represents a qemu character device.
|
||||||
@@ -348,19 +348,19 @@ const (
|
|||||||
TAP NetDeviceType = "tap"
|
TAP NetDeviceType = "tap"
|
||||||
|
|
||||||
// MACVTAP is a macvtap networking device type.
|
// MACVTAP is a macvtap networking device type.
|
||||||
MACVTAP = "macvtap"
|
MACVTAP NetDeviceType = "macvtap"
|
||||||
|
|
||||||
// IPVTAP is a ipvtap virtual networking device type.
|
// IPVTAP is a ipvtap virtual networking device type.
|
||||||
IPVTAP = "ipvtap"
|
IPVTAP NetDeviceType = "ipvtap"
|
||||||
|
|
||||||
// VETHTAP is a veth-tap virtual networking device type.
|
// VETHTAP is a veth-tap virtual networking device type.
|
||||||
VETHTAP = "vethtap"
|
VETHTAP NetDeviceType = "vethtap"
|
||||||
|
|
||||||
// VFIO is a direct assigned PCI device or PCI VF
|
// VFIO is a direct assigned PCI device or PCI VF
|
||||||
VFIO = "VFIO"
|
VFIO NetDeviceType = "VFIO"
|
||||||
|
|
||||||
// VHOSTUSER is a vhost-user port (socket)
|
// VHOSTUSER is a vhost-user port (socket)
|
||||||
VHOSTUSER = "vhostuser"
|
VHOSTUSER NetDeviceType = "vhostuser"
|
||||||
)
|
)
|
||||||
|
|
||||||
// QemuNetdevParam converts to the QEMU -netdev parameter notation
|
// QemuNetdevParam converts to the QEMU -netdev parameter notation
|
||||||
@@ -637,7 +637,7 @@ const (
|
|||||||
NoInterface BlockDeviceInterface = "none"
|
NoInterface BlockDeviceInterface = "none"
|
||||||
|
|
||||||
// SCSI represents a SCSI block device interface.
|
// SCSI represents a SCSI block device interface.
|
||||||
SCSI = "scsi"
|
SCSI BlockDeviceInterface = "scsi"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -645,7 +645,7 @@ const (
|
|||||||
Threads BlockDeviceAIO = "threads"
|
Threads BlockDeviceAIO = "threads"
|
||||||
|
|
||||||
// Native is the pthread asynchronous I/O implementation.
|
// Native is the pthread asynchronous I/O implementation.
|
||||||
Native = "native"
|
Native BlockDeviceAIO = "native"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -976,7 +976,9 @@ type VSOCKDevice struct {
|
|||||||
const (
|
const (
|
||||||
// MinimalGuestCID is the smallest valid context ID for a guest.
|
// MinimalGuestCID is the smallest valid context ID for a guest.
|
||||||
MinimalGuestCID uint32 = 3
|
MinimalGuestCID uint32 = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
// VhostVSOCKPCI is the VSOCK vhost device type.
|
// VhostVSOCKPCI is the VSOCK vhost device type.
|
||||||
VhostVSOCKPCI = "vhost-vsock-pci"
|
VhostVSOCKPCI = "vhost-vsock-pci"
|
||||||
|
|
||||||
@@ -1029,7 +1031,7 @@ const (
|
|||||||
UTC RTCBaseType = "utc"
|
UTC RTCBaseType = "utc"
|
||||||
|
|
||||||
// LocalTime is the local base time for qemu RTC.
|
// LocalTime is the local base time for qemu RTC.
|
||||||
LocalTime = "localtime"
|
LocalTime RTCBaseType = "localtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -1037,7 +1039,7 @@ const (
|
|||||||
Host RTCClock = "host"
|
Host RTCClock = "host"
|
||||||
|
|
||||||
// VM is for using the guest clock as a reference
|
// VM is for using the guest clock as a reference
|
||||||
VM = "vm"
|
VM RTCClock = "vm"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -1045,7 +1047,7 @@ const (
|
|||||||
Slew RTCDriftFix = "slew"
|
Slew RTCDriftFix = "slew"
|
||||||
|
|
||||||
// NoDriftFix means we don't want/need to fix qemu's RTC drift.
|
// NoDriftFix means we don't want/need to fix qemu's RTC drift.
|
||||||
NoDriftFix = "none"
|
NoDriftFix RTCDriftFix = "none"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RTC represents a qemu Real Time Clock configuration.
|
// RTC represents a qemu Real Time Clock configuration.
|
||||||
@@ -1669,6 +1671,7 @@ func LaunchCustomQemu(ctx context.Context, path string, params []string, fds []*
|
|||||||
path = "qemu-system-x86_64"
|
path = "qemu-system-x86_64"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* #nosec */
|
||||||
cmd := exec.Command(path, params...)
|
cmd := exec.Command(path, params...)
|
||||||
if len(fds) > 0 {
|
if len(fds) > 0 {
|
||||||
logger.Infof("Adding extra file %v", fds)
|
logger.Infof("Adding extra file %v", fds)
|
||||||
|
@@ -409,13 +409,14 @@ func (q *QMP) mainLoop() {
|
|||||||
if q.cfg.EventCh != nil {
|
if q.cfg.EventCh != nil {
|
||||||
close(q.cfg.EventCh)
|
close(q.cfg.EventCh)
|
||||||
}
|
}
|
||||||
|
/* #nosec */
|
||||||
_ = q.conn.Close()
|
_ = q.conn.Close()
|
||||||
_ = <-fromVMCh
|
_ = <-fromVMCh
|
||||||
failOutstandingCommands(cmdQueue)
|
failOutstandingCommands(cmdQueue)
|
||||||
close(q.disconnectedCh)
|
close(q.disconnectedCh)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
version := []byte{}
|
var version []byte
|
||||||
var cmdDoneCh <-chan struct{}
|
var cmdDoneCh <-chan struct{}
|
||||||
|
|
||||||
DONE:
|
DONE:
|
||||||
|
@@ -53,11 +53,11 @@ func (l qmpTestLogger) Infof(format string, v ...interface{}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (l qmpTestLogger) Warningf(format string, v ...interface{}) {
|
func (l qmpTestLogger) Warningf(format string, v ...interface{}) {
|
||||||
l.Infof(format, v)
|
l.Infof(format, v...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l qmpTestLogger) Errorf(format string, v ...interface{}) {
|
func (l qmpTestLogger) Errorf(format string, v ...interface{}) {
|
||||||
l.Infof(format, v)
|
l.Infof(format, v...)
|
||||||
}
|
}
|
||||||
|
|
||||||
type qmpTestCommand struct {
|
type qmpTestCommand struct {
|
||||||
|
Reference in New Issue
Block a user