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
9fe3cf9e
Commit
9fe3cf9e
authored
Feb 07, 2017
by
Balu Dontu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for detach volume when node is not present/ powered off
parent
d82e51ed
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
25 deletions
+12
-25
vsphere.go
pkg/cloudprovider/providers/vsphere/vsphere.go
+12
-25
No files found.
pkg/cloudprovider/providers/vsphere/vsphere.go
View file @
9fe3cf9e
...
@@ -924,11 +924,12 @@ func (vs *VSphere) DiskIsAttached(volPath string, nodeName k8stypes.NodeName) (b
...
@@ -924,11 +924,12 @@ func (vs *VSphere) DiskIsAttached(volPath string, nodeName k8stypes.NodeName) (b
}
}
if
!
nodeExist
{
if
!
nodeExist
{
glog
.
Warningf
(
glog
.
Errorf
(
"DiskIsAttached failed to determine whether disk %q is still attached: node %q does not exist"
,
"Node %q does not exist. DiskIsAttached will assume vmdk %q is not attached to it."
,
volPath
,
vSphereInstance
,
vSphereInstance
)
volPath
)
return
false
,
fmt
.
Errorf
(
"DiskIsAttached failed to determine whether disk %q is still attached: node %q does not exist"
,
return
false
,
nil
volPath
,
vSphereInstance
)
}
}
// Get VM device list
// Get VM device list
...
@@ -975,11 +976,12 @@ func (vs *VSphere) DisksAreAttached(volPaths []string, nodeName k8stypes.NodeNam
...
@@ -975,11 +976,12 @@ func (vs *VSphere) DisksAreAttached(volPaths []string, nodeName k8stypes.NodeNam
}
}
if
!
nodeExist
{
if
!
nodeExist
{
glog
.
Warningf
(
glog
.
Errorf
(
"DisksAreAttached failed to determine whether disks %v are still attached: node %q does not exist"
,
"Node %q does not exist. DisksAreAttached will assume vmdk %v are not attached to it."
,
volPaths
,
vSphereInstance
,
vSphereInstance
)
volPaths
)
return
attached
,
fmt
.
Errorf
(
"DisksAreAttached failed to determine whether disks %v are still attached: node %q does not exist"
,
return
attached
,
nil
volPaths
,
vSphereInstance
)
}
}
// Get VM device list
// Get VM device list
...
@@ -1145,21 +1147,6 @@ func (vs *VSphere) DetachDisk(volPath string, nodeName k8stypes.NodeName) error
...
@@ -1145,21 +1147,6 @@ func (vs *VSphere) DetachDisk(volPath string, nodeName k8stypes.NodeName) error
vSphereInstance
=
nodeNameToVMName
(
nodeName
)
vSphereInstance
=
nodeNameToVMName
(
nodeName
)
}
}
nodeExist
,
err
:=
vs
.
NodeExists
(
vs
.
client
,
nodeName
)
if
err
!=
nil
{
glog
.
Errorf
(
"Failed to check whether node exist. err: %s."
,
err
)
return
err
}
if
!
nodeExist
{
glog
.
Warningf
(
"Node %q does not exist. DetachDisk will assume vmdk %q is not attached to it."
,
nodeName
,
volPath
)
return
nil
}
vm
,
vmDevices
,
_
,
dc
,
err
:=
getVirtualMachineDevices
(
ctx
,
vs
.
cfg
,
vs
.
client
,
vSphereInstance
)
vm
,
vmDevices
,
_
,
dc
,
err
:=
getVirtualMachineDevices
(
ctx
,
vs
.
cfg
,
vs
.
client
,
vSphereInstance
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
...
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