コード例 #1
0
ファイル: test_qos_specs.py プロジェクト: xin3liang/cinder
 def test_associate_type_with_qos(self):
     self.assertRaises(exception.VolumeTypeNotFound,
                       db.volume_type_qos_associate, self.ctxt,
                       fake.VOLUME_ID, fake.QOS_SPEC_ID)
     type_id = volume_types.create(self.ctxt, 'TypeName')['id']
     specs_id = self._create_qos_specs('FakeQos')
     db.volume_type_qos_associate(self.ctxt, type_id, specs_id)
     res = db.qos_specs_associations_get(self.ctxt, specs_id)
     self.assertEqual(1, len(res))
     self.assertEqual(type_id, res[0]['id'])
     self.assertEqual(specs_id, res[0]['qos_specs_id'])
コード例 #2
0
ファイル: test_qos_specs.py プロジェクト: pipul/cinder
 def test_associate_type_with_qos(self):
     self.assertRaises(exception.VolumeTypeNotFound,
                       db.volume_type_qos_associate, self.ctxt,
                       'Fake-VOLID', 'Fake-QOSID')
     type_id = volume_types.create(self.ctxt, 'TypeName')['id']
     specs_id = self._create_qos_specs('FakeQos')
     db.volume_type_qos_associate(self.ctxt, type_id, specs_id)
     res = db.qos_specs_associations_get(self.ctxt, specs_id)
     self.assertEqual(len(res), 1)
     self.assertEqual(res[0]['id'], type_id)
     self.assertEqual(res[0]['qos_specs_id'], specs_id)
コード例 #3
0
ファイル: test_qos_specs.py プロジェクト: Datera/cinder
 def test_associate_type_with_qos(self):
     self.assertRaises(exception.VolumeTypeNotFound,
                       db.volume_type_qos_associate,
                       self.ctxt, 'Fake-VOLID', 'Fake-QOSID')
     type_id = volume_types.create(self.ctxt, 'TypeName')['id']
     specs_id = self._create_qos_specs('FakeQos')
     db.volume_type_qos_associate(self.ctxt, type_id, specs_id)
     res = db.qos_specs_associations_get(self.ctxt, specs_id)
     self.assertEqual(1, len(res))
     self.assertEqual(type_id, res[0]['id'])
     self.assertEqual(specs_id, res[0]['qos_specs_id'])
コード例 #4
0
 def test_associate_type_with_qos(self):
     self.assertRaises(
         exception.VolumeTypeNotFound, db.volume_type_qos_associate, self.ctxt, "Fake-VOLID", "Fake-QOSID"
     )
     type_id = volume_types.create(self.ctxt, "TypeName")["id"]
     specs_id = self._create_qos_specs("FakeQos")
     db.volume_type_qos_associate(self.ctxt, type_id, specs_id)
     res = db.qos_specs_associations_get(self.ctxt, specs_id)
     self.assertEqual(len(res), 1)
     self.assertEqual(res[0]["id"], type_id)
     self.assertEqual(res[0]["qos_specs_id"], specs_id)
コード例 #5
0
ファイル: test_qos_specs.py プロジェクト: pipul/cinder
    def test_qos_specs_disassociate(self):
        type_id = volume_types.create(self.ctxt, 'TypeName')['id']
        specs_id = self._create_qos_specs('FakeQos')
        db.volume_type_qos_associate(self.ctxt, type_id, specs_id)
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(res[0]['id'], type_id)
        self.assertEqual(res[0]['qos_specs_id'], specs_id)

        db.qos_specs_disassociate(self.ctxt, specs_id, type_id)
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(len(res), 0)
        res = db.volume_type_get(self.ctxt, type_id)
        self.assertEqual(res['qos_specs_id'], None)
コード例 #6
0
ファイル: test_qos_specs.py プロジェクト: Datera/cinder
    def test_qos_specs_disassociate(self):
        type_id = volume_types.create(self.ctxt, 'TypeName')['id']
        specs_id = self._create_qos_specs('FakeQos')
        db.volume_type_qos_associate(self.ctxt, type_id, specs_id)
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(type_id, res[0]['id'])
        self.assertEqual(specs_id, res[0]['qos_specs_id'])

        db.qos_specs_disassociate(self.ctxt, specs_id, type_id)
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(0, len(res))
        res = db.volume_type_get(self.ctxt, type_id)
        self.assertIsNone(res['qos_specs_id'])
コード例 #7
0
    def test_qos_specs_disassociate(self):
        type_id = volume_types.create(self.ctxt, "TypeName")["id"]
        specs_id = self._create_qos_specs("FakeQos")
        db.volume_type_qos_associate(self.ctxt, type_id, specs_id)
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(res[0]["id"], type_id)
        self.assertEqual(res[0]["qos_specs_id"], specs_id)

        db.qos_specs_disassociate(self.ctxt, specs_id, type_id)
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(len(res), 0)
        res = db.volume_type_get(self.ctxt, type_id)
        self.assertIsNone(res["qos_specs_id"])
コード例 #8
0
    def test_qos_associations_get(self):
        self.assertRaises(exception.QoSSpecsNotFound, db.qos_specs_associations_get, self.ctxt, "Fake-UUID")

        type_id = volume_types.create(self.ctxt, "TypeName")["id"]
        specs_id = self._create_qos_specs("FakeQos")
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(len(res), 0)

        db.volume_type_qos_associate(self.ctxt, type_id, specs_id)
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(len(res), 1)
        self.assertEqual(res[0]["id"], type_id)
        self.assertEqual(res[0]["qos_specs_id"], specs_id)

        type0_id = volume_types.create(self.ctxt, "Type0Name")["id"]
        db.volume_type_qos_associate(self.ctxt, type0_id, specs_id)
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(len(res), 2)
        self.assertEqual(res[0]["qos_specs_id"], specs_id)
        self.assertEqual(res[1]["qos_specs_id"], specs_id)
