Skip to content

Commit

Permalink
Merge "ToR Agent OVSDB - performance on HA" into R2.20
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jun 5, 2015
2 parents d27189c + 819b18b commit 5a35ba1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Expand Up @@ -35,13 +35,14 @@ VlanPortBindingEntry::VlanPortBindingEntry(VlanPortBindingTable *table,
uint16_t vlan_tag, const std::string &logical_switch) :
OvsdbDBEntry(table_), logical_switch_name_(logical_switch),
physical_port_name_(physical_port), physical_device_name_(physical_device),
vlan_(vlan_tag), vmi_uuid_(nil_uuid()) {
vlan_(vlan_tag), vmi_uuid_(nil_uuid()), old_logical_switch_name_() {
}

VlanPortBindingEntry::VlanPortBindingEntry(VlanPortBindingTable *table,
const VlanLogicalInterface *entry) : OvsdbDBEntry(table_),
logical_switch_name_(), physical_port_name_(),
physical_device_name_(""), vlan_(entry->vlan()), vmi_uuid_(nil_uuid()) {
physical_device_name_(""), vlan_(entry->vlan()), vmi_uuid_(nil_uuid()),
old_logical_switch_name_() {
RemotePhysicalInterface *phy_intf = dynamic_cast<RemotePhysicalInterface *>
(entry->physical_interface());
assert(phy_intf);
Expand All @@ -54,7 +55,7 @@ VlanPortBindingEntry::VlanPortBindingEntry(VlanPortBindingTable *table,
logical_switch_name_(key->logical_switch_name_),
physical_port_name_(key->physical_port_name_),
physical_device_name_(key->physical_device_name_), vlan_(key->vlan_),
vmi_uuid_(nil_uuid()) {
vmi_uuid_(nil_uuid()), old_logical_switch_name_() {
}

void VlanPortBindingEntry::PreAddChange() {
Expand All @@ -79,6 +80,11 @@ void VlanPortBindingEntry::AddMsg(struct ovsdb_idl_txn *txn) {
PhysicalPortEntry *port =
static_cast<PhysicalPortEntry *>(physical_port_.get());

// update logical switch name propagated to OVSDB server, this will
// be used in change Operation to reduce the unncessary computation
// when there is change which VlanPortBindingEntry is not
// interested into
old_logical_switch_name_ = logical_switch_name_;
if (!logical_switch_name_.empty()) {
port->AddBinding(vlan_,
static_cast<LogicalSwitchEntry *>(logical_switch_.get()));
Expand All @@ -98,6 +104,10 @@ void VlanPortBindingEntry::AddMsg(struct ovsdb_idl_txn *txn) {
}

void VlanPortBindingEntry::ChangeMsg(struct ovsdb_idl_txn *txn) {
if (logical_switch_name_ == old_logical_switch_name_) {
// no change return from here.
return;
}
PhysicalPortEntry *port =
static_cast<PhysicalPortEntry *>(physical_port_.get());
OVSDB_TRACE(Trace, "Changing port vlan binding port " +
Expand Down
Expand Up @@ -67,6 +67,7 @@ class VlanPortBindingEntry : public OvsdbDBEntry {
std::string physical_device_name_;
uint16_t vlan_;
boost::uuids::uuid vmi_uuid_;
std::string old_logical_switch_name_;
DISALLOW_COPY_AND_ASSIGN(VlanPortBindingEntry);
};
};
Expand Down

0 comments on commit 5a35ba1

Please sign in to comment.