예제 #1
0
    def connect_volume(self, connection_info, disk_info):
        """Connect the volume."""
        smbfs_share = connection_info['data']['export']
        mount_path = self._get_mount_path(smbfs_share)

        if not libvirt_utils.is_mounted(mount_path, smbfs_share):
            mount_options = self._parse_mount_options(connection_info)
            remotefs.mount_share(mount_path, smbfs_share,
                                 export_type='cifs', options=mount_options)

        device_path = self._get_device_path(connection_info)
        connection_info['data']['device_path'] = device_path
예제 #2
0
    def _test_mount_share(self, mock_mount, mock_ensure_tree,
                          already_mounted=False):
        if already_mounted:
            err_msg = 'Device or resource busy'
            mock_mount.side_effect = [
                None, processutils.ProcessExecutionError(err_msg)]

        remotefs.mount_share(
            mock.sentinel.mount_path, mock.sentinel.export_path,
            mock.sentinel.export_type,
            options=[mock.sentinel.mount_options])

        mock_ensure_tree.assert_any_call(mock.sentinel.mount_path)
        mock_mount.assert_has_calls(
            [mock.call(mock.sentinel.export_type,
                       mock.sentinel.export_path,
                       mock.sentinel.mount_path,
                       [mock.sentinel.mount_options])])
예제 #3
0
    def _test_mount_share(self, mock_execute, already_mounted=False):
        if already_mounted:
            err_msg = 'Device or resource busy'
            mock_execute.side_effect = [
                None, processutils.ProcessExecutionError(err_msg)]

        remotefs.mount_share(
            mock.sentinel.mount_path, mock.sentinel.export_path,
            mock.sentinel.export_type,
            options=[mock.sentinel.mount_options])

        mock_execute.assert_any_call('mkdir', '-p',
                                     mock.sentinel.mount_path)
        mock_execute.assert_any_call('mount', '-t', mock.sentinel.export_type,
                                     mock.sentinel.mount_options,
                                     mock.sentinel.export_path,
                                     mock.sentinel.mount_path,
                                     run_as_root=True)
예제 #4
0
    def _test_mount_share(self, mock_ensure_tree, mock_execute,
                          already_mounted=False):
        if already_mounted:
            err_msg = 'Device or resource busy'
            mock_execute.side_effect = [
                None, processutils.ProcessExecutionError(err_msg)]

        remotefs.mount_share(
            mock.sentinel.mount_path, mock.sentinel.export_path,
            mock.sentinel.export_type,
            options=[mock.sentinel.mount_options])

        mock_ensure_tree.assert_any_call(mock.sentinel.mount_path)
        mock_execute.assert_any_call('mount', '-t', mock.sentinel.export_type,
                                     mock.sentinel.mount_options,
                                     mock.sentinel.export_path,
                                     mock.sentinel.mount_path,
                                     run_as_root=True)