Skip to content

Commit

Permalink
Merge ea125f9 into 84626cd
Browse files Browse the repository at this point in the history
  • Loading branch information
rgooch committed Apr 15, 2019
2 parents 84626cd + ea125f9 commit d6d70e5
Show file tree
Hide file tree
Showing 28 changed files with 41 additions and 47 deletions.
2 changes: 1 addition & 1 deletion cmd/imagetool/addImagefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func addImagefile(imageSClient *srpc.Client,
name, imageFilename, filterFilename, triggersFilename string) error {
imageExists, err := client.CheckImage(imageSClient, name)
if err != nil {
return errors.New("error checking for image existance: " + err.Error())
return errors.New("error checking for image existence: " + err.Error())
}
if imageExists {
return errors.New("image exists")
Expand Down
2 changes: 1 addition & 1 deletion cmd/imagetool/addImageimage.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func addImageimage(imageSClient *srpc.Client,
name, oldImageName, filterFilename, triggersFilename string) error {
imageExists, err := client.CheckImage(imageSClient, name)
if err != nil {
return errors.New("error checking for image existance: " + err.Error())
return errors.New("error checking for image existence: " + err.Error())
}
if imageExists {
return errors.New("image exists")
Expand Down
2 changes: 1 addition & 1 deletion cmd/imagetool/addImagesub.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func addImagesub(imageSClient *srpc.Client,
name, subName, filterFilename, triggersFilename string) error {
imageExists, err := client.CheckImage(imageSClient, name)
if err != nil {
return errors.New("error checking for image existance: " + err.Error())
return errors.New("error checking for image existence: " + err.Error())
}
if imageExists {
return errors.New("image exists")
Expand Down
2 changes: 1 addition & 1 deletion cmd/imagetool/addReplaceImage.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func addReplaceImage(imageSClient *srpc.Client,
name, baseImageName string, layerImageNames []string) error {
imageExists, err := client.CheckImage(imageSClient, name)
if err != nil {
return errors.New("error checking for image existance: " + err.Error())
return errors.New("error checking for image existence: " + err.Error())
}
if imageExists {
return errors.New("image exists")
Expand Down
2 changes: 1 addition & 1 deletion cmd/imagetool/copyImageSubcommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func copyImageSubcommand(args []string) {
func copyImage(imageSClient *srpc.Client, name, oldImageName string) error {
imageExists, err := client.CheckImage(imageSClient, name)
if err != nil {
return errors.New("error checking for image existance: " + err.Error())
return errors.New("error checking for image existence: " + err.Error())
}
if imageExists {
return errors.New("image exists")
Expand Down
3 changes: 3 additions & 0 deletions cmd/installer/configureLocalNetwork.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ func getConfiguration(interfaces map[string]net.Interface,
}
err = json.ReadFromFile(filepath.Join(*tftpDirectory, "config.json"),
&machineInfo)
if err != nil {
return nil, err
}
return &machineInfo, nil
}

Expand Down
5 changes: 2 additions & 3 deletions cmd/installer/configureStorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,8 @@ func installRoot(device string, fileSystem *filesystem.FileSystem,
if err != nil {
return err
}
err = util.MakeBootable(fileSystem, device, "rootfs", *mountPoint, "", true,
logger)
return nil
return util.MakeBootable(fileSystem, device, "rootfs", *mountPoint, "",
true, logger)
}

func installTmpRoot(fileSystem *filesystem.FileSystem,
Expand Down
6 changes: 3 additions & 3 deletions cmd/subd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,9 @@ func main() {
os.Exit(1)
}
fsh.Update(nil)
sighupChannel := make(chan os.Signal)
sighupChannel := make(chan os.Signal, 1)
signal.Notify(sighupChannel, syscall.SIGHUP)
sigtermChannel := make(chan os.Signal)
sigtermChannel := make(chan os.Signal, 1)
signal.Notify(sigtermChannel, syscall.SIGTERM, syscall.SIGINT)
writePidfile()
for iter := 0; true; {
Expand Down Expand Up @@ -419,7 +419,7 @@ func main() {
iter++
runtime.GC() // An opportune time to take out the garbage.
if *showStats {
fmt.Print(fsh)
fmt.Print(&fsh) // Use pointer to silence go vet.
fmt.Print(fsh.FileSystem())
memstats.WriteMemoryStats(os.Stdout)
fmt.Println()
Expand Down
3 changes: 0 additions & 3 deletions cmd/subd/vCpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ func adjustVcpuLimit(limit *uint, logger log.Logger) {
vCpuCreditRate, err := getAwsVcpuCreditRate()
if err == nil && vCpuCreditRate > 0 {
newLimit := initialLimit * vCpuCreditRate / 60 / uint(runtime.NumCPU())
if newLimit < 0 {
newLimit = 1
}
logger.Printf("Adjusting default CPU limit to: %d%%\n", newLimit)
*limit = newLimit
}
Expand Down
3 changes: 3 additions & 0 deletions cmd/vm-control/importVirshVm.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ func ensureDomainIsStopped(domainName string) error {
}
response, err := askForInputChoice("Cannot import running VM",
[]string{"shutdown", "quit"})
if err != nil {
return err
}
if response == "quit" {
return fmt.Errorf("domain must be shut off but is \"%s\"", state)
}
Expand Down
2 changes: 1 addition & 1 deletion hypervisor/manager/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type Manager struct {
numCPU int
serialNumber string
volumeDirectories []string
mutex sync.RWMutex // Lock everthing below (those can change).
mutex sync.RWMutex // Lock everything below (those can change).
addressPool addressPoolType
healthStatus string
notifiers map[<-chan proto.Update]chan<- proto.Update
Expand Down
2 changes: 1 addition & 1 deletion lib/connpool/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (cr *ConnResource) GetWithDialer(cancelChannel <-chan struct{},
return cr.get(cancelChannel, dialer)
}

// ScheduleClose will immediatly Close the associated Conn if it is not in use
// ScheduleClose will immediately Close the associated Conn if it is not in use
// or will mark the Conn to be closed when it is next Put.
func (cr *ConnResource) ScheduleClose() {
cr.resource.ScheduleRelease()
Expand Down
4 changes: 2 additions & 2 deletions lib/cpusharer/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (s *FifoCpuSharer) GoWhenIdle(minIdleTime, timeout time.Duration,

// GrabCpu will grab a CPU for use. If there are none available (i.e. all CPUs
// are in use by other co-operating goroutines) then this will block until a CPU
// is available. Grab requests are fullfilled in the order they are made.
// is available. Grab requests are fulfilled in the order they are made.
func (s *FifoCpuSharer) GrabCpu() {
s.grabCpu()
}
Expand All @@ -117,7 +117,7 @@ func (s *FifoCpuSharer) GrabIdleCpu(minIdleTime, timeout time.Duration) bool {
}

// GrabSemaphore will safely grab the provided semaphore, releasing and
// re-aquiring the CPU if the semaphore blocks. Use this to avoid deadlocks.
// re-acquiring the CPU if the semaphore blocks. Use this to avoid deadlocks.
func (s *FifoCpuSharer) GrabSemaphore(semaphore chan<- struct{}) {
grabSemaphore(s, semaphore)
}
Expand Down
2 changes: 1 addition & 1 deletion lib/cpusharer/fifo.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (s *FifoCpuSharer) grabIdleCpu(minIdleTime, timeout time.Duration) bool {
time.Sleep(minIdleTime)
select {
case s.semaphore <- struct{}{}: // A CPU was idle.
default: // No idle CPU: try agin.
default: // No idle CPU: try again.
continue
}
}
Expand Down
1 change: 0 additions & 1 deletion lib/filesystem/scanner/walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ func scanFileSystem(rootDirectoryName string,
err, _ := scanDirectory(&fileSystem.FileSystem.DirectoryInode, oldDirectory,
&fileSystem, oldFS, "/")
oldFS = nil
oldDirectory = nil
if err != nil {
return nil, err
}
Expand Down
3 changes: 3 additions & 0 deletions lib/filesystem/util/replaceComputedFiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ func (objectsGetter *combinedObjectsGetter) scanDirectory(realDir string,
}
names, err := file.Readdirnames(-1)
file.Close()
if err != nil {
return err
}
for _, name := range names {
realPath := path.Join(realDir, name)
mapPath := path.Join(mapDir, name)
Expand Down
2 changes: 1 addition & 1 deletion lib/filter/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
// A Filter contains a list of regular expressions matching pathnames which
// should be filtered out: excluded when building or not changed when pushing
// images to a sub.
// A Filter with no lines is an empty filter (nothing is excluded, everthing is
// A Filter with no lines is an empty filter (nothing is excluded, everything is
// changed when pushing).
// A nil *Filter is a sparse filter: when building nothing is excluded. When
// pushing to a sub, all files are pushed but files on the sub which are not in
Expand Down
4 changes: 2 additions & 2 deletions lib/fsutil/waitFile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestWaitFile(t *testing.T) {
pathNotExist := path.Join(dirname, "never-exists")
rc, err := WaitFile(pathNotExist, time.Microsecond)
if err == nil {
t.Errorf("Expected timeout error for non-existant file")
t.Errorf("Expected timeout error for non-existent file")
rc.Close()
}
pathExists := path.Join(dirname, "exists")
Expand Down Expand Up @@ -45,7 +45,7 @@ func TestWaitFile(t *testing.T) {
rc, err = WaitFile(pathExistsLater, time.Millisecond*10)
if err == nil {
rc.Close()
t.Errorf("Expected timeout error for non-existant file")
t.Errorf("Expected timeout error for non-existent file")
}
rc, err = WaitFile(pathExistsLater, time.Millisecond*90)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions lib/fsutil/watchFile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func testWatchFile(t *testing.T, dirname string) {
rc, err := watchTimeout(ch, time.Millisecond*50)
if err != errorTimeout {
rc.Close()
t.Fatal("Expected timeout error for non-existant file")
t.Fatal("Expected timeout error for non-existent file")
}
pathExists := path.Join(dirname, "exists")
file, err := os.Create(pathExists)
Expand All @@ -74,7 +74,7 @@ func testWatchFile(t *testing.T, dirname string) {
ch = WatchFile(pathExistsLater, logger)
_, err = watchTimeout(ch, time.Millisecond*10)
if err != errorTimeout {
t.Fatal("Expected timeout error for non-existant file")
t.Fatal("Expected timeout error for non-existent file")
}
rc, err = watchTimeout(ch, time.Millisecond*90)
if err != nil {
Expand Down
15 changes: 6 additions & 9 deletions lib/net/reverseconnection/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,18 @@ func (l *Listener) connectLoop(config ReverseListenerConfig,
continue
}
if message.MinimumInterval >= time.Second {
newMinimumInterval := message.MinimumInterval
newMaximumInterval := config.MaximumInterval
if message.MaximumInterval > newMinimumInterval {
newMaximumInterval = message.MaximumInterval
} else {
newMaximumInterval = newMinimumInterval * 11 / 10
newMaximumInterval := message.MaximumInterval
if newMaximumInterval <= message.MinimumInterval {
newMaximumInterval = message.MinimumInterval * 11 / 10
}
if newMinimumInterval != config.MinimumInterval ||
if message.MinimumInterval != config.MinimumInterval ||
newMaximumInterval != config.MaximumInterval {
logger.Debugf(0,
"min interval: %s -> %s, max interval: %s -> %s\n",
config.MinimumInterval, newMinimumInterval,
config.MinimumInterval, message.MinimumInterval,
config.MaximumInterval, newMaximumInterval)
}
config.MinimumInterval = newMinimumInterval
config.MinimumInterval = message.MinimumInterval
config.MaximumInterval = newMaximumInterval
}
}
Expand Down
3 changes: 1 addition & 2 deletions lib/net/rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ func dialHTTPPath(dialer net.Dialer, network, address, path string) (
return nil, err
}
io.WriteString(conn, "CONNECT "+path+" HTTP/1.0\n\n")

// Require successful HTTP reponse before switching to RPC protocol
// Require successful HTTP response before switching to RPC protocol
resp, err := http.ReadResponse(
bufio.NewReader(conn), &http.Request{Method: "CONNECT"})
// The status value is undocumented and subject to change!
Expand Down
4 changes: 0 additions & 4 deletions lib/net/terminal/client/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ type flushWriter interface {
}

func startTerminal(conn FlushReadWriter) error {
closed := false
defer func() {
closed = true
}()
oldState, err := terminal.MakeRaw(int(os.Stdin.Fd()))
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion lib/objectcache/filename.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func filenameToHash(fileName string) (hash.Hash, error) {
var prev_nibble byte = 16
index := 0
for _, char := range fileName {
var nibble byte = 16
var nibble byte
if char >= '0' && char <= '9' {
nibble = byte(char) - '0'
} else if char >= 'a' && char <= 'f' {
Expand Down
1 change: 0 additions & 1 deletion lib/objectserver/filesystem/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func (objSrv *ObjectServer) addObject(reader io.Reader, length uint64,
if err != nil {
return hashVal, false, err
}
length = uint64(len(data))
filename := path.Join(objSrv.baseDir, objectcache.HashToFilename(hashVal))
// Check for existing object and collision.
if isNew, err := objSrv.addOrCompare(hashVal, data, filename); err != nil {
Expand Down
1 change: 0 additions & 1 deletion lib/objectserver/filesystem/stash.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ func (objSrv *ObjectServer) stashOrVerifyObject(reader io.Reader,
if err != nil {
return hashVal, nil, err
}
length = uint64(len(data))
hashName := objectcache.HashToFilename(hashVal)
filename := path.Join(objSrv.baseDir, hashName)
// Check for existing object and collision.
Expand Down
4 changes: 2 additions & 2 deletions lib/slavedriver/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type SlaveDriver struct {
logger log.DebugLogger
rollCallTrigger chan<- struct{}
slaveTrader SlaveTrader
mutex sync.Mutex // Lock everthing below (those can change).
mutex sync.Mutex // Lock everything below (those can change).
busySlaves map[*Slave]struct{}
idleSlaves map[*Slave]struct{}
zombies map[*Slave]struct{}
Expand All @@ -43,7 +43,7 @@ type Slave struct {
clientAddress string
driver *SlaveDriver
info SlaveInfo
mutex sync.Mutex // Lock everthing below (those can change).
mutex sync.Mutex // Lock everything below (those can change).
client *srpc.Client
}

Expand Down
2 changes: 1 addition & 1 deletion lib/slavedriver/smallstack/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
type SlaveTrader struct {
createRequest hyper_proto.CreateVmRequest
logger log.DebugLogger
mutex sync.Mutex // Lock everthing below (those can change).
mutex sync.Mutex // Lock everything below (those can change).
hypervisor *srpc.Client
}

Expand Down
2 changes: 1 addition & 1 deletion lib/srpc/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func (conn *Conn) RequestReply(request interface{}, reply interface{}) error {

// Username will return the username of the client who holds the certificate
// used to authenticate the connection to the server. If the connection was not
// authenticated the emtpy string is returned. If the connection is a client
// authenticated the empty string is returned. If the connection is a client
// connection, then Username will panic.
func (conn *Conn) Username() string {
return conn.getUsername()
Expand Down

0 comments on commit d6d70e5

Please sign in to comment.