@@ -17,6 +17,7 @@ limitations under the License.
1717package openstack
1818
1919import (
20+ "context"
2021 "fmt"
2122 "regexp"
2223
@@ -54,7 +55,7 @@ func (os *OpenStack) Instances() (cloudprovider.Instances, bool) {
5455
5556// CurrentNodeName implements Instances.CurrentNodeName
5657// Note this is *not* necessarily the same as hostname.
57- func (i * Instances ) CurrentNodeName (hostname string ) (types.NodeName , error ) {
58+ func (i * Instances ) CurrentNodeName (ctx context. Context , hostname string ) (types.NodeName , error ) {
5859 md , err := getMetadata (i .opts .SearchOrder )
5960 if err != nil {
6061 return "" , err
@@ -63,12 +64,12 @@ func (i *Instances) CurrentNodeName(hostname string) (types.NodeName, error) {
6364}
6465
6566// AddSSHKeyToAllInstances is not implemented for OpenStack
66- func (i * Instances ) AddSSHKeyToAllInstances (user string , keyData []byte ) error {
67+ func (i * Instances ) AddSSHKeyToAllInstances (ctx context. Context , user string , keyData []byte ) error {
6768 return cloudprovider .NotImplemented
6869}
6970
7071// NodeAddresses implements Instances.NodeAddresses
71- func (i * Instances ) NodeAddresses (name types.NodeName ) ([]v1.NodeAddress , error ) {
72+ func (i * Instances ) NodeAddresses (ctx context. Context , name types.NodeName ) ([]v1.NodeAddress , error ) {
7273 glog .V (4 ).Infof ("NodeAddresses(%v) called" , name )
7374
7475 addrs , err := getAddressesByName (i .compute , name )
@@ -83,7 +84,7 @@ func (i *Instances) NodeAddresses(name types.NodeName) ([]v1.NodeAddress, error)
8384// NodeAddressesByProviderID returns the node addresses of an instances with the specified unique providerID
8485// This method will not be called from the node that is requesting this ID. i.e. metadata service
8586// and other local methods cannot be used here
86- func (i * Instances ) NodeAddressesByProviderID (providerID string ) ([]v1.NodeAddress , error ) {
87+ func (i * Instances ) NodeAddressesByProviderID (ctx context. Context , providerID string ) ([]v1.NodeAddress , error ) {
8788 instanceID , err := instanceIDFromProviderID (providerID )
8889
8990 if err != nil {
@@ -105,7 +106,7 @@ func (i *Instances) NodeAddressesByProviderID(providerID string) ([]v1.NodeAddre
105106}
106107
107108// ExternalID returns the cloud provider ID of the specified instance (deprecated).
108- func (i * Instances ) ExternalID (name types.NodeName ) (string , error ) {
109+ func (i * Instances ) ExternalID (ctx context. Context , name types.NodeName ) (string , error ) {
109110 srv , err := getServerByName (i .compute , name , true )
110111 if err != nil {
111112 if err == ErrNotFound {
@@ -118,7 +119,7 @@ func (i *Instances) ExternalID(name types.NodeName) (string, error) {
118119
119120// InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running.
120121// If false is returned with no error, the instance will be immediately deleted by the cloud controller manager.
121- func (i * Instances ) InstanceExistsByProviderID (providerID string ) (bool , error ) {
122+ func (i * Instances ) InstanceExistsByProviderID (ctx context. Context , providerID string ) (bool , error ) {
122123 instanceID , err := instanceIDFromProviderID (providerID )
123124 if err != nil {
124125 return false , err
@@ -153,7 +154,7 @@ func (os *OpenStack) InstanceID() (string, error) {
153154}
154155
155156// InstanceID returns the cloud provider ID of the specified instance.
156- func (i * Instances ) InstanceID (name types.NodeName ) (string , error ) {
157+ func (i * Instances ) InstanceID (ctx context. Context , name types.NodeName ) (string , error ) {
157158 srv , err := getServerByName (i .compute , name , true )
158159 if err != nil {
159160 if err == ErrNotFound {
@@ -169,7 +170,7 @@ func (i *Instances) InstanceID(name types.NodeName) (string, error) {
169170// InstanceTypeByProviderID returns the cloudprovider instance type of the node with the specified unique providerID
170171// This method will not be called from the node that is requesting this ID. i.e. metadata service
171172// and other local methods cannot be used here
172- func (i * Instances ) InstanceTypeByProviderID (providerID string ) (string , error ) {
173+ func (i * Instances ) InstanceTypeByProviderID (ctx context. Context , providerID string ) (string , error ) {
173174 instanceID , err := instanceIDFromProviderID (providerID )
174175
175176 if err != nil {
@@ -186,7 +187,7 @@ func (i *Instances) InstanceTypeByProviderID(providerID string) (string, error)
186187}
187188
188189// InstanceType returns the type of the specified instance.
189- func (i * Instances ) InstanceType (name types.NodeName ) (string , error ) {
190+ func (i * Instances ) InstanceType (ctx context. Context , name types.NodeName ) (string , error ) {
190191 srv , err := getServerByName (i .compute , name , true )
191192
192193 if err != nil {
0 commit comments