def test_volume_type_get_with_extra_specs(self):
        volume_type = db.volume_type_get(context.get_admin_context(),
                                         self.volume_type1_id)
        self.assertEquals(volume_type['extra_specs'], self.vol_type1_specs)

        volume_type = db.volume_type_get(context.get_admin_context(),
                                         self.vol_type2_id)
        self.assertEquals(volume_type['extra_specs'], {})
    def test_volume_type_get_with_extra_specs(self):
        volume_type = db.volume_type_get(
                            context.get_admin_context(),
                            self.volume_type1_id)
        self.assertEquals(volume_type['extra_specs'],
                          self.vol_type1_specs)

        volume_type = db.volume_type_get(
                            context.get_admin_context(),
                            self.vol_type2_id)
        self.assertEquals(volume_type['extra_specs'], {})
Пример #3
0
def get_volume_type(context, id):
    """Retrieves single volume type by id."""
    if id is None:
        raise exception.InvalidVolumeType(volume_type=id)

    try:
        return db.volume_type_get(context, id)
    except exception.DBError:
        raise exception.ApiError(_("Unknown volume type: %s") % id)
Пример #4
0
def get_volume_type(ctxt, id):
    """Retrieves single volume type by id."""
    if id is None:
        msg = _("id cannot be None")
        raise exception.InvalidVolumeType(reason=msg)

    if ctxt is None:
        ctxt = context.get_admin_context()

    return db.volume_type_get(ctxt, id)
Пример #5
0
def get_volume_type(ctxt, id):
    """Retrieves single volume type by id."""
    if id is None:
        msg = _("id cannot be None")
        raise exception.InvalidVolumeType(reason=msg)

    if ctxt is None:
        ctxt = context.get_admin_context()

    return db.volume_type_get(ctxt, id)
Пример #6
0
def get_volume_type(ctxt, id):
    """Retrieves single volume type by id."""
    if id is None:
        raise exception.InvalidVolumeType(volume_type=id)

    if ctxt is None:
        ctxt = context.get_admin_context()

    try:
        return db.volume_type_get(ctxt, id)
    except exception.DBError:
        raise exception.ApiError(_("Unknown volume type: %s") % id)