Esempio n. 1
0
    def pub_RenewSliver(self, slice_urn, credentials, exptime, options):
        """Renew the reservation for resources in this slice"""
        try:
            if CredVerifier.checkValid(credentials, "renewsliver", slice_urn):
                self.recordAction("renewsliver", credentials, slice_urn)
                creds = CredVerifier.fromStrings(credentials, "renewsliver",
                                                 slice_urn)
                sliver_urn = foam.lib.renewSliver(slice_urn, creds, exptime)

                data = GeniDB.getSliverData(sliver_urn, True)
                foam.task.emailRenewSliver(data)

                propertyList = self.buildPropertyList(GENI_ERROR_CODE.SUCCESS,
                                                      value=True)
        except foam.lib.BadSliverExpiration as e:
            msg = "Bad expiration request: %s" % (e.msg)
            propertyList = self.buildPropertyList(GENI_ERROR_CODE.ERROR,
                                                  output=msg)
            e.log(self._log, msg, logging.INFO)
        except Exception:
            msg = "Exception"
            propertyList = self.buildPropertyList(GENI_ERROR_CODE.ERROR,
                                                  output=msg)
            self._log.exception("Exception")
        finally:
            return propertyList
Esempio n. 2
0
def createSliver (slice_urn, credentials, rspec, user_info):
  flog = logging.getLogger('foam')

  if GeniDB.sliceExists(slice_urn):
    raise DuplicateSliver(slice_urn)

  creds = CredVerifier.fromStrings(credentials, "createsliver", slice_urn)
  try:
    s = StringIO(rspec)
    rspec_dom = ET.parse(s)
  except Exception, exc:
    flog.exception("XML rspec parsing error")
    raise RspecParseError(slice_urn, str(exc))
Esempio n. 3
0
def createSliver(slice_urn, credentials, rspec, user_info):
    flog = logging.getLogger('foam')

    if GeniDB.sliceExists(slice_urn):
        raise DuplicateSliver(slice_urn)

    creds = CredVerifier.fromStrings(credentials, "createsliver", slice_urn)
    try:
        s = StringIO(rspec)
        rspec_dom = ET.parse(s)
    except Exception, exc:
        flog.exception("XML rspec parsing error")
        raise RspecParseError(slice_urn, str(exc))
Esempio n. 4
0
  def pub_RenewSliver (self, slice_urn, credentials, exptime):
    try:
      if CredVerifier.checkValid(credentials, "renewsliver", slice_urn):
        self.recordAction("renewsliver", credentials, slice_urn)
        creds = CredVerifier.fromStrings(credentials, "renewsliver", slice_urn)
        sliver_urn = foam.lib.renewSliver(slice_urn, creds, exptime)

        data = GeniDB.getSliverData(sliver_urn, True)
        foam.task.emailRenewSliver(data)

        return True
      return False
    except foam.lib.BadSliverExpiration, e:
      self._log.info("Bad expiration request: %s" % (e.msg))
      e._foam_logged = True
      raise e
Esempio n. 5
0
  def pub_RenewSliver (self, slice_urn, credentials, exptime, options):
    """Renew the reservation for resources in this slice"""
    try:
      if CredVerifier.checkValid(credentials, "renewsliver", slice_urn):
        self.recordAction("renewsliver", credentials, slice_urn)
        creds = CredVerifier.fromStrings(credentials, "renewsliver", slice_urn)
        sliver_urn = foam.lib.renewSliver(slice_urn, creds, exptime)

        data = GeniDB.getSliverData(sliver_urn, True)
        foam.task.emailRenewSliver(data)

        propertyList = self.buildPropertyList(GENI_ERROR_CODE.SUCCESS, value=True)
    except foam.lib.BadSliverExpiration as e:
      msg = "Bad expiration request: %s" % (e.msg)
      propertyList = self.buildPropertyList(GENI_ERROR_CODE.ERROR, output=msg)
      e.log(self._log, msg, logging.INFO)
    except Exception:
      msg = "Exception"
      propertyList = self.buildPropertyList(GENI_ERROR_CODE.ERROR, output=msg)
      self._log.exception("Exception")
    finally:
      return propertyList