Allow customisation of the disk index separator
authorIustin Pop <iustin@google.com>
Tue, 21 Dec 2010 13:18:39 +0000 (14:18 +0100)
committerIustin Pop <iustin@google.com>
Tue, 21 Dec 2010 13:23:23 +0000 (14:23 +0100)
As per issue 124, some Xen versions (or packaging) don't deal nicely
with the colon being part of a disk name. Therefore we add a
configure-time option for customising this.

Note: setting the separator to interesting values like / is not
handled by the code. This being a configure-time option (e.g. to be
set by distribution packagers), we assume the person building the code
knows what they are doing.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

Makefile.am
configure.ac
lib/backend.py
lib/constants.py

index 0be0edb..283c104 100644 (file)
@@ -661,6 +661,7 @@ lib/_autoconf.py: Makefile vcs-version | lib/.dir
          echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
          echo "NODED_USER = '$(NODED_USER)'"; \
          echo "VCS_VERSION = '$$VCSVER'"; \
+         echo "DISK_SEPARATOR = '$(DISK_SEPARATOR)'"; \
        } > $@
 
 $(REPLACE_VARS_SED): Makefile
index 33d55f7..aab7d65 100644 (file)
@@ -223,6 +223,15 @@ then
 fi
 AC_SUBST(SYSLOG_USAGE, $SYSLOG)
 
+# --with-disk-separator=...
+AC_ARG_WITH([disk-separator],
+  [AS_HELP_STRING([--with-disk-separator=STRING],
+    [Disk index separator, useful if the default of ':' is handled specially by the hypervisor]
+  )],
+  [disk_separator="$withval"],
+  [disk_separator=":"])
+AC_SUBST(DISK_SEPARATOR, $disk_separator)
+
 # Check common programs
 AC_PROG_INSTALL
 AC_PROG_LN_S
index 57c2ce4..45b4b46 100644 (file)
@@ -941,8 +941,8 @@ def RunRenameInstance(instance, old_name, debug):
 
 
 def _GetBlockDevSymlinkPath(instance_name, idx):
-  return utils.PathJoin(constants.DISK_LINKS_DIR,
-                        "%s:%d" % (instance_name, idx))
+  return utils.PathJoin(constants.DISK_LINKS_DIR, "%s%s%d" %
+                        (instance_name, constants.DISK_SEPARATOR, idx))
 
 
 def _SymlinkBlockDev(instance_name, device_path, idx):
index b9aea16..871aa50 100644 (file)
@@ -488,6 +488,8 @@ DEFAULT_SHUTDOWN_TIMEOUT = 120
 NODE_MAX_CLOCK_SKEW = 150
 # Time for an intra-cluster disk transfer to wait for a connection
 DISK_TRANSFER_CONNECT_TIMEOUT = 30
+# Disk index separator
+DISK_SEPARATOR = _autoconf.DISK_SEPARATOR
 
 # runparts results
 (RUNPARTS_SKIP,