Exemple #1
0
def get_qos_specs_by_name(context, name):
    """Retrieves single qos specs by name."""
    if name is None:
        msg = _("name cannot be None")
        raise exception.InvalidQoSSpecs(reason=msg)

    return db.qos_specs_get_by_name(context, name)
Exemple #2
0
def get_qos_specs_by_name(context, name):
    """Retrieves single qos specs by name."""
    if name is None:
        msg = _("name cannot be None")
        raise exception.InvalidQoSSpecs(reason=msg)

    return db.qos_specs_get_by_name(context, name)
 def test_qos_specs_get_by_name(self):
     name = str(int(time.time()))
     value = dict(consumer="front-end", foo="Foo", bar="Bar")
     specs_id = self._create_qos_specs(name, value)
     specs = db.qos_specs_get_by_name(self.ctxt, name)
     del value["consumer"]
     expected = {"name": name, "id": specs_id, "consumer": "front-end", "specs": value}
     self.assertDictMatch(specs, expected)
 def test_qos_specs_get_by_name(self):
     name = str(int(time.time()))
     value = dict(consumer='front-end', foo='Foo', bar='Bar')
     specs_id = self._create_qos_specs(name, value)
     specs = db.qos_specs_get_by_name(self.ctxt, name)
     value.update(dict(id=specs_id))
     expected = {name: value}
     self.assertDictMatch(specs, expected)
Exemple #5
0
 def test_qos_specs_get_by_name(self):
     name = str(int(time.time()))
     value = dict(consumer='front-end',
                  foo='Foo', bar='Bar')
     specs_id = self._create_qos_specs(name, value)
     specs = db.qos_specs_get_by_name(self.ctxt, name)
     value.update(dict(id=specs_id))
     expected = {name: value}
     self.assertDictMatch(specs, expected)
    def test_qos_specs_create(self):
        # If there is qos specs with the same name exists,
        # a QoSSpecsExists exception will be raised.
        name = "QoSSpecsCreationTest"
        self._create_qos_specs(name)
        self.assertRaises(exception.QoSSpecsExists, db.qos_specs_create, self.ctxt, dict(name=name))

        specs_id = self._create_qos_specs("NewName")
        query_id = db.qos_specs_get_by_name(self.ctxt, "NewName")["id"]
        self.assertEqual(specs_id, query_id)
Exemple #7
0
    def test_qos_specs_create(self):
        # If there is qos specs with the same name exists,
        # a QoSSpecsExists exception will be raised.
        name = 'QoSSpecsCreationTest'
        self._create_qos_specs(name)
        self.assertRaises(exception.QoSSpecsExists, db.qos_specs_create,
                          self.ctxt, dict(name=name))

        specs_id = self._create_qos_specs('NewName')
        query_id = db.qos_specs_get_by_name(self.ctxt, 'NewName')['id']
        self.assertEqual(specs_id, query_id)
Exemple #8
0
 def test_qos_specs_get_by_name(self):
     name = str(int(time.time()))
     value = dict(consumer='front-end',
                  foo='Foo', bar='Bar')
     specs_id = self._create_qos_specs(name, value)
     specs = db.qos_specs_get_by_name(self.ctxt, name)
     del value['consumer']
     expected = {'name': name,
                 'id': specs_id,
                 'consumer': 'front-end',
                 'specs': value}
     self.assertDictMatch(expected, specs)
Exemple #9
0
 def test_qos_specs_get_by_name(self):
     name = str(int(time.time()))
     value = dict(consumer='front-end',
                  foo='Foo', bar='Bar')
     specs_id = self._create_qos_specs(name, value)
     specs = db.qos_specs_get_by_name(self.ctxt, name)
     del value['consumer']
     expected = {'name': name,
                 'id': specs_id,
                 'consumer': 'front-end',
                 'specs': value}
     self.assertDictMatch(specs, expected)
Exemple #10
0
    def test_qos_specs_create(self):
        # If there is qos specs with the same name exists,
        # a QoSSpecsExists exception will be raised.
        name = 'QoSSpecsCreationTest'
        self._create_qos_specs(name)
        self.assertRaises(exception.QoSSpecsExists,
                          db.qos_specs_create, self.ctxt, dict(name=name))

        specs_id = self._create_qos_specs('NewName')
        query_id = db.qos_specs_get_by_name(
            self.ctxt, 'NewName')['NewName']['id']
        self.assertEquals(specs_id, query_id)