[PATCH] Using shutil.move to move result files in job.py

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since os.rename requires that the file is in the same partition with
the dest directory, we would get a python OSError if the result
directory is mounted to a nfs server (or different partition or
something else alike).

the traceback would be like:

  Traceback (most recent call last):
    File "/usr/local/kvm/kvm-test/bin/autotest", line 52, in ?
      options.log)
    File "/usr/local/kvm/kvm-test/bin/job.py", line 1274, in runjob
      myjob.complete(0)
    File "/usr/local/kvm/kvm-test/bin/job.py", line 798, in complete
    os.rename(self.state_file, dest)
  OSError: [Errno 18] Invalid cross-device link

Signed-off-by: Cao, Chen <kcao@xxxxxxxxxx>
---
 client/bin/job.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/client/bin/job.py b/client/bin/job.py
index a1c07cc..ebfb3a3 100755
--- a/client/bin/job.py
+++ b/client/bin/job.py
@@ -938,7 +938,7 @@ class base_job(object):
         """Clean up and exit"""
         # We are about to exit 'complete' so clean up the control file.
         dest = os.path.join(self.resultdir, os.path.basename(self.state_file))
-        os.rename(self.state_file, dest)
+        shutil.move(self.state_file, dest)
 
         self.harness.run_complete()
         self.disable_external_logging()
-- 
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux