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

F #1684 handle disk TYPE=BLOCK for LxD containers

* add '-s' to the _file_ command to read special devices
* add '-s' to enable "sync mode" _kpartx_ when adding partition mappings

and handle the DISK case for disk['TYPE']
This commit is contained in:
Anton Todorov 2019-01-15 11:41:31 +02:00 committed by Ruben S. Montero
parent 5a4b90a5be
commit 284a6ed2e4
3 changed files with 3 additions and 3 deletions

View File

@ -411,7 +411,7 @@ class Container
# so new mappers does not need to modified source code
def new_disk_mapper(disk)
case disk['TYPE']
when 'FILE'
when 'FILE', 'BLOCK'
ds = @one.disk_source(disk)

View File

@ -63,7 +63,7 @@ class Mapper
:mkdir => 'mkdir -p',
:catfstab => 'sudo catfstab',
:cat => 'cat',
:file => 'file -L',
:file => 'file -L -s',
:blkid => 'sudo blkid',
:e2fsck => 'sudo e2fsck',
:resize2fs => 'sudo resize2fs',

View File

@ -60,7 +60,7 @@ class DiskRawMapper < Mapper
# Fisrt line is matched to look for loop device 3, and return "/dev/loop3"
def do_map(one_vm, disk, directory)
dsrc = one_vm.disk_source(disk)
cmd = "#{COMMANDS[:kpartx]} -av #{dsrc}"
cmd = "#{COMMANDS[:kpartx]} -s -av #{dsrc}"
rc, out, err = Command.execute(cmd, true)