From: Henry Gessau Date: Mon, 21 Jul 2014 14:35:41 +0000 (-0400) Subject: Set nullable=False on tenant_id in apic_contracts table X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=6762acab9ca70bad843cdee542d816ad8e3cb908;p=openstack-build%2Fneutron-build.git Set nullable=False on tenant_id in apic_contracts table The cisco_ml2_apic_contracts table has a tenant_id field that is not nullable since it is the primary key. The HasTenant mixin does not allow setting nullable=False, so use sa.Column() explicitly for this. Change-Id: If8e96e76fad0bfcf2bfd71b0223624f1da4517c9 Closes-bug: #1342756 --- diff --git a/neutron/plugins/ml2/drivers/cisco/apic/apic_model.py b/neutron/plugins/ml2/drivers/cisco/apic/apic_model.py index 54d36f94c..19774fd46 100644 --- a/neutron/plugins/ml2/drivers/cisco/apic/apic_model.py +++ b/neutron/plugins/ml2/drivers/cisco/apic/apic_model.py @@ -20,7 +20,6 @@ from sqlalchemy import sql from neutron.db import api as db_api from neutron.db import model_base -from neutron.db import models_v2 class NetworkEPG(model_base.BASEV2): @@ -50,13 +49,14 @@ class PortProfile(model_base.BASEV2): to_port = sa.Column(sa.Integer(), nullable=False) -class TenantContract(model_base.BASEV2, models_v2.HasTenant): +class TenantContract(model_base.BASEV2): """Contracts (and Filters) created on the APIC.""" __tablename__ = 'cisco_ml2_apic_contracts' - __table_args__ = (sa.PrimaryKeyConstraint('tenant_id'),) + # Cannot use HasTenant since we need to set nullable=False + tenant_id = sa.Column(sa.String(255), nullable=False, primary_key=True) contract_id = sa.Column(sa.String(64), nullable=False) filter_id = sa.Column(sa.String(64), nullable=False)