Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so dont bother with any of their useless mail servers here and just use oauth login instead. Thank the nice Russians for causing that. :)

Paste

Pasted as Python by registered user geekatcmu ( 12 years ago )
def JobEnd(self, job):
        # If this is a verify job, bail
        if 'Verify' in job.Job: return
        if job.JobStatus in 'fAEe']: return # Don't do anything fancy with errored-out jobs

        # Let's truncate any new purged volumes in this pool.
         runcmd = 'purge volume acti allpools storage=%s\nquit\n' % job.Storage
        # We cannot use job.run() because it won't accept the action
        # keyword for purge.  Le sigh.
        try:
            so = subprocess.Popen('bconsole', shell=True,
                                  stdin=subprocess.PIPE,
                                  stdout=subprocess.PIPE).communicate(runcmd)[0]
        except Exception, e:
            job.JobReport = 'Bailing ... '
            job.JobReport = str(e)
            return
        job.JobReport = "ran volume purge command: %s" % so

        # This bit gives us a chance (5%) of running a verify job against this one.
        if choice(numarray) < 5:          # 5% chance of running a verify
            runcmd = 'run job=%s-Verify jobid=%d yes' % (job.Job, job.JobId)
            newjob = job.run(runcmd)
            job.JobReport="%s: jobid=%d\\n" % (runcmd, newjob)
        return

 

Revise this Paste

Children: 74190
Your Name: Code Language: