diff --git a/lib/rapi/client.py b/lib/rapi/client.py index cb437849db353e66c525dc3120e9b2556248db9e..eb3079490adeb228ee863dac5082a79df64f751a 100644 --- a/lib/rapi/client.py +++ b/lib/rapi/client.py @@ -1,7 +1,7 @@ # # -# 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" % diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py index db5fcb90629d6d4b3cb4460367988924a40daaca..61ff6b73c6f19b39645d247f2a301ecca391badb 100644 --- a/lib/rapi/rlib2.py +++ b/lib/rapi/rlib2.py @@ -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])