Commit 7bcc5fc0 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Merge branch 'stable-2.10' into stable-2.11

* stable-2.10
  On upgrades, check for upgrades to resume first
  Pause watcher during upgrade
  Allow instance disks to be added with --no-wait-for-sync
Signed-off-by: default avatarKlaus Aehlig <>
Reviewed-by: default avatarPetr Pudlak <>
parents 39f23930 de23298f
......@@ -1863,6 +1863,10 @@ def _UpgradeBeforeConfigurationChange(versionstring):
ToStderr("Failed to completely empty the queue.")
return (False, rollback)
ToStdout("Pausing the watcher for one hour.")
rollback.append(lambda: GetClient().SetWatcherPause(None))
GetClient().SetWatcherPause(time.time() + 60 * 60)
ToStdout("Stopping daemons on master node.")
if not _RunCommandAndReport([pathutils.DAEMON_UTIL, "stop-all"]):
return (False, rollback)
......@@ -2031,6 +2035,10 @@ def _UpgradeAfterConfigurationChange(oldversion):
if not _RunCommandAndReport([pathutils.POST_UPGRADE, oldversion]):
returnvalue = 1
ToStdout("Unpasuing the watcher.")
if not _RunCommandAndReport(["gnt-cluster", "watcher", "continue"]):
returnvalue = 1
ToStdout("Verifying cluster.")
if not _RunCommandAndReport(["gnt-cluster", "verify"]):
returnvalue = 1
......@@ -2054,6 +2062,22 @@ def UpgradeGanetiCommand(opts, args):
" has to be given")
return 1
# If we're not told to resume, verify there is no upgrade
# in progress.
if not opts.resume:
oldversion, versionstring = _ReadIntentToUpgrade()
if versionstring is not None:
# An upgrade is going on; verify whether the target matches
if versionstring ==
ToStderr("An upgrade is already in progress. Target version matches,"
" resuming.")
opts.resume = True = None
ToStderr("An upgrade from %s to %s is in progress; use --resume to"
" finish it first" % (oldversion, versionstring))
return 1
oldversion = constants.RELEASE_VERSION
if opts.resume:
......@@ -2830,11 +2830,11 @@ class LUInstanceSetParams(LogicalUnit):
if not self.op.wait_for_sync and self.instance.disks_active:
if not self.op.wait_for_sync and not self.instance.disks_active:
for mod in self.diskmod:
if mod[0] == constants.DDM_ADD:
raise errors.OpPrereqError("Can't add a disk to an instance with"
" activated disks and"
" deactivated disks and"
" --no-wait-for-sync given.",
......@@ -2190,9 +2190,8 @@ class TestLUInstanceSetParams(CmdlibTestCase):
constants.IDISK_SIZE: 1024
op, "Can't add a disk to an instance with activated disks"
" and --no-wait-for-sync given.")
def testAddDiskDownInstance(self):
op = self.CopyOpCode(self.op,
......@@ -2204,6 +2203,17 @@ class TestLUInstanceSetParams(CmdlibTestCase):
def testAddDiskDownInstanceNoWaitForSync(self):
op = self.CopyOpCode(self.op,
disks=[[constants.DDM_ADD, -1,
constants.IDISK_SIZE: 1024
op, "Can't add a disk to an instance with deactivated disks"
" and --no-wait-for-sync given.")
def testAddDiskRunningInstance(self):
op = self.CopyOpCode(self.running_op,
disks=[[constants.DDM_ADD, -1,
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