Revision 09bf5d24

b/tools/burnin
38 38
from ganeti import utils
39 39
from ganeti import hypervisor
40 40
from ganeti import compat
41
from ganeti import pathutils
41 42

  
42 43
from ganeti.confd import client as confd_client
43 44

  
......
747 748
                                      shutdown=True)
748 749
      rem_op = opcodes.OpInstanceRemove(instance_name=instance,
749 750
                                        ignore_failures=True)
750
      imp_dir = utils.PathJoin(constants.EXPORT_DIR, full_name)
751
      imp_dir = utils.PathJoin(pathutils.EXPORT_DIR, full_name)
751 752
      imp_op = opcodes.OpInstanceCreate(instance_name=instance,
752 753
                                        disks=[{"size": size}
753 754
                                               for size in self.disk_size],
......
1120 1121
  """Main function.
1121 1122

  
1122 1123
  """
1123
  utils.SetupLogging(constants.LOG_BURNIN, sys.argv[0],
1124
  utils.SetupLogging(pathutils.LOG_BURNIN, sys.argv[0],
1124 1125
                     debug=False, stderr_logging=True)
1125 1126

  
1126 1127
  return Burner().BurninCluster()
b/tools/cfgupgrade
40 40
from ganeti import bootstrap
41 41
from ganeti import config
42 42
from ganeti import netutils
43
from ganeti import pathutils
43 44

  
44 45

  
45 46
options = None
......
114 115
                    action="store_true", default=False,
115 116
                    help="Don't abort if hostname doesn't match")
116 117
  parser.add_option("--path", help="Convert configuration in this"
117
                    " directory instead of '%s'" % constants.DATA_DIR,
118
                    default=constants.DATA_DIR, dest="data_dir")
118
                    " directory instead of '%s'" % pathutils.DATA_DIR,
119
                    default=pathutils.DATA_DIR, dest="data_dir")
119 120
  parser.add_option("--no-verify",
120 121
                    help="Do not verify configuration after upgrade",
121 122
                    action="store_true", dest="no_verify", default=False)
b/tools/cfgupgrade12
47 47
from ganeti import serializer
48 48
from ganeti import utils
49 49
from ganeti import cli
50
from ganeti import pathutils
50 51

  
51 52

  
52 53
options = None
......
195 196

  
196 197
  # file storage
197 198
  if "file_storage_dir" not in cluster:
198
    cluster["file_storage_dir"] = constants.DEFAULT_FILE_STORAGE_DIR
199
    cluster["file_storage_dir"] = pathutils.DEFAULT_FILE_STORAGE_DIR
199 200

  
200 201
  # candidate pool size
201 202
  if "candidate_pool_size" not in cluster:
......
296 297
  parser.add_option(cli.DEBUG_OPT)
297 298
  parser.add_option(cli.VERBOSE_OPT)
298 299
  parser.add_option("--path", help="Convert configuration in this"
299
                    " directory instead of '%s'" % constants.DATA_DIR,
300
                    default=constants.DATA_DIR, dest="data_dir")
300
                    " directory instead of '%s'" % pathutils.DATA_DIR,
301
                    default=pathutils.DATA_DIR, dest="data_dir")
301 302
  (options, args) = parser.parse_args()
302 303

  
303 304
  # We need to keep filenames locally because they might be renamed between
b/tools/cluster-merge
40 40
from ganeti import errors
41 41
from ganeti import ssh
42 42
from ganeti import utils
43
from ganeti import pathutils
43 44

  
44 45

  
45 46
_GROUPS_MERGE = "merge"
......
209 210
                                 (cluster, result.fail_reason, result.output))
210 211
      instances = result.stdout.splitlines()
211 212

  
212
      path = utils.PathJoin(constants.DATA_DIR, "ssconf_%s" %
213
      path = utils.PathJoin(pathutils.DATA_DIR, "ssconf_%s" %
213 214
                            constants.SS_MASTER_NODE)
214 215
      result = self._RunCmd(cluster, "cat %s" % path, private_key=key_path)
215 216
      if result.failed:
......
321 322
    """Stop all daemons on merging nodes.
322 323

  
323 324
    """
324
    cmd = "%s stop-all" % constants.DAEMON_UTIL
325
    cmd = "%s stop-all" % pathutils.DAEMON_UTIL
325 326
    for data in self.merger_data:
326 327
      for node in data.nodes:
327 328
        result = self._RunCmd(node, cmd, max_attempts=3)
......
339 340
    """
340 341
    for data in self.merger_data:
341 342
      result = self._RunCmd(data.cluster, "cat %s" %
342
                                          constants.CLUSTER_CONF_FILE)
343
                                          pathutils.CLUSTER_CONF_FILE)
343 344

  
344 345
      if result.failed:
345 346
        raise errors.RemoteError("Unable to retrieve remote config on %s."
......
358 359
    @raise errors.CommandError: If unable to kill
359 360

  
360 361
    """
361
    result = utils.RunCmd([constants.DAEMON_UTIL, "stop-master"])
362
    result = utils.RunCmd([pathutils.DAEMON_UTIL, "stop-master"])
362 363
    if result.failed:
363 364
      raise errors.CommandError("Unable to stop master daemons."
364 365
                                " Fail reason: %s; output: %s" %
......
634 635
    if no_vote:
635 636
      env["EXTRA_MASTERD_ARGS"] = "--no-voting --yes-do-it"
636 637

  
637
    result = utils.RunCmd([constants.DAEMON_UTIL, "start-master"], env=env)
638
    result = utils.RunCmd([pathutils.DAEMON_UTIL, "start-master"], env=env)
638 639
    if result.failed:
639 640
      raise errors.CommandError("Couldn't start ganeti master."
640 641
                                " Fail reason: %s; output: %s" %
......
730 731

  
731 732
      rbsteps.append("Restore %s from another master candidate"
732 733
                     " and restart master daemon" %
733
                     constants.CLUSTER_CONF_FILE)
734
                     pathutils.CLUSTER_CONF_FILE)
734 735
      self._MergeConfig()
735 736
      self._StartMasterDaemon(no_vote=True)
736 737

  
b/tools/confd-client
33 33
from ganeti import constants
34 34
from ganeti import cli
35 35
from ganeti import utils
36
from ganeti import pathutils
36 37

  
37 38
from ganeti.confd import client as confd_client
38 39

  
......
125 126
      Usage()
126 127

  
127 128
    if options.hmac is None:
128
      options.hmac = utils.ReadFile(constants.CONFD_HMAC_KEY)
129
      options.hmac = utils.ReadFile(pathutils.CONFD_HMAC_KEY)
129 130
    self.hmac_key = options.hmac
130 131

  
131 132
    self.mc_list = [options.mc]
b/tools/sanitize-config
33 33
from ganeti import constants
34 34
from ganeti import serializer
35 35
from ganeti import utils
36
from ganeti import pathutils
36 37
from ganeti import cli
37 38
from ganeti.cli import cli_option
38 39

  
......
40 41
OPTS = [
41 42
  cli.VERBOSE_OPT,
42 43
  cli_option("--path", help="Convert this configuration file"
43
             " instead of '%s'" % constants.CLUSTER_CONF_FILE,
44
             default=constants.CLUSTER_CONF_FILE, dest="CONFIG_DATA_PATH"),
44
             " instead of '%s'" % pathutils.CLUSTER_CONF_FILE,
45
             default=pathutils.CLUSTER_CONF_FILE, dest="CONFIG_DATA_PATH"),
45 46
  cli_option("--sanitize-names", default="yes", type="bool",
46 47
             help="Randomize the cluster, node and instance names [yes]"),
47 48
  cli_option("--sanitize-ips", default="yes", type="bool",
b/tools/setup-ssh
47 47
from ganeti import ssconf
48 48
from ganeti import ssh
49 49
from ganeti import utils
50
from ganeti import pathutils
50 51

  
51 52

  
52 53
class RemoteCommandError(errors.GenericError):
......
89 90
  ss_cluster_name_path = ss.KeyToFilename(constants.SS_CLUSTER_NAME)
90 91

  
91 92
  cluster_files = [
92
    (constants.NODED_CERT_FILE, utils.ReadFile(constants.NODED_CERT_FILE)),
93
    (pathutils.NODED_CERT_FILE, utils.ReadFile(pathutils.NODED_CERT_FILE)),
93 94
    (ss_cluster_name_path, utils.ReadFile(ss_cluster_name_path)),
94 95
    ]
95 96

  
......
141 142
  @param command: The daemon-util command to be run
142 143

  
143 144
  """
144
  _RunRemoteCommand(transport, "%s %s" % (constants.DAEMON_UTIL, command))
145
  _RunRemoteCommand(transport, "%s %s" % (pathutils.DAEMON_UTIL, command))
145 146

  
146 147

  
147 148
def _ReadSftpFile(sftp, filename):
......
184 185
  """
185 186
  priv_key, pub_key, auth_keys = ssh.GetUserFiles(constants.GANETI_RUNAS)
186 187
  keyfiles = [
187
    (constants.SSH_HOST_DSA_PRIV, 0600),
188
    (constants.SSH_HOST_DSA_PUB, 0644),
189
    (constants.SSH_HOST_RSA_PRIV, 0600),
190
    (constants.SSH_HOST_RSA_PUB, 0644),
188
    (pathutils.SSH_HOST_DSA_PRIV, 0600),
189
    (pathutils.SSH_HOST_DSA_PUB, 0644),
190
    (pathutils.SSH_HOST_RSA_PRIV, 0600),
191
    (pathutils.SSH_HOST_RSA_PUB, 0644),
191 192
    (priv_key, 0600),
192 193
    (pub_key, 0644),
193 194
    ]
......
273 274

  
274 275
  formatter = logging.Formatter(fmt)
275 276

  
276
  file_handler = logging.FileHandler(constants.LOG_SETUP_SSH)
277
  file_handler = logging.FileHandler(pathutils.LOG_SETUP_SSH)
277 278
  stderr_handler = logging.StreamHandler()
278 279
  stderr_handler.setFormatter(formatter)
279 280
  file_handler.setFormatter(formatter)

Also available in: Unified diff