コード例 #1
0
ファイル: test_db_api.py プロジェクト: medlefsen/cinder
 def test_reservation_rollback(self):
     reservations = _quota_reserve(self.ctxt, 'project1')
     expected = {
         'project_id': 'project1',
         'volumes': {
             'reserved': 1,
             'in_use': 0
         },
         'gigabytes': {
             'reserved': 2,
             'in_use': 0
         },
     }
     self.assertEqual(
         expected, db.quota_usage_get_all_by_project(self.ctxt, 'project1'))
     db.reservation_get(self.ctxt, reservations[0])
     db.reservation_rollback(self.ctxt, reservations, 'project1')
     self.assertRaises(exception.ReservationNotFound, db.reservation_get,
                       self.ctxt, reservations[0])
     expected = {
         'project_id': 'project1',
         'volumes': {
             'reserved': 0,
             'in_use': 0
         },
         'gigabytes': {
             'reserved': 0,
             'in_use': 0
         },
     }
     self.assertEqual(
         expected, db.quota_usage_get_all_by_project(self.ctxt, 'project1'))
コード例 #2
0
ファイル: test_db_api.py プロジェクト: afliu/cinder
 def test_reservation_get_all_by_project(self):
     reservations = _quota_reserve(self.ctxt, 'project1')
     r1 = db.reservation_get(self.ctxt, reservations[0])
     r2 = db.reservation_get(self.ctxt, reservations[1])
     expected = {'project_id': 'project1',
                 r1['resource']: {r1['uuid']: r1['delta']},
                 r2['resource']: {r2['uuid']: r2['delta']}}
     self.assertEqual(expected, db.reservation_get_all_by_project(
         self.ctxt, 'project1'))
コード例 #3
0
ファイル: test_db_api.py プロジェクト: dtroyer/cinder
 def test_reservation_get_all_by_project(self):
     reservations = _quota_reserve(self.ctxt, "project1")
     r1 = db.reservation_get(self.ctxt, reservations[0])
     r2 = db.reservation_get(self.ctxt, reservations[1])
     expected = {
         "project_id": "project1",
         r1["resource"]: {r1["uuid"]: r1["delta"]},
         r2["resource"]: {r2["uuid"]: r2["delta"]},
     }
     self.assertEqual(expected, db.reservation_get_all_by_project(self.ctxt, "project1"))
コード例 #4
0
ファイル: test_db_api.py プロジェクト: medlefsen/cinder
 def test_reservation_get_all_by_project(self):
     reservations = _quota_reserve(self.ctxt, 'project1')
     r1 = db.reservation_get(self.ctxt, reservations[0])
     r2 = db.reservation_get(self.ctxt, reservations[1])
     expected = {
         'project_id': 'project1',
         r1['resource']: {
             r1['uuid']: r1['delta']
         },
         r2['resource']: {
             r2['uuid']: r2['delta']
         }
     }
     self.assertEqual(
         expected, db.reservation_get_all_by_project(self.ctxt, 'project1'))
コード例 #5
0
ファイル: test_db_api.py プロジェクト: medlefsen/cinder
 def test_quota_reserve(self):
     reservations = _quota_reserve(self.ctxt, 'project1')
     self.assertEqual(len(reservations), 2)
     res_names = ['gigabytes', 'volumes']
     for uuid in reservations:
         reservation = db.reservation_get(self.ctxt, uuid)
         self.assertIn(reservation.resource, res_names)
         res_names.remove(reservation.resource)
コード例 #6
0
ファイル: test_db_api.py プロジェクト: niuzhenguo/cinder
 def test_quota_reserve(self):
     reservations = _quota_reserve(self.ctxt, 'project1')
     self.assertEqual(len(reservations), 2)
     res_names = ['gigabytes', 'volumes']
     for uuid in reservations:
         reservation = db.reservation_get(self.ctxt, uuid)
         self.assertTrue(reservation.resource in res_names)
         res_names.remove(reservation.resource)
コード例 #7
0
ファイル: test_db_api.py プロジェクト: cdwertmann/cinder
 def test_quota_reserve(self):
     reservations = _quota_reserve(self.ctxt, 'project1')
     self.assertEqual(len(reservations), 3)
     res_names = ['res0', 'res1', 'res2']
     for uuid in reservations:
         reservation = db.reservation_get(self.ctxt, uuid)
         self.assertTrue(reservation.resource in res_names)
         res_names.remove(reservation.resource)
コード例 #8
0
ファイル: test_db_api.py プロジェクト: dtroyer/cinder
 def test_quota_reserve(self):
     reservations = _quota_reserve(self.ctxt, "project1")
     self.assertEqual(len(reservations), 2)
     res_names = ["gigabytes", "volumes"]
     for uuid in reservations:
         reservation = db.reservation_get(self.ctxt, uuid)
         self.assertIn(reservation.resource, res_names)
         res_names.remove(reservation.resource)
