Exemplo n.º 1
0
    def expire(self, context):
        """Expire reservations.

        Explores all currently existing reservations and rolls back
        any that have expired.

        :param context: The request context, for access checks.
        """

        db.reservation_expire(context)
Exemplo n.º 2
0
    def expire(self, context):
        """Expire reservations.

        Explores all currently existing reservations and rolls back
        any that have expired.

        :param context: The request context, for access checks.
        """

        db.reservation_expire(context)
Exemplo n.º 3
0
    def test_reservation_expire(self):
        self.values["expire"] = datetime.datetime.utcnow() + datetime.timedelta(days=1)
        _quota_reserve(self.ctxt, "project1")
        db.reservation_expire(self.ctxt)

        expected = {
            "project_id": "project1",
            "gigabytes": {"reserved": 0, "in_use": 0},
            "volumes": {"reserved": 0, "in_use": 0},
        }
        self.assertEqual(expected, db.quota_usage_get_all_by_project(self.ctxt, "project1"))
Exemplo n.º 4
0
    def test_reservation_expire(self):
        self.values['expire'] = datetime.datetime.utcnow() + \
            datetime.timedelta(days=1)
        reservations = _quota_reserve(self.ctxt, 'project1')
        db.reservation_expire(self.ctxt)

        expected = {'project_id': 'project1',
                    'gigabytes': {'reserved': 0, 'in_use': 0},
                    'volumes': {'reserved': 0, 'in_use': 0}}
        self.assertEqual(expected,
                         db.quota_usage_get_all_by_project(
                             self.ctxt,
                             'project1'))