Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
66b0ac4f
Commit
66b0ac4f
authored
Aug 29, 2018
by
Jesse Haka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement InstanceShutdownByProviderID
return error if instance does not exist do not export instanceshutoff
parent
11387279
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
openstack_instances.go
pkg/cloudprovider/providers/openstack/openstack_instances.go
+19
-1
No files found.
pkg/cloudprovider/providers/openstack/openstack_instances.go
View file @
66b0ac4f
...
...
@@ -36,6 +36,10 @@ type Instances struct {
opts
MetadataOpts
}
const
(
instanceShutoff
=
"SHUTOFF"
)
// Instances returns an implementation of Instances for OpenStack.
func
(
os
*
OpenStack
)
Instances
()
(
cloudprovider
.
Instances
,
bool
)
{
glog
.
V
(
4
)
.
Info
(
"openstack.Instances() called"
)
...
...
@@ -132,7 +136,21 @@ func (i *Instances) InstanceExistsByProviderID(ctx context.Context, providerID s
// InstanceShutdownByProviderID returns true if the instances is in safe state to detach volumes
func
(
i
*
Instances
)
InstanceShutdownByProviderID
(
ctx
context
.
Context
,
providerID
string
)
(
bool
,
error
)
{
return
false
,
cloudprovider
.
NotImplemented
instanceID
,
err
:=
instanceIDFromProviderID
(
providerID
)
if
err
!=
nil
{
return
false
,
err
}
server
,
err
:=
servers
.
Get
(
i
.
compute
,
instanceID
)
.
Extract
()
if
err
!=
nil
{
return
false
,
err
}
// SHUTOFF is the only state where we can detach volumes immediately
if
server
.
Status
==
instanceShutoff
{
return
true
,
nil
}
return
false
,
nil
}
// InstanceID returns the kubelet's cloud provider ID.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment