Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: client/virt/tests/image_copy.py

Issue 6883246: Merge autotest upstream from @5318 ~ @5336 (Closed) Base URL: ssh://gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/virt/tests/guest_test.py ('k') | client/virt/tests/iofuzz.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import os, logging 1 import os, logging
2 from autotest_lib.client.common_lib import error 2 from autotest_lib.client.common_lib import error
3 from autotest_lib.client.bin import utils 3 from autotest_lib.client.bin import utils
4 import kvm_utils 4 from autotest_lib.client.virt import virt_utils
5 5
6 6
7 def run_image_copy(test, params, env): 7 def run_image_copy(test, params, env):
8 """ 8 """
9 Copy guest images from nfs server. 9 Copy guest images from nfs server.
10 1) Mount the NFS share directory 10 1) Mount the NFS share directory
11 2) Check the existence of source image 11 2) Check the existence of source image
12 3) If it exists, copy the image from NFS 12 3) If it exists, copy the image from NFS
13 13
14 @param test: kvm test object 14 @param test: kvm test object
(...skipping 11 matching lines...) Expand all
26 raise error.TestError('Failed to create NFS share dir %s' % 26 raise error.TestError('Failed to create NFS share dir %s' %
27 mount_dest_dir) 27 mount_dest_dir)
28 28
29 src = params.get('images_good') 29 src = params.get('images_good')
30 image = '%s.%s' % (os.path.split(params['image_name'])[1], 30 image = '%s.%s' % (os.path.split(params['image_name'])[1],
31 params['image_format']) 31 params['image_format'])
32 src_path = os.path.join(mount_dest_dir, image) 32 src_path = os.path.join(mount_dest_dir, image)
33 dst_path = '%s.%s' % (params['image_name'], params['image_format']) 33 dst_path = '%s.%s' % (params['image_name'], params['image_format'])
34 cmd = 'cp %s %s' % (src_path, dst_path) 34 cmd = 'cp %s %s' % (src_path, dst_path)
35 35
36 if not kvm_utils.mount(src, mount_dest_dir, 'nfs', 'ro'): 36 if not virt_utils.mount(src, mount_dest_dir, 'nfs', 'ro'):
37 raise error.TestError('Could not mount NFS share %s to %s' % 37 raise error.TestError('Could not mount NFS share %s to %s' %
38 (src, mount_dest_dir)) 38 (src, mount_dest_dir))
39 39
40 # Check the existence of source image 40 # Check the existence of source image
41 if not os.path.exists(src_path): 41 if not os.path.exists(src_path):
42 raise error.TestError('Could not find %s in NFS share' % src_path) 42 raise error.TestError('Could not find %s in NFS share' % src_path)
43 43
44 logging.debug('Copying image %s...', image) 44 logging.debug('Copying image %s...', image)
45 utils.system(cmd) 45 utils.system(cmd)
OLDNEW
« no previous file with comments | « client/virt/tests/guest_test.py ('k') | client/virt/tests/iofuzz.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698