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
fd20c8b0
Commit
fd20c8b0
authored
Mar 04, 2018
by
wenlxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ignore the loopbackdevice error, or the rbd volume will not get detached
parent
c6d0726d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
11 deletions
+24
-11
rbd.go
pkg/volume/rbd/rbd.go
+13
-7
operation_generator.go
pkg/volume/util/operationexecutor/operation_generator.go
+11
-4
No files found.
pkg/volume/rbd/rbd.go
View file @
fd20c8b0
...
@@ -940,14 +940,20 @@ func (rbd *rbdDiskUnmapper) TearDownDevice(mapPath, _ string) error {
...
@@ -940,14 +940,20 @@ func (rbd *rbdDiskUnmapper) TearDownDevice(mapPath, _ string) error {
blkUtil
:=
volumepathhandler
.
NewBlockVolumePathHandler
()
blkUtil
:=
volumepathhandler
.
NewBlockVolumePathHandler
()
loop
,
err
:=
volumepathhandler
.
BlockVolumePathHandler
.
GetLoopDevice
(
blkUtil
,
device
)
loop
,
err
:=
volumepathhandler
.
BlockVolumePathHandler
.
GetLoopDevice
(
blkUtil
,
device
)
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"rbd: failed to get loopback for device: %v, err: %v"
,
device
,
err
)
if
err
.
Error
()
!=
volumepathhandler
.
ErrDeviceNotFound
{
}
return
fmt
.
Errorf
(
"rbd: failed to get loopback for device: %v, err: %v"
,
device
,
err
)
// Remove loop device before detaching volume since volume detach operation gets busy if volume is opened by loopback.
}
err
=
volumepathhandler
.
BlockVolumePathHandler
.
RemoveLoopDevice
(
blkUtil
,
loop
)
glog
.
Warning
(
"rbd: loopback for device: % not found"
,
device
)
if
err
!=
nil
{
}
else
{
return
fmt
.
Errorf
(
"rbd: failed to remove loopback :%v, err: %v"
,
loop
,
err
)
if
len
(
loop
)
!=
0
{
// Remove loop device before detaching volume since volume detach operation gets busy if volume is opened by loopback.
err
=
volumepathhandler
.
BlockVolumePathHandler
.
RemoveLoopDevice
(
blkUtil
,
loop
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"rbd: failed to remove loopback :%v, err: %v"
,
loop
,
err
)
}
glog
.
V
(
4
)
.
Infof
(
"rbd: successfully removed loop device: %s"
,
loop
)
}
}
}
glog
.
V
(
4
)
.
Infof
(
"rbd: successfully removed loop device: %s"
,
loop
)
err
=
rbd
.
manager
.
DetachBlockDisk
(
*
rbd
,
mapPath
)
err
=
rbd
.
manager
.
DetachBlockDisk
(
*
rbd
,
mapPath
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/volume/util/operationexecutor/operation_generator.go
View file @
fd20c8b0
...
@@ -1058,11 +1058,18 @@ func (og *operationGenerator) GenerateUnmapDeviceFunc(
...
@@ -1058,11 +1058,18 @@ func (og *operationGenerator) GenerateUnmapDeviceFunc(
glog
.
V
(
4
)
.
Infof
(
"UnmapDevice: deviceToDetach.DevicePath: %v"
,
deviceToDetach
.
DevicePath
)
glog
.
V
(
4
)
.
Infof
(
"UnmapDevice: deviceToDetach.DevicePath: %v"
,
deviceToDetach
.
DevicePath
)
loopPath
,
err
:=
og
.
blkUtil
.
GetLoopDevice
(
deviceToDetach
.
DevicePath
)
loopPath
,
err
:=
og
.
blkUtil
.
GetLoopDevice
(
deviceToDetach
.
DevicePath
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Warningf
(
deviceToDetach
.
GenerateMsgDetailed
(
"UnmapDevice: Couldn't find loopback device which takes file descriptor lock"
,
fmt
.
Sprintf
(
"device path: %q"
,
deviceToDetach
.
DevicePath
)))
if
err
.
Error
()
==
volumepathhandler
.
ErrDeviceNotFound
{
glog
.
Warningf
(
deviceToDetach
.
GenerateMsgDetailed
(
"UnmapDevice: Couldn't find loopback device which takes file descriptor lock"
,
fmt
.
Sprintf
(
"device path: %q"
,
deviceToDetach
.
DevicePath
)))
}
else
{
errInfo
:=
"UnmapDevice.GetLoopDevice failed to get loopback device, "
+
fmt
.
Sprintf
(
"device path: %q"
,
deviceToDetach
.
DevicePath
)
return
deviceToDetach
.
GenerateError
(
errInfo
,
err
)
}
}
else
{
}
else
{
err
=
og
.
blkUtil
.
RemoveLoopDevice
(
loopPath
)
if
len
(
loopPath
)
!=
0
{
if
err
!=
nil
{
err
=
og
.
blkUtil
.
RemoveLoopDevice
(
loopPath
)
return
deviceToDetach
.
GenerateError
(
"UnmapDevice.AttachFileDevice failed"
,
err
)
if
err
!=
nil
{
return
deviceToDetach
.
GenerateError
(
"UnmapDevice.RemoveLoopDevice failed"
,
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