コード例 #9
0
ファイル: test_db_api.py プロジェクト: dtroyer/cinder
 def test_reservation_rollback(self):
     reservations = _quota_reserve(self.ctxt, "project1")
     expected = {
         "project_id": "project1",
         "volumes": {"reserved": 1, "in_use": 0},
         "gigabytes": {"reserved": 2, "in_use": 0},
     }
     self.assertEqual(expected, db.quota_usage_get_all_by_project(self.ctxt, "project1"))
     db.reservation_get(self.ctxt, reservations[0])
     db.reservation_rollback(self.ctxt, reservations, "project1")
     self.assertRaises(exception.ReservationNotFound, db.reservation_get, self.ctxt, reservations[0])
     expected = {
         "project_id": "project1",
         "volumes": {"reserved": 0, "in_use": 0},
         "gigabytes": {"reserved": 0, "in_use": 0},
     }
     self.assertEqual(expected, db.quota_usage_get_all_by_project(self.ctxt, "project1"))
コード例 #10
0
ファイル: test_db_api.py プロジェクト: ArikaChen/cinder
 def test_quota_reserve(self):
     reservations = _quota_reserve(self.ctxt, 'project1')
     self.assertEqual(len(reservations), 3)
     res_names = ['res0', 'res1', 'res2']
     for uuid in reservations:
         reservation = db.reservation_get(self.ctxt, uuid)
         self.assertTrue(reservation.resource in res_names)
         res_names.remove(reservation.resource)
コード例 #11
0
ファイル: test_db_api.py プロジェクト: cdwertmann/cinder
 def test_reservation_commit(self):
     reservations = _quota_reserve(self.ctxt, 'project1')
     expected = {
         'project_id': 'project1',
         'res0': {
             'reserved': 0,
             'in_use': 0
         },
         'res1': {
             'reserved': 1,
             'in_use': 1
         },
         'res2': {
             'reserved': 2,
             'in_use': 2
         }
     }
     self.assertEqual(
         expected, db.quota_usage_get_all_by_project(self.ctxt, 'project1'))
     db.reservation_get(self.ctxt, reservations[0])
     db.reservation_commit(self.ctxt, reservations, 'project1')
     self.assertRaises(exception.ReservationNotFound, db.reservation_get,
                       self.ctxt, reservations[0])
     expected = {
         'project_id': 'project1',
         'res0': {
             'reserved': 0,
             'in_use': 0
         },
         'res1': {
             'reserved': 0,
             'in_use': 2
         },
         'res2': {
             'reserved': 0,
             'in_use': 4
         }
     }
     self.assertEqual(
         expected, db.quota_usage_get_all_by_project(self.ctxt, 'project1'))
コード例 #12
0
ファイル: test_db_api.py プロジェクト: niuzhenguo/cinder
 def test_reservation_commit(self):
     reservations = _quota_reserve(self.ctxt, 'project1')
     expected = {'project_id': 'project1',
                 'volumes': {'reserved': 1, 'in_use': 0},
                 'gigabytes': {'reserved': 2, 'in_use': 0},
                 }
     self.assertEqual(expected,
                      db.quota_usage_get_all_by_project(
                          self.ctxt, 'project1'))
     db.reservation_get(self.ctxt, reservations[0])
     db.reservation_commit(self.ctxt, reservations, 'project1')
     self.assertRaises(exception.ReservationNotFound,
                       db.reservation_get,
                       self.ctxt,
                       reservations[0])
     expected = {'project_id': 'project1',
                 'volumes': {'reserved': 0, 'in_use': 1},
                 'gigabytes': {'reserved': 0, 'in_use': 2},
                 }
     self.assertEqual(expected,
                      db.quota_usage_get_all_by_project(
                          self.ctxt,
                          'project1'))
コード例 #13
0
ファイル: test_db_api.py プロジェクト: ArikaChen/cinder
 def test_reservation_rollback(self):
     reservations = _quota_reserve(self.ctxt, 'project1')
     expected = {'project_id': 'project1',
                 'res0': {'reserved': 0, 'in_use': 0},
                 'res1': {'reserved': 1, 'in_use': 1},
                 'res2': {'reserved': 2, 'in_use': 2}}
     self.assertEqual(expected,
                      db.quota_usage_get_all_by_project(
                          self.ctxt,
                          'project1'))
     db.reservation_get(self.ctxt, reservations[0])
     db.reservation_rollback(self.ctxt, reservations, 'project1')
     self.assertRaises(exception.ReservationNotFound,
                       db.reservation_get,
                       self.ctxt,
                       reservations[0])
     expected = {'project_id': 'project1',
                 'res0': {'reserved': 0, 'in_use': 0},
                 'res1': {'reserved': 0, 'in_use': 1},
                 'res2': {'reserved': 0, 'in_use': 2}}
     self.assertEqual(expected,
                      db.quota_usage_get_all_by_project(
                          self.ctxt,
                          'project1'))
コード例 #14
0
ファイル: test_db_api.py プロジェクト: medlefsen/cinder
 def test_reservation_get(self):
     reservation = db.reservation_create(self.ctxt, **self.values)
     reservation_db = db.reservation_get(self.ctxt, self.values['uuid'])
     self._assertEqualObjects(reservation, reservation_db)
コード例 #15
0
ファイル: test_db_api.py プロジェクト: niuzhenguo/cinder
 def test_reservation_get(self):
     reservation = db.reservation_create(self.ctxt, **self.values)
     reservation_db = db.reservation_get(self.ctxt, self.values['uuid'])
     self._assertEqualObjects(reservation, reservation_db)