Skip to content

Commit

Permalink
Merge "VMI was not removed and it held on VRF." into R3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed May 26, 2016
2 parents 13fa688 + 5781392 commit 60c4413
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 2 deletions.
59 changes: 59 additions & 0 deletions src/vnsw/agent/oper/test/test_logical_intf.cc
Expand Up @@ -154,6 +154,65 @@ TEST_F(IntfTest, basic_1) {
client->WaitForIdle();
}

//https://bugs.launchpad.net/juniperopenstack/r3.0/+bug/1550459
TEST_F(IntfTest, bug_1550459) {
AddVrf("vrf1");
AddVn("vn1", 1);
AddPhysicalInterface("pi1", 1, "pi1");
AddLogicalInterface("li1", 1, "li1", 100);
AddLink("physical-interface", "pi1", "logical-interface", "li1");

AddVmi(1, 1);
client->WaitForIdle();
AddLink(1, 1);
client->WaitForIdle();
AddLink("virtual-network", "vn1", "routing-instance", "vrf1");
AddLink("virtual-machine-interface", "vmi1",
"virtual-network", "vn1");
AddLink("virtual-machine-interface-routing-instance", "vmi1",
"routing-instance", "vrf1",
"virtual-machine-interface-routing-instance");
AddLink("virtual-machine-interface-routing-instance", "vmi1",
"virtual-machine-interface", "vmi1",
"virtual-machine-interface-routing-instance");
client->WaitForIdle();

WAIT_FOR(1000, 100, (LogicalInterfaceGet(1, "li1") != NULL));
client->WaitForIdle();
LogicalInterface *li = LogicalInterfaceGet(1, "li1");

WAIT_FOR(1000, 100, (li->vm_interface() != NULL));
client->WaitForIdle();
InterfaceRef vmi_ref = li->vm_interface();
VmInterface *vmi = static_cast<VmInterface *>(vmi_ref.get());
VmInterface::Delete(Agent::GetInstance()->interface_table(),
vmi->GetUuid(), VmInterface::CONFIG);
client->WaitForIdle();
AddVmi(1, 1);
client->WaitForIdle();
VmInterface::Delete(Agent::GetInstance()->interface_table(),
vmi->GetUuid(), VmInterface::CONFIG);
client->WaitForIdle();

DelLink(1, 1);
DelLink("virtual-network", "vn1", "routing-instance", "vrf1");
DelLink("virtual-machine-interface", "vmi1",
"virtual-network", "vn1");
DelLink("virtual-machine-interface-routing-instance", "vmi1",
"routing-instance", "vrf1");
DelLink("virtual-machine-interface-routing-instance", "vmi1",
"virtual-machine-interface", "vmi1");
client->WaitForIdle();
DelLink("physical-interface", "pi1", "logical-interface", "li1");
vmi_ref.reset();
DelVmi(1);
DeleteLogicalInterface("li1");
DeletePhysicalInterface("pi1");
DelVrf("vrf1");
DelVn("vn1");
client->WaitForIdle();
}

int main(int argc, char **argv) {
GETUSERARGS();

Expand Down
5 changes: 3 additions & 2 deletions src/vnsw/agent/oper/vm_interface.cc
Expand Up @@ -1707,9 +1707,9 @@ bool VmInterfaceConfigData::OnDelete(const InterfaceTable *table,
if (vmi->IsConfigurerSet(VmInterface::CONFIG) == false)
return true;

vmi->ResetConfigurer(VmInterface::CONFIG);
VmInterfaceConfigData data(NULL, NULL);
vmi->Resync(table, &data);
vmi->ResetConfigurer(VmInterface::CONFIG);
return true;
}

Expand All @@ -1730,6 +1730,7 @@ bool VmInterfaceConfigData::OnResync(const InterfaceTable *table,
ecmp_load_balance_changed || static_route_config_changed)
*force_update = true;

vmi->SetConfigurer(VmInterface::CONFIG);
return ret;
}

Expand Down Expand Up @@ -2129,9 +2130,9 @@ bool VmInterfaceNovaData::OnDelete(const InterfaceTable *table,
if (vmi->IsConfigurerSet(VmInterface::INSTANCE_MSG) == false)
return true;

vmi->ResetConfigurer(VmInterface::CONFIG);
VmInterfaceConfigData data(NULL, NULL);
vmi->Resync(table, &data);
vmi->ResetConfigurer(VmInterface::CONFIG);
vmi->ResetConfigurer(VmInterface::INSTANCE_MSG);
return true;
}
Expand Down

0 comments on commit 60c4413

Please sign in to comment.