Revision b2acdbdc
b/lib/config.py | ||
---|---|---|
164 | 164 |
self._my_hostname = netutils.Hostname.GetSysName() |
165 | 165 |
self._last_cluster_serial = -1 |
166 | 166 |
self._cfg_id = None |
167 |
self._context = None |
|
167 | 168 |
self._OpenConfig(accept_foreign) |
168 | 169 |
|
170 |
def _GetRpc(self, address_list): |
|
171 |
"""Returns RPC runner for configuration. |
|
172 |
|
|
173 |
""" |
|
174 |
return rpc.ConfigRunner(self._context, address_list) |
|
175 |
|
|
176 |
def SetContext(self, context): |
|
177 |
"""Sets Ganeti context. |
|
178 |
|
|
179 |
""" |
|
180 |
self._context = context |
|
181 |
|
|
169 | 182 |
# this method needs to be static, so that we can call it on the class |
170 | 183 |
@staticmethod |
171 | 184 |
def IsCluster(): |
... | ... | |
1749 | 1762 |
|
1750 | 1763 |
# TODO: Use dedicated resolver talking to config writer for name resolution |
1751 | 1764 |
result = \ |
1752 |
rpc.ConfigRunner(addr_list).call_upload_file(node_list, self._cfg_file)
|
|
1765 |
self._GetRpc(addr_list).call_upload_file(node_list, self._cfg_file)
|
|
1753 | 1766 |
for to_node, to_result in result.items(): |
1754 | 1767 |
msg = to_result.fail_msg |
1755 | 1768 |
if msg: |
... | ... | |
1808 | 1821 |
# Write ssconf files on all nodes (including locally) |
1809 | 1822 |
if self._last_cluster_serial < self._config_data.cluster.serial_no: |
1810 | 1823 |
if not self._offline: |
1811 |
result = rpc.ConfigRunner(None).call_write_ssconf_files(
|
|
1824 |
result = self._GetRpc(None).call_write_ssconf_files(
|
|
1812 | 1825 |
self._UnlockedGetOnlineNodeList(), |
1813 | 1826 |
self._UnlockedGetSsconfValues()) |
1814 | 1827 |
|
b/lib/rpc.py | ||
---|---|---|
723 | 723 |
"""RPC wrappers for L{config}. |
724 | 724 |
|
725 | 725 |
""" |
726 |
def __init__(self, address_list): |
|
726 |
def __init__(self, context, address_list):
|
|
727 | 727 |
"""Initializes this class. |
728 | 728 |
|
729 | 729 |
""" |
730 |
if context: |
|
731 |
lock_monitor_cb = context.glm.AddToLockMonitor |
|
732 |
else: |
|
733 |
lock_monitor_cb = None |
|
734 |
|
|
730 | 735 |
if address_list is None: |
731 | 736 |
resolver = _SsconfResolver |
732 | 737 |
else: |
733 | 738 |
# Caller provided an address list |
734 | 739 |
resolver = _StaticResolver(address_list) |
735 | 740 |
|
736 |
_RpcClientBase.__init__(self, resolver, _ENCODERS.get) |
|
741 |
_RpcClientBase.__init__(self, resolver, _ENCODERS.get, |
|
742 |
lock_monitor_cb=lock_monitor_cb) |
|
737 | 743 |
_generated_rpc.RpcClientConfig.__init__(self) |
b/lib/server/masterd.py | ||
---|---|---|
401 | 401 |
self.cfg.GetNodeGroupList(), |
402 | 402 |
self.cfg.GetInstanceList()) |
403 | 403 |
|
404 |
self.cfg.SetContext(self) |
|
405 |
|
|
404 | 406 |
# Job queue |
405 | 407 |
self.jobqueue = jqueue.JobQueue(self) |
406 | 408 |
|
Also available in: Unified diff