From 6f0890ea3a188382a16efc939f2e1c833f649add Mon Sep 17 00:00:00 2001 From: Abhi Date: Tue, 17 Apr 2012 11:44:11 +0530 Subject: [PATCH] bug CS-12812: XCP has get_mtime missing from the utils, added it here --- scripts/vm/hypervisor/xenserver/xcpserver/NFSSR.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/vm/hypervisor/xenserver/xcpserver/NFSSR.py b/scripts/vm/hypervisor/xenserver/xcpserver/NFSSR.py index 7a4d8a8dc71..f18a12e73e5 100755 --- a/scripts/vm/hypervisor/xenserver/xcpserver/NFSSR.py +++ b/scripts/vm/hypervisor/xenserver/xcpserver/NFSSR.py @@ -15,7 +15,7 @@ import SR, VDI, SRCommand, FileSR, util import errno -import os, re, sys +import os, re, sys, stat import time import xml.dom.minidom import xs_errors @@ -235,13 +235,16 @@ class NFSFileVDI(FileSR.FileVDI): except: util.logException("NFSSR:attach") pass - return super(NFSFileVDI, self).attach(sr_uuid, vdi_uuid) + def get_mtime(self, path): + st = util.ioretry_stat(lambda: os.stat(path)) + return st[stat.ST_MTIME] + def clone(self, sr_uuid, vdi_uuid): - timestamp_before = int(util.get_mtime(self.sr.path)) + timestamp_before = int(self.get_mtime(self.sr.path)) ret = super(NFSFileVDI, self).clone(sr_uuid, vdi_uuid) - timestamp_after = int(util.get_mtime(self.sr.path)) + timestamp_after = int(self.get_mtime(self.sr.path)) if timestamp_after == timestamp_before: util.SMlog("SR dir timestamp didn't change, updating") timestamp_after += 1