示例#1
0
文件: FileSR.py 项目: xcp-ng/sm
    def _kickGC(self):
        # don't bother if an instance already running (this is just an
        # optimization to reduce the overhead of forking a new process if we
        # don't have to, but the process will check the lock anyways)
        lockRunning = Lock(cleanup.LOCK_TYPE_RUNNING, self.uuid)
        if not lockRunning.acquireNoblock():
            if cleanup.should_preempt(self.session, self.uuid):
                util.SMlog(
                    "Aborting currently-running coalesce of garbage VDI")
                try:
                    if not cleanup.abort(self.uuid, soft=True):
                        util.SMlog("The GC has already been scheduled to "
                                   "re-start")
                except util.CommandException as e:
                    if e.code != errno.ETIMEDOUT:
                        raise
                    util.SMlog('failed to abort the GC')
                finally:
                    return
            else:
                util.SMlog("A GC instance already running, not kicking")
                return
        else:
            lockRunning.release()

        util.SMlog("Kicking GC")
        cleanup.gc(self.session, self.uuid, True)
示例#2
0
文件: FileSR.py 项目: MarkSymsCtx/sm
 def _kickGC(self):
     # don't bother if an instance already running (this is just an
     # optimization to reduce the overhead of forking a new process if we
     # don't have to, but the process will check the lock anyways)
     lockRunning = Lock(cleanup.LOCK_TYPE_RUNNING, self.uuid)
     if not lockRunning.acquireNoblock():
         if cleanup.should_preempt(self.session, self.uuid):
             util.SMlog("Aborting currently-running coalesce of garbage VDI")
             try:
                 if not cleanup.abort(self.uuid, soft=True):
                     util.SMlog("The GC has already been scheduled to " "re-start")
             except util.CommandException, e:
                 if e.code != errno.ETIMEDOUT:
                     raise
                 util.SMlog("failed to abort the GC")
             finally:
示例#3
0
    def _kickGC(self):
        # don't bother if an instance already running (this is just an 
        # optimization to reduce the overhead of forking a new process if we 
        # don't have to, but the process will check the lock anyways)
        lockRunning = Lock(cleanup.LOCK_TYPE_RUNNING, self.uuid) 
        if not lockRunning.acquireNoblock():
            if cleanup.should_preempt(self.session, self.uuid):
                util.SMlog("Aborting currently-running coalesce of garbage VDI")
                cleanup.abort(self.uuid)
            else:
                util.SMlog("A GC instance already running, not kicking")
                return
        else:
            lockRunning.release()

        util.SMlog("Kicking GC")
        cleanup.gc(self.session, self.uuid, True)
示例#4
0
    def _kickGC(self):
        # don't bother if an instance already running (this is just an
        # optimization to reduce the overhead of forking a new process if we
        # don't have to, but the process will check the lock anyways)
        lockRunning = Lock(cleanup.LOCK_TYPE_RUNNING, self.uuid)
        if not lockRunning.acquireNoblock():
            if cleanup.should_preempt(self.session, self.uuid):
                util.SMlog(
                    "Aborting currently-running coalesce of garbage VDI")
                cleanup.abort(self.uuid)
            else:
                util.SMlog("A GC instance already running, not kicking")
                return
        else:
            lockRunning.release()

        util.SMlog("Kicking GC")
        cleanup.gc(self.session, self.uuid, True)