Commit 52194140 authored by Iustin Pop's avatar Iustin Pop
Browse files

Update the RAPI node migrate for the 'live' change



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: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 1f334d96
#
#
# 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])
......
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