Revision 6b294c53 lib/rpc.py
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