1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

'Improve map wait for part_table condition' (#3148)

(cherry picked from commit 9fd7454ca1d428be8fa79aded1963f9517878b48)
This commit is contained in:
Daniel Clavijo Coca 2019-03-29 10:01:03 -06:00 committed by Ruben S. Montero
parent cc0b77b3a1
commit 26d75e28a5
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
3 changed files with 8 additions and 16 deletions

View File

@ -542,4 +542,10 @@ class Mapper
fstype
end
# Ensures the update of the partition table
def update_partable(dev)
cmd = "#{COMMANDS[:mount]} --fake #{dev} /mnt"
Command.execute(cmd, false)
end
end

View File

@ -42,9 +42,7 @@ class Qcow2Mapper < Mapper
return
end
# TODO: improve wait condition
sleep 1 # wait for parts to come out
update_partable(device)
show_parts(device) unless parts_on?(device)
device

View File

@ -41,11 +41,8 @@ class RBDMapper < Mapper
return
end
# TODO: improve wait condition
sleep 1 # wait for partition table
device = out.chomp
try_mount(device)
update_partable(device)
device
end
@ -60,13 +57,4 @@ class RBDMapper < Mapper
nil
end
private
# This function tries to mount mapped devices to force update of partition
# tables
def try_mount(dev)
cmd = "#{COMMANDS[:mount]} --fake #{dev} /mnt"
Command.execute(cmd, false)
end
end