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

F #1684: Fix ext4 resize error handling (#2800)

This commit is contained in:
Daniel Clavijo Coca 2019-01-14 09:25:32 -06:00 committed by Ruben S. Montero
parent 4e94a5df0f
commit 75fa0d3f5d
2 changed files with 11 additions and 10 deletions

View File

@ -165,14 +165,14 @@ class Container
cmd = "#{LXC_COMMAND} exec #{@one.vm_name} -- #{command}"
rc, o, e = Command.execute(cmd, true)
# TODO this should be removed when Snap bug is fixed
# Snap patch
rc, o, e = Command.execute("sudo #{cmd}", true) if e.include?('cannot create user data directory:')
# TODO: this should be removed when Snap bug is fixed
err = 'cannot create user data directory:'
rc, o, e = Command.execute("sudo #{cmd}", true) if e.include?(err)
return [rc, o, e] unless rc != 0
OpenNebula.log_error("#{__method__}: Failed to run command #{cmd}: #{e}")
[rc, o, e]
end

View File

@ -163,12 +163,13 @@ class Mapper
Command.execute("#{COMMANDS[:xfs_growfs]} -d #{directory}", false)
when /ext/
rc, _o, e = Command.execute("#{COMMANDS[:e2fsck]} -f -y #{device}", false)
_rc, o, e = Command.execute("#{COMMANDS[:e2fsck]} -f -y #{device}", false)
if rc.zero?
Command.execute("#{COMMANDS[:resize2fs]} #{device}", false)
if o.empty?
err = "#{__method__}: failed to resize #{device}\n#{e}"
OpenNebula.log_error err
else
OpenNebula.log_error "#{__method__}: failed to resize #{device}\n#{e}"
Command.execute("#{COMMANDS[:resize2fs]} #{device}", false)
end
rc = mount_dev(device, directory)