On Fri, Jul 26, 2013 at 10:51 AM, Weiwei Jia <[email protected]> wrote:

> Add mount Gluster operation in CreateDisks.
>
> Signed-off-by: Weiwei Jia <[email protected]>
> ---
>  lib/cmdlib/instance_storage.py |   15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/lib/cmdlib/instance_storage.py
> b/lib/cmdlib/instance_storage.py
> index 793cfa6..ff2e585 100644
> --- a/lib/cmdlib/instance_storage.py
> +++ b/lib/cmdlib/instance_storage.py
> @@ -254,6 +254,21 @@ def CreateDisks(lu, instance, to_skip=None,
> target_node_uuid=None, disks=None):
>                   " node %s" % (file_storage_dir,
>                                 lu.cfg.GetNodeName(pnode_uuid)))
>
> +    gluster_storage_dir = file_storage_dir
>

Why is this taking the file_storage_dir as the gluster_storage dir? Wasn't
it supposed to take the value passed at cluster init time through the
"--gluster-file-storage-dir"?

+    diskparams = lu.cfg.GetClusterInfo().diskparams
> +    for template, dt_params in diskparams.items():

+      if template == constants.DT_GLUSTER_FILE:
>

Is it really needed to loop acroos all the items in diskparams to get the
only one you are interested into?

Wouldn't something like this

if constants.DT_GLUSTER_FILE in diskparams:
  dt_params = diskparams[constants.DT_GLUSTER_FILE]
  ...

be better?


+        gluster_volname = dt_params[constants.LDP_VOLNAME]
> +        gluster_hostname = dt_params[constants.LDP_HOSTNAME]
> +    result = lu.rpc.call_mount_gluster_storage_dir(pnode_uuid,
> +                                                gluster_hostname,
> +                                                gluster_volname,
> +                                              gluster_storage_dir)
> +
> +    result.Raise("Failed to mount directory '%s' on"
> +                 " node %s" % (gluster_storage_dir,
> +                               lu.cfg.GetNodeName(pnode_uuid)))
> +
>

The entire block of code you added is executed unconditionally.
This means that it would fail if the instance is not actually using gluster
disks.

It should be executed conditionally, only if gluster is actually being used.


>    disks_created = []
>    for idx, device in enumerate(disks):
>      if to_skip and idx in to_skip:
> --
> 1.7.10.4
>
>
Thanks,
Michele

-- 
Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to