Commit 88bc199a authored by Michael Hanselmann's avatar Michael Hanselmann

RAPI: Use FillOpCode for renaming instances

Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent b166ef84
News
====
Version 2.5.0 beta1
-------------------
*(unreleased)*
- The default of the ``/2/instances/[instance_name]/rename`` RAPI
resource's ``ip_check`` parameter changed from ``True`` to ``False``
to match the underlying LUXI interface
Version 2.4.0 beta1
-------------------
......
......@@ -878,12 +878,8 @@ Returns a job ID.
Body parameters:
``new_name`` (string, required)
New instance name.
``ip_check`` (bool)
Whether to ensure instance's IP address is inactive.
``name_check`` (bool)
Whether to ensure instance's name is resolvable.
.. opcode_params:: OP_INSTANCE_RENAME
:exclude: instance_name
``/2/instances/[instance_name]/modify``
......
......@@ -1242,12 +1242,9 @@ def _ParseRenameInstanceRequest(name, data):
@return: Instance rename opcode
"""
new_name = baserlib.CheckParameter(data, "new_name")
ip_check = baserlib.CheckParameter(data, "ip_check", default=True)
name_check = baserlib.CheckParameter(data, "name_check", default=True)
return opcodes.OpInstanceRename(instance_name=name, new_name=new_name,
name_check=name_check, ip_check=ip_check)
return baserlib.FillOpcode(opcodes.OpInstanceRename, data, {
"instance_name": name,
})
class R_2_instances_name_rename(baserlib.R_Generic):
......
......@@ -293,8 +293,8 @@ class TestParseRenameInstanceRequest(testutils.GanetiTestCase):
self.assert_(isinstance(op, opcodes.OpInstanceRename))
self.assertEqual(op.instance_name, name)
self.assertEqual(op.new_name, new_name)
self.assert_(op.ip_check)
self.assert_(op.name_check)
self.assertFalse(hasattr(op, "ip_check"))
self.assertFalse(hasattr(op, "name_check"))
class TestParseModifyInstanceRequest(testutils.GanetiTestCase):
......
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