コード例 #9
0
ファイル: test_qos_specs.py プロジェクト: pipul/cinder
    def test_qos_associations_get(self):
        self.assertRaises(exception.QoSSpecsNotFound,
                          db.qos_specs_associations_get, self.ctxt,
                          'Fake-UUID')

        type_id = volume_types.create(self.ctxt, 'TypeName')['id']
        specs_id = self._create_qos_specs('FakeQos')
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(len(res), 0)

        db.volume_type_qos_associate(self.ctxt, type_id, specs_id)
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(len(res), 1)
        self.assertEqual(res[0]['id'], type_id)
        self.assertEqual(res[0]['qos_specs_id'], specs_id)

        type0_id = volume_types.create(self.ctxt, 'Type0Name')['id']
        db.volume_type_qos_associate(self.ctxt, type0_id, specs_id)
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(len(res), 2)
        self.assertEqual(res[0]['qos_specs_id'], specs_id)
        self.assertEqual(res[1]['qos_specs_id'], specs_id)
コード例 #10
0
ファイル: test_qos_specs.py プロジェクト: Datera/cinder
    def test_qos_associations_get(self):
        self.assertRaises(exception.QoSSpecsNotFound,
                          db.qos_specs_associations_get,
                          self.ctxt, 'Fake-UUID')

        type_id = volume_types.create(self.ctxt, 'TypeName')['id']
        specs_id = self._create_qos_specs('FakeQos')
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(0, len(res))

        db.volume_type_qos_associate(self.ctxt, type_id, specs_id)
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(1, len(res))
        self.assertEqual(type_id, res[0]['id'])
        self.assertEqual(specs_id, res[0]['qos_specs_id'])

        type0_id = volume_types.create(self.ctxt, 'Type0Name')['id']
        db.volume_type_qos_associate(self.ctxt, type0_id, specs_id)
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(2, len(res))
        self.assertEqual(specs_id, res[0]['qos_specs_id'])
        self.assertEqual(specs_id, res[1]['qos_specs_id'])
コード例 #11
0
ファイル: test_qos_specs.py プロジェクト: xin3liang/cinder
    def test_qos_associations_get(self):
        self.assertRaises(exception.QoSSpecsNotFound,
                          db.qos_specs_associations_get, self.ctxt,
                          fake.WILL_NOT_BE_FOUND_ID)

        type_id = volume_types.create(self.ctxt, 'TypeName')['id']
        specs_id = self._create_qos_specs('FakeQos')
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(0, len(res))

        db.volume_type_qos_associate(self.ctxt, type_id, specs_id)
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(1, len(res))
        self.assertEqual(type_id, res[0]['id'])
        self.assertEqual(specs_id, res[0]['qos_specs_id'])

        type0_id = volume_types.create(self.ctxt, 'Type0Name')['id']
        db.volume_type_qos_associate(self.ctxt, type0_id, specs_id)
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(2, len(res))
        self.assertEqual(specs_id, res[0]['qos_specs_id'])
        self.assertEqual(specs_id, res[1]['qos_specs_id'])
コード例 #12
0
ファイル: test_qos_specs.py プロジェクト: pipul/cinder
    def test_qos_specs_disassociate_all(self):
        specs_id = self._create_qos_specs('FakeQos')
        type1_id = volume_types.create(self.ctxt, 'Type1Name')['id']
        type2_id = volume_types.create(self.ctxt, 'Type2Name')['id']
        type3_id = volume_types.create(self.ctxt, 'Type3Name')['id']
        db.volume_type_qos_associate(self.ctxt, type1_id, specs_id)
        db.volume_type_qos_associate(self.ctxt, type2_id, specs_id)
        db.volume_type_qos_associate(self.ctxt, type3_id, specs_id)

        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(len(res), 3)

        db.qos_specs_disassociate_all(self.ctxt, specs_id)
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(len(res), 0)
コード例 #13
0
ファイル: test_qos_specs.py プロジェクト: Datera/cinder
    def test_qos_specs_disassociate_all(self):
        specs_id = self._create_qos_specs('FakeQos')
        type1_id = volume_types.create(self.ctxt, 'Type1Name')['id']
        type2_id = volume_types.create(self.ctxt, 'Type2Name')['id']
        type3_id = volume_types.create(self.ctxt, 'Type3Name')['id']
        db.volume_type_qos_associate(self.ctxt, type1_id, specs_id)
        db.volume_type_qos_associate(self.ctxt, type2_id, specs_id)
        db.volume_type_qos_associate(self.ctxt, type3_id, specs_id)

        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(3, len(res))

        db.qos_specs_disassociate_all(self.ctxt, specs_id)
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(0, len(res))
コード例 #14
0
    def test_qos_specs_disassociate_all(self):
        specs_id = self._create_qos_specs("FakeQos")
        type1_id = volume_types.create(self.ctxt, "Type1Name")["id"]
        type2_id = volume_types.create(self.ctxt, "Type2Name")["id"]
        type3_id = volume_types.create(self.ctxt, "Type3Name")["id"]
        db.volume_type_qos_associate(self.ctxt, type1_id, specs_id)
        db.volume_type_qos_associate(self.ctxt, type2_id, specs_id)
        db.volume_type_qos_associate(self.ctxt, type3_id, specs_id)

        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(len(res), 3)

        db.qos_specs_disassociate_all(self.ctxt, specs_id)
        res = db.qos_specs_associations_get(self.ctxt, specs_id)
        self.assertEqual(len(res), 0)