from ganeti import constants
from ganeti import errors
-import ganeti.http.client
+# pylint has a bug here, doesn't see this import
+import ganeti.http.client # pylint: disable-msg=W0611
# Module level variable
Must be called before using any RPC function.
"""
- global _http_manager
+ global _http_manager # pylint: disable-msg=W0603
assert not _http_manager, "RPC module initialized more than once"
+ http.InitSsl()
+
_http_manager = http.client.HttpClientManager()
Must be called before quitting the program.
"""
- global _http_manager
+ global _http_manager # pylint: disable-msg=W0603
if _http_manager:
_http_manager.Shutdown()
else:
return "No error information"
- def Raise(self, msg, prereq=False):
+ def Raise(self, msg, prereq=False, ecode=None):
"""If the result has failed, raise an OpExecError.
This is used so that LU code doesn't have to check for each
ec = errors.OpPrereqError
else:
ec = errors.OpExecError
- raise ec(msg)
+ if ecode is not None:
+ args = (msg, prereq)
+ else:
+ args = (msg, )
+ raise ec(*args) # pylint: disable-msg=W0142
class Client:
# TODO: should this method query down nodes?
return cls._StaticMultiNodeCall(node_list, "master_info", [])
- def call_version(self, node_list):
+ @classmethod
+ def call_version(cls, node_list):
"""Query node version.
This is a multi-node call.
"""
- return self._MultiNodeCall(node_list, "version", [])
+ return cls._StaticMultiNodeCall(node_list, "version", [])
def call_blockdev_create(self, node, bdev, size, owner, on_primary, info):
"""Request creation of a given block device.
return self._SingleNodeCall(node, "export_remove", [export])
@classmethod
- def call_node_leave_cluster(cls, node):
+ def call_node_leave_cluster(cls, node, modify_ssh_setup):
"""Requests a node to clean the cluster information it has.
This will remove the configuration information from the ganeti data
This is a single-node call.
"""
- return cls._StaticSingleNodeCall(node, "node_leave_cluster", [])
+ return cls._StaticSingleNodeCall(node, "node_leave_cluster",
+ [modify_ssh_setup])
def call_node_volumes(self, node_list):
"""Gets all volumes on node(s).