Commit 8946422b authored by Klaus Aehlig's avatar Klaus Aehlig

Merge branch 'stable-2.10' into stable-2.11

* stable-2.10
  Make gnt-cluster upgrade honor backup-dir
  Add a new --with-backup-dir configure option
  Fix BlockdevSnapshot in case of non lvm-based disk
  Fix RAPI in case split query mechanism is used
  Allow disk hot-remove even with chroot or SM
  Remove superflous loop in instance queries

Conflicts:
	lib/cmdlib/instance_query.py: take version from 2.11
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parents 27087452 5be83717
......@@ -96,6 +96,12 @@ iallocatorsdir = $(pkglibdir)/iallocators
pytoolsdir = $(pkgpythondir)/tools
docdir = $(versiondir)$(datadir)/doc/$(PACKAGE)
if USE_BACKUP_DIR
backup_dir = $(BACKUP_DIR)
else
backup_dir = $(localstatedir)/lib
endif
SYMLINK_TARGET_DIRS = \
$(sysconfdir)/ganeti \
$(libdir)/ganeti/iallocators \
......@@ -1846,6 +1852,7 @@ src/AutoConf.hs: Makefile src/AutoConf.hs.in $(PRINT_PY_CONSTANTS) \
-DSSH_LOGIN_USER="$(SSH_LOGIN_USER)" \
-DSSH_CONSOLE_USER="$(SSH_CONSOLE_USER)" \
-DEXPORT_DIR="$(EXPORT_DIR)" \
-DBACKUP_DIR="$(backup_dir)" \
-DOS_SEARCH_PATH="\"$(OS_SEARCH_PATH)\"" \
-DES_SEARCH_PATH="\"$(ES_SEARCH_PATH)\"" \
-DXEN_BOOTLOADER="$(XEN_BOOTLOADER)" \
......
......@@ -136,6 +136,21 @@ AC_ARG_WITH([export-dir],
[export_dir="/srv/ganeti/export"])
AC_SUBST(EXPORT_DIR, $export_dir)
# --with-backup-dir=...
AC_ARG_WITH([backup-dir],
[AS_HELP_STRING([--with-backup-dir=DIR],
[directory to use for configuration backups]
[ on Ganeti upgrades (default is $(localstatedir)/lib)]
)],
[backup_dir="$withval"
USE_BACKUP_DIR=yes
],
[backup_dir=
USE_BACKUP_DIR=no
])
AC_SUBST(BACKUP_DIR, $backup_dir)
AM_CONDITIONAL([USE_BACKUP_DIR], [test "$USE_BACKUP_DIR" = yes])
# --with-ssh-config-dir=...
AC_ARG_WITH([ssh-config-dir],
[AS_HELP_STRING([--with-ssh-config-dir=DIR],
......
......@@ -3208,7 +3208,7 @@ def BlockdevSnapshot(disk):
_Fail("Cannot find block device %s", disk)
else:
_Fail("Cannot snapshot non-lvm block device '%s' of type '%s'",
disk.unique_id, disk.dev_type)
disk.logical_id, disk.dev_type)
def BlockdevSetInfo(disk, info):
......
......@@ -1877,9 +1877,10 @@ def _UpgradeBeforeConfigurationChange(versionstring):
ToStderr("Failed to stop daemons on %s." % (", ".join(badnodes),))
return (False, rollback)
backuptar = os.path.join(pathutils.LOCALSTATEDIR,
"lib/ganeti%d.tar" % time.time())
backuptar = os.path.join(pathutils.BACKUP_DIR, "ganeti%d.tar" % time.time())
ToStdout("Backing up configuration as %s" % backuptar)
if not _RunCommandAndReport(["mkdir", "-p", pathutils.BACKUP_DIR]):
return (False, rollback)
if not _RunCommandAndReport(["tar", "cf", backuptar,
pathutils.DATA_DIR]):
return (False, rollback)
......
......@@ -2145,12 +2145,13 @@ class KVMHypervisor(hv_base.BaseHypervisor):
hvp = instance.hvparams
security_model = hvp[constants.HV_SECURITY_MODEL]
use_chroot = hvp[constants.HV_KVM_USE_CHROOT]
if use_chroot:
raise errors.HotplugError("Disk hotplug is not supported"
" in case of chroot.")
if security_model != constants.HT_SM_NONE:
raise errors.HotplugError("Disk Hotplug is not supported in case"
" security models are used.")
if action == constants.HOTPLUG_ACTION_ADD:
if use_chroot:
raise errors.HotplugError("Disk hotplug is not supported"
" in case of chroot.")
if security_model != constants.HT_SM_NONE:
raise errors.HotplugError("Disk Hotplug is not supported in case"
" security models are used.")
if (dev_type == constants.HOTPLUG_TARGET_NIC and
action == constants.HOTPLUG_ACTION_ADD and not fdsend):
......
......@@ -38,6 +38,7 @@ DEFAULT_GLUSTER_STORAGE_DIR = "/var/run/ganeti/gluster"
DEFAULT_GLUSTER_STORAGE_DIR = \
vcluster.AddNodePrefix(DEFAULT_GLUSTER_STORAGE_DIR)
EXPORT_DIR = vcluster.AddNodePrefix(_constants.EXPORT_DIR)
BACKUP_DIR = vcluster.AddNodePrefix(_constants.BACKUP_DIR)
OS_SEARCH_PATH = _constants.OS_SEARCH_PATH
ES_SEARCH_PATH = _constants.ES_SEARCH_PATH
SSH_CONFIG_DIR = _constants.SSH_CONFIG_DIR
......
......@@ -178,13 +178,19 @@ def HandleItemQueryErrors(fn, *args, **kwargs):
"""
try:
return fn(*args, **kwargs)
result = fn(*args, **kwargs)
except errors.OpPrereqError, err:
if len(err.args) == 2 and err.args[1] == errors.ECODE_NOENT:
raise http.HttpNotFound()
raise
# In case split query mechanism is used
if not result:
raise http.HttpNotFound()
return result
def FeedbackFn(msg):
"""Feedback logging function for jobs.
......
......@@ -73,6 +73,9 @@ sshConsoleUser = "SSH_CONSOLE_USER"
exportDir :: String
exportDir = "EXPORT_DIR"
backupDir :: String
backupDir = "BACKUP_DIR"
osSearchPath :: [String]
osSearchPath = split OS_SEARCH_PATH
......
......@@ -88,6 +88,9 @@ hasGnuLn = AutoConf.hasGnuLn
exportDir :: String
exportDir = AutoConf.exportDir
backupDir :: String
backupDir = AutoConf.backupDir
osSearchPath :: [String]
osSearchPath = AutoConf.osSearchPath
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment