Revision 6b294c53
b/lib/config.py | ||
---|---|---|
820 | 820 |
nodelist.remove(myhostname) |
821 | 821 |
except ValueError: |
822 | 822 |
pass |
823 |
|
|
824 |
result = rpc.RpcRunner.call_upload_file(nodelist, self._cfg_file) |
|
823 |
# we can skip checking whether _UnlockedGetNodeInfo returns None |
|
824 |
# since the node list comes from _UnlocketGetNodeList, and we are |
|
825 |
# called with the lock held, so no modifications should take place |
|
826 |
# in between |
|
827 |
address_list = [self._UnlockedGetNodeInfo(name).primary_ip |
|
828 |
for name in nodelist] |
|
829 |
|
|
830 |
result = rpc.RpcRunner.call_upload_file(nodelist, self._cfg_file, |
|
831 |
address_list=address_list) |
|
825 | 832 |
for node in nodelist: |
826 | 833 |
if not result[node]: |
827 | 834 |
logging.error("copy of file %s to node %s failed", |
b/lib/rpc.py | ||
---|---|---|
666 | 666 |
return c.GetResults().get(node, False) |
667 | 667 |
|
668 | 668 |
@staticmethod |
669 |
def call_upload_file(node_list, file_name): |
|
669 |
def call_upload_file(node_list, file_name, address_list=None):
|
|
670 | 670 |
"""Upload a file. |
671 | 671 |
|
672 | 672 |
The node will refuse the operation in case the file is not on the |
... | ... | |
674 | 674 |
|
675 | 675 |
This is a multi-node call. |
676 | 676 |
|
677 |
@type node_list: list |
|
678 |
@param node_list: the list of node names to upload to |
|
679 |
@type file_name: str |
|
680 |
@param file_name: the filename to upload |
|
681 |
@type address_list: list or None |
|
682 |
@keyword address_list: an optional list of node addresses, in order |
|
683 |
to optimize the RPC speed |
|
684 |
|
|
677 | 685 |
""" |
678 | 686 |
fh = file(file_name) |
679 | 687 |
try: |
... | ... | |
684 | 692 |
params = [file_name, data, st.st_mode, st.st_uid, st.st_gid, |
685 | 693 |
st.st_atime, st.st_mtime] |
686 | 694 |
c = Client("upload_file", params) |
687 |
c.ConnectList(node_list) |
|
695 |
c.ConnectList(node_list, address_list=address_list)
|
|
688 | 696 |
c.Run() |
689 | 697 |
return c.GetResults() |
690 | 698 |
|
Also available in: Unified diff