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:
parent
cc0b77b3a1
commit
26d75e28a5
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user