From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Goldish Subject: [KVM-AUTOTEST PATCH 3/9] KVM test: rss_file_transfer.py: add convenience functions upload() and download() Date: Thu, 15 Jul 2010 18:57:32 +0300 Message-ID: <1279209458-19590-3-git-send-email-mgoldish@redhat.com> References: <1279209458-19590-1-git-send-email-mgoldish@redhat.com> <1279209458-19590-2-git-send-email-mgoldish@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: autotest@test.kernel.org, kvm@vger.kernel.org Return-path: In-Reply-To: <1279209458-19590-2-git-send-email-mgoldish@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: autotest-bounces@test.kernel.org Errors-To: autotest-bounces@test.kernel.org List-Id: kvm.vger.kernel.org Signed-off-by: Michael Goldish --- client/tests/kvm/rss_file_transfer.py | 32 ++++++++++++++++++++++++++------ 1 files changed, 26 insertions(+), 6 deletions(-) diff --git a/client/tests/kvm/rss_file_transfer.py b/client/tests/kvm/rss_file_transfer.py index c584397..3de8259 100755 --- a/client/tests/kvm/rss_file_transfer.py +++ b/client/tests/kvm/rss_file_transfer.py @@ -395,6 +395,30 @@ class FileDownloadClient(FileTransferClient): raise +def upload(address, port, src_pattern, dst_path, timeout=60, + connect_timeout=10): + """ + Connect to server and upload files. + + @see: FileUploadClient + """ + client = FileUploadClient(address, port, connect_timeout) + client.upload(src_pattern, dst_path, timeout) + client.close() + + +def download(address, port, src_pattern, dst_path, timeout=60, + connect_timeout=10): + """ + Connect to server and upload files. + + @see: FileDownloadClient + """ + client = FileDownloadClient(address, port, connect_timeout) + client.download(src_pattern, dst_path, timeout) + client.close() + + def main(): import optparse @@ -418,13 +442,9 @@ def main(): port = int(port) if options.download: - client = FileDownloadClient(address, port) - client.download(src_pattern, dst_path, timeout=options.timeout) - client.close() + download(address, port, src_pattern, dst_path, options.timeout) elif options.upload: - client = FileUploadClient(address, port) - client.upload(src_pattern, dst_path, timeout=options.timeout) - client.close() + upload(address, port, src_pattern, dst_path, options.timeout) if __name__ == "__main__": -- 1.5.4.1