Commit 05b6f4d8 authored by Bernardo Dal Seno's avatar Bernardo Dal Seno
Browse files

Merge branch 'devel-2.7'

* devel-2.7
  cfgupgrade: Fix error messages
  Update "FIXME" string in RAPI
  rapi client: add target_node to migrate instance
  Make diskless instances externally mirrored
  Fix migrate/failover -n for ext mirror storage

Trivial merge: no conflicts
Signed-off-by: default avatarBernardo Dal Seno <>
Reviewed-by: default avatarHelga Velroyen <>
parents 13cc7b84 fdb85e3d
......@@ -8164,8 +8164,8 @@ def _ExpandNamesForMigration(lu):
lu.needed_locks[locking.LEVEL_NODE_RES] = []
lu.recalculate_locks[locking.LEVEL_NODE_RES] = constants.LOCKS_REPLACE
# The node allocation lock is actually only needed for replicated instances
# (e.g. DRBD8) and if an iallocator is used.
# The node allocation lock is actually only needed for externally replicated
# instances (e.g. sharedfile or RBD) and if an iallocator is used.
lu.needed_locks[locking.LEVEL_NODE_ALLOC] = []
......@@ -8673,11 +8673,10 @@ class TLMigrateInstance(Tasklet):
if instance.disk_template in constants.DTS_EXT_MIRROR:
assert locking.NAL in
_CheckIAllocatorOrNode(, "iallocator", "target_node")
assert locking.NAL in
# We set set self.target_node as it is required by
......@@ -436,6 +436,7 @@ DTS_INT_MIRROR = compat.UniqueFrozenset([DT_DRBD8])
# the set of externally-mirrored disk templates (e.g. SAN, NAS)
DTS_EXT_MIRROR = compat.UniqueFrozenset([
DT_DISKLESS, # 'trivially' externally mirrored
......@@ -1196,7 +1196,8 @@ class GanetiRapiClient(object): # pylint: disable=R0904
("/%s/instances/%s/export" %
(GANETI_RAPI_VERSION, instance)), None, body)
def MigrateInstance(self, instance, mode=None, cleanup=None):
def MigrateInstance(self, instance, mode=None, cleanup=None,
"""Migrates an instance.
@type instance: string
......@@ -1205,6 +1206,8 @@ class GanetiRapiClient(object): # pylint: disable=R0904
@param mode: Migration mode
@type cleanup: bool
@param cleanup: Whether to clean up a previously failed migration
@type target_node: string
@param target_node: Target Node for externally mirrored instances
@rtype: string
@return: job id
......@@ -1212,6 +1215,7 @@ class GanetiRapiClient(object): # pylint: disable=R0904
body = {}
_SetItemIf(body, mode is not None, "mode", mode)
_SetItemIf(body, cleanup is not None, "cleanup", cleanup)
_SetItemIf(body, target_node is not None, "target_node", target_node)
return self._SendRequest(HTTP_PUT,
("/%s/instances/%s/migrate" %
......@@ -167,7 +167,7 @@ _WFJC_TIMEOUT = 10
# FIXME: For compatibility we update the beparams/memory field. Needs to be
# removed in Ganeti 2.7
# removed in Ganeti 2.8
def _UpdateBeparams(inst):
"""Updates the beparams dict of inst to support the memory field.
# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -334,6 +334,7 @@ def main():
# test loading the config file
all_ok = True
if not (options.dry_run or options.no_verify):"Testing the new config file...")
cfg = config.ConfigWriter(cfg_file=options.CONFIG_DATA_PATH,
......@@ -345,11 +346,17 @@ def main():
logging.error("Errors after conversion:")
for item in vrfy:
logging.error(" - %s", item)
all_ok = False
else:"File loaded successfully after upgrading")
del cfg"File loaded successfully")
cli.ToStderr("Configuration successfully upgraded for version %s.",
if all_ok:
cli.ToStderr("Configuration successfully upgraded to version %s.",
cli.ToStderr("Configuration upgraded to version %s, but there are errors."
"\nPlease review the file.", constants.RELEASE_VERSION)
if __name__ == "__main__":
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