Revision ac156ecd

b/lib/cmdlib/instance.py
849 849
      # build the full file storage dir path
850 850
      joinargs = []
851 851

  
852
      if self.op.disk_template in (constants.DT_SHARED_FILE,
853
                                   constants.DT_GLUSTER):
854
        get_fsd_fn = self.cfg.GetSharedFileStorageDir
855
      else:
856
        get_fsd_fn = self.cfg.GetFileStorageDir
852
      cfg_storage = None
853
      if self.op.disk_template == constants.DT_FILE:
854
        cfg_storage = self.cfg.GetFileStorageDir()
855
      elif self.op.disk_template == constants.DT_SHARED_FILE:
856
        cfg_storage = self.cfg.GetSharedFileStorageDir()
857
      elif self.op.disk_template == constants.DT_GLUSTER:
858
        cfg_storage = self.cfg.GetGlusterStorageDir()
859

  
860
      if not cfg_storage:
861
        raise errors.OpPrereqError(
862
          "Cluster file storage dir for {tpl} storage type not defined".format(
863
            tpl=repr(self.op.disk_template)
864
          ),
865
          errors.ECODE_STATE
866
      )
857 867

  
858
      cfg_storagedir = get_fsd_fn()
859
      if not cfg_storagedir:
860
        raise errors.OpPrereqError("Cluster file storage dir not defined",
861
                                   errors.ECODE_STATE)
862
      joinargs.append(cfg_storagedir)
868
      joinargs.append(cfg_storage)
863 869

  
864 870
      if self.op.file_storage_dir is not None:
865 871
        joinargs.append(self.op.file_storage_dir)
866 872

  
867
      joinargs.append(self.op.instance_name)
873
      if self.op.disk_template != constants.DT_GLUSTER:
874
        joinargs.append(self.op.instance_name)
868 875

  
869
      # pylint: disable=W0142
870
      self.instance_file_storage_dir = utils.PathJoin(*joinargs)
876
      if len(joinargs) > 1:
877
        # pylint: disable=W0142
878
        self.instance_file_storage_dir = utils.PathJoin(*joinargs)
879
      else:
880
        self.instance_file_storage_dir = joinargs[0]
871 881

  
872 882
  def CheckPrereq(self): # pylint: disable=R0914
873 883
    """Check prerequisites.
b/lib/storage/gluster.py
53 53

  
54 54
  """
55 55

  
56
  def __init__(self, server_addr, port, volume, _run_cmd=utils.RunCmd):
56
  def __init__(self, server_addr, port, volume, _run_cmd=utils.RunCmd,
57
               _mount_point=None):
57 58
    """Creates a Gluster volume object.
58 59

  
59 60
    @type server_addr: str
......
72 73
    port = netutils.ValidatePortNumber(port)
73 74
    self._port = port
74 75
    self._volume = volume
75
    self.mount_point = io.PathJoin(constants.GLUSTER_MOUNTPOINT,
76
                                   self._volume)
76
    if _mount_point: # tests
77
      self.mount_point = _mount_point
78
    else:
79
      self.mount_point = ssconf.SimpleStore().GetGlusterStorageDir()
77 80

  
78 81
    self._run_cmd = _run_cmd
79 82

  
b/lib/utils/storage.py
92 92
  elif disk_template == constants.DT_SHARED_FILE:
93 93
    return (storage_type, cluster.shared_file_storage_dir)
94 94
  elif disk_template == constants.DT_GLUSTER:
95
    return (storage_type, constants.GLUSTER_MOUNTPOINT)
95
    return (storage_type, cluster.gluster_storage_dir)
96 96
  else:
97 97
    return (storage_type, None)
98 98

  
b/src/Ganeti/Storage/Utils.hs
31 31
import Ganeti.Config
32 32
import Ganeti.Objects
33 33
import Ganeti.Types
34
import Ganeti.Constants
35 34
import qualified Ganeti.Types as T
36 35

  
37 36
import Control.Monad
b/test/py/cmdlib/instance_unittest.py
446 446
    self.cluster.file_storage_dir = None
447 447
    op = self.CopyOpCode(self.file_op)
448 448
    self.ExecOpCodeExpectOpPrereqError(
449
      op, "Cluster file storage dir not defined")
449
      op, "Cluster file storage dir for 'file' storage type not defined")
450 450

  
451 451
  def testFileInstanceAdditionalPath(self):
452 452
    op = self.CopyOpCode(self.file_op,

Also available in: Unified diff