Revision 4a90bd4f lib/server/noded.py
b/lib/server/noded.py | ||
---|---|---|
112 | 112 |
return ieioargs |
113 | 113 |
|
114 | 114 |
|
115 |
def _DefaultAlternative(value, default): |
|
116 |
"""Returns the given value, unless it is None. In that case, returns a |
|
117 |
default alternative. |
|
118 |
|
|
119 |
@param value: The value to return if it is not None. |
|
120 |
@param default: The value to return as a default alternative. |
|
121 |
@return: The given value or the default alternative.\ |
|
122 |
|
|
123 |
""" |
|
124 |
if value: |
|
125 |
return value |
|
126 |
|
|
127 |
return default |
|
128 |
|
|
129 |
|
|
115 | 130 |
class MlockallRequestExecutor(http.server.HttpServerRequestExecutor): |
116 | 131 |
"""Subclass ensuring request handlers are locked in RAM. |
117 | 132 |
|
... | ... | |
633 | 648 |
instance = objects.Instance.FromDict(params[0]) |
634 | 649 |
reboot_type = params[1] |
635 | 650 |
shutdown_timeout = params[2] |
636 |
return backend.InstanceReboot(instance, reboot_type, shutdown_timeout) |
|
651 |
(reason_source, reason_text) = params[3] |
|
652 |
reason_text = _DefaultAlternative(reason_text, |
|
653 |
constants.INSTANCE_REASON_REBOOT) |
|
654 |
reason = backend.InstReason(reason_source, reason_text) |
|
655 |
return backend.InstanceReboot(instance, reboot_type, shutdown_timeout, |
|
656 |
reason) |
|
637 | 657 |
|
638 | 658 |
@staticmethod |
639 | 659 |
def perspective_instance_balloon_memory(params): |
Also available in: Unified diff