Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix comparison. #742

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 3 additions & 8 deletions dcmgr/lib/dcmgr/helpers/block_device_helper.rb
Expand Up @@ -49,14 +49,9 @@ def check_fs(device)

# Find first matching loop device path from the result of "losetup -a"
def find_loopdev(path)
stat = File.stat(path)
`losetup -a`.split(/\n/).each {|i|
# /dev/loop0: [0f11]:1179651 (/home/katsuo/dev/wakame-vdc/tmp/instances/i-5....)
if i =~ %r{^(/dev/loop\d+): \[([0-9a-f]+)\]:(\d+) } && $2.hex == stat.dev && $3.to_i == stat.ino
return $1
end
}
nil
loopdev = `losetup -j #{path} | cut -d: -f 1 | head -n 1`
return nil if loopdev.empty?
loopdev
end

# "kpartx -d" gets failed occasionally. so we use "dmsetup" and
Expand Down