On Fri, Jul 26, 2013 at 5:00 PM, Michele Tartara <[email protected]> wrote:
> On Fri, Jul 26, 2013 at 10:51 AM, Weiwei Jia <[email protected]> wrote:
>>
>> Add RPC calls to mount Gluster storage dir.
>>
>> Signed-off-by: Weiwei Jia <[email protected]>
>> ---
>>  lib/backend.py      |   32 ++++++++++++++++++++++++++++++++
>>  lib/rpc_defs.py     |    5 +++++
>>  lib/server/noded.py |   12 ++++++++++++
>>  3 files changed, 49 insertions(+)
>>
>> diff --git a/lib/backend.py b/lib/backend.py
>> index 7063aa5..1985478 100644
>> --- a/lib/backend.py
>> +++ b/lib/backend.py
>> @@ -3230,6 +3230,38 @@ def CreateFileStorageDir(file_storage_dir):
>>              file_storage_dir, err, exc=True)
>>
>>
>> +def MountGlusterStorageDir(gluster_hostname,
>> +                           gluster_volname,
>> +                           gluster_storage_dir):
>> +  """Mount gluster storage directory.
>> +
>> +  @type gluster_hostname: str
>> +  @param gluster_hostname: hostname of gluster server
>> +  @type gluster_volname: str
>> +  @param gluster_volname: volume name of gluster server
>> +  @type gluster_storage_dir: str
>
>
> These still have to be changed from "str" to "string"
>
>> +  @param gluster_storage_dir: directory to mount
>> +
>> +  @rtype: tuple
>> +  @return: tuple with first element a boolean indicating whether dir
>> +      mount was successful or not
>> +
>> +  """
>> +  gluster_storage_dir = _TransformFileStorageDir(gluster_storage_dir)
>> +  if os.path.exists(gluster_storage_dir):
>> +    if not os.path.isdir(gluster_storage_dir):
>> +      _Fail("Specified gluster storage dir '%s' is not a directory",
>> +            gluster_storage_dir)
>> +
>> +    result = utils.RunCmd(["mount", "-t", "glusterfs",
>> +                   "%s:/%s" % (gluster_hostname, gluster_volname),
>> +                   gluster_storage_dir])
>> +
>>
>> +    if result.failed:
>> +      raise errors.OpPrereqError("Could not mount glusterfs, error %s" %
>> +                   result.output)
>
>
> And this is still wrong: if the path does not exists, it is just going to
> fail silently, instead of providing any meaningful message or creating the
> missing directory.
>

Yeah, I would update it right now.




--
Thanks
Weiwei  Jia (Harry Wei)

Reply via email to