Added opts argument to mount_fs method
On centos bootstrap we don't able to mount images without '-o loop' option in mount command because of old version of util-linux-ng package. That's why opts argument in mount_fs method is needed in order to set options for mount command. Closes-Bug: #1620998 Change-Id: Iedfdf4aaeec35c99a0ddc96a2edfc59ac5bdb86e
This commit is contained in:
parent
0cc992ba32
commit
a963d03f9e
|
@ -266,7 +266,7 @@ class Manager(object):
|
|||
|
||||
mount_point = tempfile.mkdtemp(dir=CONF.tmp_path)
|
||||
try:
|
||||
fu.mount_fs('ext2', CONF.config_drive_path, mount_point)
|
||||
fu.mount_fs('ext2', CONF.config_drive_path, mount_point, 'loop')
|
||||
for file_path in src_files:
|
||||
name = os.path.basename(file_path)
|
||||
if os.path.isdir(file_path):
|
||||
|
|
|
@ -506,7 +506,7 @@ class TestManager(unittest2.TestCase):
|
|||
dev=CONF.config_drive_path)
|
||||
mock_fu.mount_fs.assert_called_with('ext2',
|
||||
CONF.config_drive_path,
|
||||
'/tmp/mount_point')
|
||||
'/tmp/mount_point', 'loop')
|
||||
mock_fu.umount_fs.assert_called_with('/tmp/mount_point')
|
||||
mock_rmdir.assert_called_with('/tmp/mount_point')
|
||||
mock_copy2.assert_called_with('/tmp/somefile', '/tmp/mount_point')
|
||||
|
|
|
@ -53,9 +53,12 @@ def extend_fs(fs_type, fs_dev):
|
|||
raise errors.FsUtilsError('Unsupported file system type')
|
||||
|
||||
|
||||
def mount_fs(fs_type, fs_dev, fs_mount):
|
||||
utils.execute('mount', '-t', fs_type, fs_dev, fs_mount,
|
||||
check_exit_code=[0])
|
||||
def mount_fs(fs_type, fs_dev, fs_mount, opts=None):
|
||||
fs_type = ('-t', fs_type) if fs_type is not None else ()
|
||||
opts = ('-o', opts) if opts is not None else ()
|
||||
fs_dev = (fs_dev,) if fs_dev is not None else ()
|
||||
cmd = ('mount',) + fs_type + opts + fs_dev + (fs_mount,)
|
||||
utils.execute(*cmd, check_exit_code=[0])
|
||||
|
||||
|
||||
def mount_bind(chroot, path, path2=None):
|
||||
|
|
Loading…
Reference in New Issue