1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-03 01:17:41 +03:00

F #5228: fix find device method (#929)

This commit is contained in:
Christian González 2021-03-09 18:09:48 +01:00 committed by GitHub
parent fe8bf9a0a0
commit 66163f81f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -323,20 +323,15 @@ class Disk
sys_parts = Storage.lsblk('')
device = ''
real_path = @mountpoint
is_shared_ds = File.symlink?(@sysds_path)
real_path = File.realpath(real_path) if !@is_rootfs && is_shared_ds
sys_parts.each do |d|
if d['mountpoint'] == real_path
if d['mountpoint'] == @mountpoint
device = d['path']
break
end
if d['children']
d['children'].each do |c|
next unless c['mountpoint'] == real_path
next unless c['mountpoint'] == @mountpoint
device = d['path']
break
@ -347,7 +342,7 @@ class Disk
end
if device.empty?
OpenNebula.log_error("Cannot detect block device from #{real_path}")
OpenNebula.log_error("Cannot detect block device from #{@mountpoint}")
end
device