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):
+ 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