X-Git-Url: http://git.onelab.eu/?p=sface.git;a=blobdiff_plain;f=sface%2Fsfiprocess.py;h=35f0ca9d8650f7a8df42ffd12390bf6e1641e221;hp=ee49eb73cf85b6963d0e92e956639cbb8e2a2f28;hb=d7a2606ffd441335cd25b0185cb077c6cb91e795;hpb=dc5a4a16b0819bc27efd1f77d632a76463db82c0 diff --git a/sface/sfiprocess.py b/sface/sfiprocess.py index ee49eb7..35f0ca9 100644 --- a/sface/sfiprocess.py +++ b/sface/sfiprocess.py @@ -1,11 +1,9 @@ import os +import pickle import sys import time -from distutils.version import LooseVersion -from sfa.util.version import version_core - from PyQt4.QtCore import * from sface.config import config from sface.xmlrpcwindow import get_tracker, XmlrpcReader @@ -66,7 +64,15 @@ class SfiProcess(QObject): output = self.process.readAllStandardOutput() self.output = self.output + output if config.debug: - print output + try: + print output + except IOError, e: + if (e.errno == 4): + # XXX why is this happening?? + print "*** caught EINTR" + else: + raise + def processStandardError(self): print self.process.readAllStandardError() @@ -141,14 +147,10 @@ class SfiProcess(QObject): def listRecords(self, hrn, rectype=None, filename=None): args = ["-u", config.getUser(), "-a", config.getAuthority(), - "-r", config.getRegistry(), "-s", config.getSlicemgr(), "list", hrn] + "-r", config.getRegistry(), "-s", config.getSlicemgr(), "list", "-F", "xmllist", hrn] if not filename: - if LooseVersion(version_core()['code_tag']) <= LooseVersion("1.0-35"): - # DEPRECATED - filename = config.getAuthorityListRecordFile() - else: - filename = config.getAuthorityListFile() + filename = config.getAuthorityListFile() # we can't tell whether SFI will create one file or many, so delete # leftovers from last time, then we'll know what we got, after we get it. @@ -181,7 +183,7 @@ class SfiProcess(QObject): def getAuthorityRecord(self): self.getRecord(config.getAuthority(), config.getAuthorityRecordFile()) - def applyRSpec(self, rspec): + def applyRSpec(self, rspec, aggAddr=None, aggPort=None, saveObtained=True): # that's what we pass, like in what we'd like to get requested = config.getSliceRSpecFile() + "_new" # that's what we actually receive @@ -189,9 +191,31 @@ class SfiProcess(QObject): obtained = config.getSliceRSpecFile() rspec.save(requested) args = ["-u", config.getUser(), "-a", config.getAuthority(), - "-r", config.getRegistry(), "-s", config.getSlicemgr(), "create", - "-o", obtained, - config.getSlice(), requested] + "-r", config.getRegistry(), "-s", config.getSlicemgr(), "create"] + + if saveObtained: + args = args + ["-o", obtained] + + if aggAddr: + args = args + ["-a", aggAddr, "-p", str(aggPort)] + + args = args + [config.getSlice(), requested] + + self.__init_command(args) + self.start() + + def deleteSlivers(self, slice=None, aggAddr=None, aggPort=None): + if not slice: + slice = config.getSlice() + + args = ["-u", config.getUser(), "-a", config.getAuthority(), + "-r", config.getRegistry(), "-s", config.getSlicemgr(), "delete"] + + if aggAddr: + args = args + ["-a", aggAddr, "-p", str(aggPort)] + + args = args + [slice] + self.__init_command(args) self.start() @@ -207,10 +231,42 @@ class SfiProcess(QObject): self.__init_command(args) self.start() - def renewSlivers(self, expiration): + def removeRecord(self, hrn): + args = ["-u", config.getUser(), "-a", config.getAuthority(), + "-r", config.getRegistry(), "-s", config.getSlicemgr(), "remove", hrn] + self.__init_command(args) + self.start() + + def renewSlivers(self, expiration, slice=None): + if not slice: + slice = config.getSlice() + args = ["-u", config.getUser(), "-a", config.getAuthority(), "-r", config.getRegistry(), "-s", config.getSlicemgr(), "renew", - config.getSlice(), expiration] + slice, expiration] + self.__init_command(args) + self.start() + + def sliverStatus(self, slice=None, filename=None): + if not slice: + slice = config.getSlice() + + if not filename: + filename = config.fullpath(slice+".sliverstatus") + + args = ["-u", config.getUser(), "-a", config.getAuthority(), + "-r", config.getRegistry(), "-s", config.getSlicemgr(), "status", + "-o", filename, "-F", "pickled", slice] + self.__init_command(args) + self.start() + + def getSliceMgrVersion(self, filename=None): + if not filename: + filename = config.fullpath("slicemgr.version") + + args = ["-u", config.getUser(), "-a", config.getAuthority(), + "-r", config.getRegistry(), "-s", config.getSlicemgr(), "version", + "-o", filename, "-F", "pickled",] self.__init_command(args) self.start()