On Sat, Jul 27, 2013 at 7:28 PM, Weiwei Jia <[email protected]> wrote:

> Signed-off-by: Weiwei Jia <[email protected]>
> ---
>  lib/cmdlib/instance_storage.py |   16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/lib/cmdlib/instance_storage.py
> b/lib/cmdlib/instance_storage.py
> index 793cfa6..33b344d 100644
> --- a/lib/cmdlib/instance_storage.py
> +++ b/lib/cmdlib/instance_storage.py
> @@ -247,6 +247,22 @@ def CreateDisks(lu, instance, to_skip=None,
> target_node_uuid=None, disks=None):
>    CheckDiskTemplateEnabled(lu.cfg.GetClusterInfo(),
> instance.disk_template)
>
>    if instance.disk_template in constants.DTS_FILEBASED:
> +    if instance.disk_template == constants.DT_GLUSTER_FILE:
> +      gluster_storage_dir =
> lu.cfg.GetClusterInfo().gluster_file_storage_dir
> +      if not os.path.ismount(gluster_storage_dir):
>

Actually, this isn't really going to work.

This only checks that the directory is a mount point. But what you need to
know, is whether it is the mount point for the exact Gluster volume you are
interested into.
So, while the check you used is required, it is not enough.


> +        diskparams = lu.cfg.GetClusterInfo().diskparams
> +        glusterparams = diskparams[constants.DT_GLUSTER_FILE]
> +        gluster_volname = glusterparams[constants.LDP_VOLNAME]
> +        gluster_hostname = glusterparams[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)))
> +
>      file_storage_dir = os.path.dirname(instance.disks[0].logical_id[1])
>      result = lu.rpc.call_file_storage_dir_create(pnode_uuid,
> file_storage_dir)
>
> --
> 1.7.10.4
>
>
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