7e10f34cad
This change will allow data sources with urls of the form "manila://share-id/path", similar to manila urls for job binaries. The Sahara native url will be logged in the JobExecution, but the true runtime url (file:///mnt/path) for manila shares will be used in the cluster. Partial-implements: blueprint manila-as-a-data-source Change-Id: I0b43491decbe6cb0ec0b84314cf9b407b9e3fb4a
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
# Copyright (c) 2015 Red Hat Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
# implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
from sahara.service.edp import job_utils
|
|
from sahara.service import shares as shares_service
|
|
|
|
|
|
def get_file_info(job_binary, remote):
|
|
shares = []
|
|
if remote.instance.node_group.cluster.shares:
|
|
shares.extend(remote.instance.node_group.cluster.shares)
|
|
if remote.instance.node_group.shares:
|
|
shares.extend(remote.instance.node_group.shares)
|
|
path = shares_service.get_share_path(job_binary.url, shares)
|
|
if path is None:
|
|
path = job_utils.mount_share_at_default_path(
|
|
job_binary.url,
|
|
remote.instance.node_group.cluster)
|
|
return {'type': 'path',
|
|
'path': path}
|