コード例 #1
0
ファイル: ucs_db_v2.py プロジェクト: whitekid/quantum
def update_portbinding(port_id, blade_intf_dn=None, portprofile_name=None,
                       vlan_name=None, vlan_id=None, qos=None,
                       tenant_id=None, instance_id=None,
                       vif_id=None):
    """Updates port binding"""
    LOG.debug("db update_portbinding() called")
    session = db.get_session()
    try:
        port_binding = (session.query(ucs_models.PortBinding).
                        filter_by(port_id=port_id).one())
        if blade_intf_dn:
            port_binding.blade_intf_dn = blade_intf_dn
        if portprofile_name:
            port_binding.portprofile_name = portprofile_name
        if vlan_name:
            port_binding.vlan_name = vlan_name
        if vlan_name:
            port_binding.vlan_id = vlan_id
        if qos:
            port_binding.qos = qos
        if tenant_id:
            port_binding.tenant_id = tenant_id
        if instance_id:
            port_binding.instance_id = instance_id
        if vif_id:
            port_binding.vif_id = vif_id
        session.merge(port_binding)
        session.flush()
        return port_binding
    except exc.NoResultFound:
        raise c_exc.PortVnicNotFound(port_id=port_id)
コード例 #2
0
ファイル: ucs_db_v2.py プロジェクト: whitekid/quantum
def get_portbinding(port_id):
    """Lists a port binding"""
    LOG.debug("get_portbinding() called")
    session = db.get_session()
    try:
        port_binding = (session.query(ucs_models.PortBinding).
                        filter_by(port_id=port_id).one())
        return port_binding
    except exc.NoResultFound:
        raise c_exc.PortVnicNotFound(port_id=port_id)
コード例 #3
0
ファイル: ucs_db_v2.py プロジェクト: whitekid/quantum
def update_portbinding_vif_id(port_id, vif_id):
    """Updates port binding for the VIF ID"""
    LOG.debug("db update_portbinding_vif_id() called")
    session = db.get_session()
    try:
        port_binding = (session.query(ucs_models.PortBinding).
                        filter_by(port_id=port_id).one())
        port_binding.vif_id = vif_id
        session.merge(port_binding)
        session.flush()
        return port_binding
    except exc.NoResultFound:
        raise c_exc.PortVnicNotFound(port_id=port_id)
コード例 #4
0
ファイル: ucs_db.py プロジェクト: wendy-king/x7_venv
def update_portbinding_instance_id(port_id, instance_id):
    """Updates port binding for the instance ID"""
    LOG.debug("db update_portbinding_instance_id() called")
    session = db.get_session()
    try:
        port_binding = session.query(ucs_models.PortBinding).\
          filter_by(port_id=port_id).\
          one()
        port_binding.instance_id = instance_id
        session.merge(port_binding)
        session.flush()
        return port_binding
    except exc.NoResultFound:
        raise c_exc.PortVnicNotFound(port_id=port_id)