14325: Don't shutdown busy VMs even if boot probe fails.
[arvados.git] / lib / cloud / interfaces.go
index c2b1acbabacb727d25be48b8a2b0c7b9d01916e5..969a4bc2ddeb4b6389bf80912f9826009a56400c 100644 (file)
@@ -5,11 +5,11 @@
 package cloud
 
 import (
-       "context"
        "io"
        "time"
 
        "git.curoverse.com/arvados.git/sdk/go/arvados"
+       "github.com/sirupsen/logrus"
        "golang.org/x/crypto/ssh"
 )
 
@@ -67,7 +67,7 @@ type ExecutorTarget interface {
        // VerifyHostKey can use it to make outgoing network
        // connections from the instance -- e.g., to use the cloud's
        // "this instance's metadata" API.
-       VerifyHostKey(context.Context, ssh.PublicKey, *ssh.Client) error
+       VerifyHostKey(ssh.PublicKey, *ssh.Client) error
 }
 
 // Instance is implemented by the provider-specific instance types.
@@ -89,10 +89,10 @@ type Instance interface {
        Tags() InstanceTags
 
        // Replace tags with the given tags
-       SetTags(context.Context, InstanceTags) error
+       SetTags(InstanceTags) error
 
        // Shut down the node
-       Destroy(context.Context) error
+       Destroy() error
 }
 
 // An InstanceSet manages a set of VM instances created by an elastic
@@ -106,7 +106,7 @@ type InstanceSet interface {
        //
        // The returned error should implement RateLimitError and
        // QuotaError where applicable.
-       Create(context.Context, arvados.InstanceType, ImageID, InstanceTags, ssh.PublicKey) (Instance, error)
+       Create(arvados.InstanceType, ImageID, InstanceTags, ssh.PublicKey) (Instance, error)
 
        // Return all instances, including ones that are booting or
        // shutting down. Optionally, filter out nodes that don't have
@@ -118,7 +118,7 @@ type InstanceSet interface {
        // Instance object each time. Thus, the caller is responsible
        // for de-duplicating the returned instances by comparing the
        // InstanceIDs returned by the instances' ID() methods.
-       Instances(context.Context, InstanceTags) ([]Instance, error)
+       Instances(InstanceTags) ([]Instance, error)
 
        // Stop any background tasks and release other resources.
        Stop()
@@ -164,17 +164,17 @@ type InstanceSet interface {
 //
 //     var _ = registerCloudDriver("example", &exampleDriver{})
 type Driver interface {
-       InstanceSet(config map[string]interface{}, id InstanceSetID) (InstanceSet, error)
+       InstanceSet(config map[string]interface{}, id InstanceSetID, logger logrus.FieldLogger) (InstanceSet, error)
 }
 
 // DriverFunc makes a Driver using the provided function as its
 // InstanceSet method. This is similar to http.HandlerFunc.
-func DriverFunc(fn func(config map[string]interface{}, id InstanceSetID) (InstanceSet, error)) Driver {
+func DriverFunc(fn func(config map[string]interface{}, id InstanceSetID, logger logrus.FieldLogger) (InstanceSet, error)) Driver {
        return driverFunc(fn)
 }
 
-type driverFunc func(config map[string]interface{}, id InstanceSetID) (InstanceSet, error)
+type driverFunc func(config map[string]interface{}, id InstanceSetID, logger logrus.FieldLogger) (InstanceSet, error)
 
-func (df driverFunc) InstanceSet(config map[string]interface{}, id InstanceSetID) (InstanceSet, error) {
-       return df(config, id)
+func (df driverFunc) InstanceSet(config map[string]interface{}, id InstanceSetID, logger logrus.FieldLogger) (InstanceSet, error) {
+       return df(config, id, logger)
 }