Skip to content

Commit

Permalink
Merge pull request #383 from Mirantis/jell/logs
Browse files Browse the repository at this point in the history
logging: Fix various logging issues
  • Loading branch information
ivan4th authored Aug 11, 2017
2 parents 18c0032 + 8a6b768 commit 361ffc3
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions cmd/criproxy/criproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func runCriProxy(connect, listen, nodeInfoPath string) error {
if shouldClean {
shouldClean = false
if err := criproxy.RemoveKubernetesContainers(ni.DockerEndpoint); err != nil {
glog.Warningf("failed to clean up old containers: %v", err)
glog.Warningf("Failed to clean up old containers: %v", err)
}
}
})
Expand Down Expand Up @@ -174,7 +174,7 @@ func main() {
case *install:
execPath, err := os.Executable()
if err != nil {
glog.Error("Can't get criproxy executable path: %v", err)
glog.Errorf("Can't get criproxy executable path: %v", err)
os.Exit(1)
}
err = installCriProxy(execPath, *nodeInfoPath)
Expand Down
4 changes: 2 additions & 2 deletions pkg/libvirttools/cloudinit.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (g *CloudInitGenerator) GenerateDisk() (*libvirtxml.DomainDisk, error) {

if err := utils.GenIsoImage(g.IsoPath(), "cidata", tmpDir); err != nil {
if rmErr := os.Remove(g.IsoPath()); rmErr != nil {
glog.Warning("Error removing iso file %s: %v", g.IsoPath(), rmErr)
glog.Warningf("Error removing iso file %s: %v", g.IsoPath(), rmErr)
}
return nil, fmt.Errorf("error generating iso image: %v", err)
}
Expand Down Expand Up @@ -173,7 +173,7 @@ func (g *CloudInitGenerator) addEnvVarsFileToWriteFiles(userData map[string]inte
var ok bool
oldWriteFiles, ok = oldWriteFilesRaw.([]interface{})
if !ok {
glog.Warning("malformed write_files entry in user-data, can't add env vars")
glog.Warning("Malformed write_files entry in user-data, can't add env vars")
return
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/libvirttools/nocloud_volumesource.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (v *nocloudVolume) Teardown() error {
isoPath := NewCloudInitGenerator(v.config, nil, nocloudIsoDir).IsoPath()
// don't fail to remove the pod if the file cannot be removed, just warn
if err := os.Remove(isoPath); err != nil {
glog.Warning("Cannot remove temporary nocloud file %q: %v", isoPath, err)
glog.Warningf("Cannot remove temporary nocloud file %q: %v", isoPath, err)
}
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/libvirttools/virtualization.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func (v *VirtualizationTool) setupVolumes(config *VMConfig, domainDef *libvirtxm
// try to tear down volumes that were already set up
for _, vmVol := range vmVols[:n] {
if err := vmVol.Teardown(); err != nil {
glog.Warning("failed to tear down a volume on error: %v", err)
glog.Warningf("Failed to tear down a volume on error: %v", err)
}
}
return err
Expand Down Expand Up @@ -482,7 +482,7 @@ func (v *VirtualizationTool) StartContainer(containerId string) error {
// and cleaning it all up upon failure, but for now we just remove the VM
// so the next `CreateContainer()` call succeeds.
if rmErr := v.RemoveContainer(containerId); rmErr != nil {
return fmt.Errorf("Container start error: %v \n+ container removal error: %v", err, rmErr)
return fmt.Errorf("container start error: %v \n+ container removal error: %v", err, rmErr)
}

return err
Expand Down Expand Up @@ -657,7 +657,7 @@ func (v *VirtualizationTool) removeDomain(containerId string, config *VMConfig,
if disallowVolumesTeardownFailure {
return err
} else {
glog.Warning("Error during volumes teardown for container %s: %v", containerId, err)
glog.Warningf("Error during volumes teardown for container %s: %v", containerId, err)
}
}

Expand Down Expand Up @@ -874,7 +874,7 @@ func (v *VirtualizationTool) ListContainers(filter *kubeapi.ContainerFilter) ([]
}
if containerInfo == nil {
// There's no such container - looks like it's already removed, but still is mentioned in sandbox
return nil, fmt.Errorf("Container metadata not found, but it's still mentioned in sandbox %s", filter.PodSandboxId)
return nil, fmt.Errorf("container metadata not found, but it's still mentioned in sandbox %s", filter.PodSandboxId)
}

container, err := v.getContainer(domain)
Expand Down
2 changes: 1 addition & 1 deletion pkg/metadata/sandboxes.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func getSandboxBucket(tx *bolt.Tx, podID string, create, optional bool) (*bolt.B
}
bucket := tx.Bucket([]byte(key))
if bucket == nil && !optional {
return nil, fmt.Errorf("Pod sandbox %q does not exist", podID)
return nil, fmt.Errorf("pod sandbox %q does not exist", podID)
}
return bucket, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/nettools/nettools.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func OpenTAP(devName string) (*os.File, error) {
copy(req.Name[:15], "tap0")
_, _, errno := syscall.Syscall(syscall.SYS_IOCTL, tapFile.Fd(), uintptr(syscall.TUNSETIFF), uintptr(unsafe.Pointer(&req)))
if errno != 0 {
return nil, fmt.Errorf("Tuntap IOCTL TUNSETIFF failed, errno %v", errno)
return nil, fmt.Errorf("tuntap IOCTL TUNSETIFF failed, errno %v", errno)
}
return tapFile, nil
}
Expand Down
2 changes: 1 addition & 1 deletion tests/gm/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func DataFileDiffers(filename string, v interface{}) (bool, error) {

var curData interface{}
if err := json.Unmarshal(content, &curData); err != nil {
glog.Warning("failed to unmarshal %q to JSON: %v", filename, err)
glog.Warningf("Failed to unmarshal %q to JSON: %v", filename, err)
return true, nil
}

Expand Down
2 changes: 1 addition & 1 deletion tests/gm/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func GitDiff(path string) (string, error) {
}
defer func() {
if err := os.Chdir(origWd); err != nil {
glog.Warning("can't chdir back to the old work dir: %v", err)
glog.Warningf("Can't chdir back to the old work dir: %v", err)
}
}()
fileDir := filepath.Dir(absPath)
Expand Down

0 comments on commit 361ffc3

Please sign in to comment.