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

B #3103 #3127: Fix ext4 handling code and set correct permissions for raw images

(cherry picked from commit becaf48344932bbd652f246d6f915709da5c7ddf)
This commit is contained in:
Daniel Clavijo Coca 2019-03-25 15:12:53 -06:00 committed by Ruben S. Montero
parent 762a0fa9e1
commit 308d304851
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
3 changed files with 9 additions and 3 deletions

View File

@ -94,7 +94,7 @@ class LXDClient
def wait(response, timeout)
operation_id = response['operation'].split('/').last
timeout = "?timeout=#{timeout}" if [nil, ''].include?(timeout)
timeout = "?timeout=#{timeout}" unless [nil, ''].include?(timeout)
response = get("operations/#{operation_id}/wait#{timeout}")

View File

@ -481,7 +481,6 @@ class Mapper
if o.empty?
OpenNebula.log_error("#{err}#{e}")
return false
else
cmd = "#{COMMANDS[:resize2fs]} #{device}"
rc, _o, e = Command.execute(cmd, false)
@ -511,7 +510,11 @@ class Mapper
when /xfs/
cmd = "#{COMMANDS[:xfs_admin]} -U generate #{device}"
when /ext/
Command.execute("#{COMMANDS[:e2fsck]} -f -y #{device}", false)
cmd = "#{COMMANDS[:e2fsck]} -f -y #{device}"
_rc, o, e = Command.execute(cmd, false)
OpenNebula.log e if o.empty?
cmd = "#{COMMANDS[:tune2fs]} -U random #{device}"
else
return true

View File

@ -27,6 +27,9 @@ class FSRawMapper < Mapper
def do_map(one_vm, disk, _directory)
dsrc = one_vm.disk_source(disk)
File.chmod(0o646, dsrc) if File.symlink?(one_vm.sysds_path)
cmd = "#{COMMANDS[:losetup]} -f --show #{dsrc}"
rc, out, err = Command.execute(cmd, true)