Commit 3b7158ef authored by Michael Hanselmann's avatar Michael Hanselmann

RAPI client: Support modifying instances

Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 3882937a
......@@ -718,6 +718,23 @@ class GanetiRapiClient(object):
("/%s/instances/%s" %
(GANETI_RAPI_VERSION, instance)), query, None)
def ModifyInstance(self, instance, **kwargs):
"""Modifies an instance.
More details for parameters can be found in the RAPI documentation.
@type instance: string
@param instance: Instance name
@rtype: int
@return: job id
"""
body = kwargs
return self._SendRequest(HTTP_PUT,
("/%s/instances/%s/modify" %
(GANETI_RAPI_VERSION, instance)), None, body)
def GetInstanceTags(self, instance):
"""Gets tags for an instance.
......
......@@ -162,6 +162,8 @@ def RunCommonInstanceTests(instance):
if qa_config.TestEnabled('instance-modify'):
RunTest(qa_instance.TestInstanceModify, instance)
if qa_rapi.Enabled():
RunTest(qa_rapi.TestRapiInstanceModify, instance)
if qa_config.TestEnabled('instance-console'):
RunTest(qa_instance.TestInstanceConsole, instance)
......
......@@ -358,6 +358,28 @@ def TestRapiInstanceRename(instance, rename_target):
_WaitForRapiJob(_rapi_client.RenameInstance(name1, name2))
def TestRapiInstanceModify(instance):
"""Test modifying instance via RAPI"""
def _ModifyInstance(**kwargs):
_WaitForRapiJob(_rapi_client.ModifyInstance(instance["name"], **kwargs))
_ModifyInstance(hvparams={
constants.HV_KERNEL_ARGS: "single",
})
_ModifyInstance(beparams={
constants.BE_VCPUS: 3,
})
_ModifyInstance(beparams={
constants.BE_VCPUS: constants.VALUE_DEFAULT,
})
_ModifyInstance(hvparams={
constants.HV_KERNEL_ARGS: constants.VALUE_DEFAULT,
})
def TestInterClusterInstanceMove(src_instance, dest_instance, pnode, snode):
"""Test tools/move-instance"""
master = qa_config.GetMasterNode()
......
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