Beispiel #1
0
def disassociate_all(context, specs_id):
    """Disassociate qos_specs from all entities."""
    try:
        db.qos_specs_disassociate_all(context, specs_id)
    except db_exc.DBError as e:
        LOG.exception(_('DB error: %s') % e)
        LOG.warn(_('Failed to disassociate qos specs %s.') % specs_id)
        raise exception.QoSSpecsDisassociateFailed(specs_id=specs_id,
                                                   type_id=None)
Beispiel #2
0
def disassociate_all(context, specs_id):
    """Disassociate qos_specs from all entities."""
    try:
        get_qos_specs(context, specs_id)
        db.qos_specs_disassociate_all(context, specs_id)
    except db_exc.DBError:
        LOG.exception('DB error:')
        LOG.warning('Failed to disassociate qos specs %s.', specs_id)
        raise exception.QoSSpecsDisassociateFailed(specs_id=specs_id,
                                                   type_id=None)
Beispiel #3
0
def disassociate_qos_specs(context, specs_id, type_id):
    """Disassociate qos_specs from volume type."""
    try:
        get_qos_specs(context, specs_id)
        db.qos_specs_disassociate(context, specs_id, type_id)
    except db_exc.DBError as e:
        LOG.exception(_('DB error: %s') % e)
        LOG.warn(_('Failed to disassociate qos specs '
                   '%(id)s with type: %(vol_type_id)s') %
                 dict(id=specs_id, vol_type_id=type_id))
        raise exception.QoSSpecsDisassociateFailed(specs_id=specs_id,
                                                   type_id=type_id)
Beispiel #4
0
def return_associate_qos_specs(context, id, type_id):
    if id == "111":
        raise exception.QoSSpecsNotFound(specs_id=id)
    elif id == "222":
        raise exception.QoSSpecsAssociateFailed(specs_id=id, type_id=type_id)
    elif id == "333":
        raise exception.QoSSpecsDisassociateFailed(specs_id=id,
                                                   type_id=type_id)

    if type_id == "1234":
        raise exception.VolumeTypeNotFound(volume_type_id=type_id)

    pass
Beispiel #5
0
def return_associate_qos_specs(context, id, type_id):
    if id == fake.WILL_NOT_BE_FOUND_ID:
        raise exception.QoSSpecsNotFound(specs_id=id)
    elif id == fake.ACTION_FAILED_ID:
        raise exception.QoSSpecsAssociateFailed(specs_id=id, type_id=type_id)
    elif id == fake.ACTION2_FAILED_ID:
        raise exception.QoSSpecsDisassociateFailed(specs_id=id,
                                                   type_id=type_id)

    if type_id == fake.WILL_NOT_BE_FOUND_ID:
        raise exception.VolumeTypeNotFound(volume_type_id=type_id)

    pass
Beispiel #6
0
def return_disassociate_all(context, id):
    if id == fake.WILL_NOT_BE_FOUND_ID:
        raise exception.QoSSpecsNotFound(specs_id=id)
    elif id == fake.ACTION2_FAILED_ID:
        raise exception.QoSSpecsDisassociateFailed(specs_id=id,
                                                   type_id=None)
Beispiel #7
0
def return_disassociate_all(context, id):
    if id == "111":
        raise exception.QoSSpecsNotFound(specs_id=id)
    elif id == "222":
        raise exception.QoSSpecsDisassociateFailed(specs_id=id, type_id=None)