From 5219414052d36369cfcc59ee783e3b4af2fde6a3 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Thu, 22 Jul 2010 13:54:17 -0400 Subject: [PATCH] Update the RAPI node migrate for the 'live' change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds handling of the new 'mode' parameter to the RAPI server, while keeping compatibility with the old mode. Note that in the old mode (when 'live' is being passed), the auto-mode doesn't work. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: RenΓ© Nussbaumer <rn@google.com> --- lib/rapi/rlib2.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py index 955a6f2fe..0f6ffa0eb 100644 --- a/lib/rapi/rlib2.py +++ b/lib/rapi/rlib2.py @@ -1,7 +1,7 @@ # # -# Copyright (C) 2006, 2007, 2008 Google Inc. +# Copyright (C) 2006, 2007, 2008, 2009, 2010 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 @@ -426,9 +426,19 @@ class R_2_nodes_name_migrate(baserlib.R_Generic): """ node_name = self.items[0] - live = bool(self._checkIntVariable("live", default=1)) - op = opcodes.OpMigrateNode(node_name=node_name, live=live) + if "live" in self.queryargs and "mode" in self.queryargs: + raise http.HttpBadRequest("Only one of 'live' and 'mode' should" + " be passed") + elif "live" in self.queryargs: + if self._checkIntVariable("live", default=1): + mode = constants.HT_MIGRATION_LIVE + else: + mode = constants.HT_MIGRATION_NONLIVE + else: + mode = self._checkStringVariable("mode", default=None) + + op = opcodes.OpMigrateNode(node_name=node_name, mode=mode) return baserlib.SubmitJob([op]) -- GitLab