Commit 2ba39b8f authored by Iustin Pop's avatar Iustin Pop
Browse files

Implement no_remember at RAPI level


Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 885a0fc4
#
#
# Copyright (C) 2010 Google Inc.
# Copyright (C) 2010, 2011 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
......@@ -908,35 +908,43 @@ class GanetiRapiClient(object): # pylint: disable-msg=R0904
("/%s/instances/%s/reboot" %
(GANETI_RAPI_VERSION, instance)), query, None)
def ShutdownInstance(self, instance, dry_run=False):
def ShutdownInstance(self, instance, dry_run=False, no_remember=False):
"""Shuts down an instance.
@type instance: str
@param instance: the instance to shut down
@type dry_run: bool
@param dry_run: whether to perform a dry run
@type no_remember: bool
@param no_remember: if true, will not record the state change
"""
query = []
if dry_run:
query.append(("dry-run", 1))
if no_remember:
query.append(("no-remember", 1))
return self._SendRequest(HTTP_PUT,
("/%s/instances/%s/shutdown" %
(GANETI_RAPI_VERSION, instance)), query, None)
def StartupInstance(self, instance, dry_run=False):
def StartupInstance(self, instance, dry_run=False, no_remember=False):
"""Starts up an instance.
@type instance: str
@param instance: the instance to start up
@type dry_run: bool
@param dry_run: whether to perform a dry run
@type no_remember: bool
@param no_remember: if true, will not record the state change
"""
query = []
if dry_run:
query.append(("dry-run", 1))
if no_remember:
query.append(("no-remember", 1))
return self._SendRequest(HTTP_PUT,
("/%s/instances/%s/startup" %
......
......@@ -995,9 +995,11 @@ class R_2_instances_name_startup(baserlib.R_Generic):
"""
instance_name = self.items[0]
force_startup = bool(self._checkIntVariable('force'))
no_remember = bool(self._checkIntVariable('no_remember'))
op = opcodes.OpInstanceStartup(instance_name=instance_name,
force=force_startup,
dry_run=bool(self.dryRun()))
dry_run=bool(self.dryRun()),
no_remember=no_remember)
return baserlib.SubmitJob([op])
......@@ -1013,8 +1015,10 @@ class R_2_instances_name_shutdown(baserlib.R_Generic):
"""
instance_name = self.items[0]
no_remember = bool(self._checkIntVariable('no_remember'))
op = opcodes.OpInstanceShutdown(instance_name=instance_name,
dry_run=bool(self.dryRun()))
dry_run=bool(self.dryRun()),
no_remember=no_remember)
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