Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I spent the better part of a day trying to find out why I was able to remove a single router from an l3 agent, but when I tried the same in a loop over the generator that returns all agents hosting a router it wouldn't work. It would have been smart to check the type earlier, but long story short, I didn't :)
- In [124]: agent1 = next(conn.network.agents(agent_type='L3 Agent', host='networker1'
- ...: ))
- In [125]: agent1_from_network = next(conn.network.routers_hosting_l3_agents(router))
- In [126]: conn.network.remove_router_from_agent(agent1_from_network, router) # This doesn't work. It returns quickly without output.
- In [127]: conn.network.remove_router_from_agent(agent1, router) # But this does work!
- ## At that point I tried to see what could possible be the difference between objects that look to be the same.
- In [128]: type(agent1)
- Out[128]: openstack.network.v2.agent.Agent
- In [129]: type(agent1_from_network)
- Out[129]: openstack.network.v2.agent.RouterL3Agent
- So after finding out that the problem is probably the fact that I'm passing a different type, I tried referencing the agent by ID and that does work.
- ---
- In [131]: conn.network.add_router_to_agent(agent1.id, router)
- In [132]: conn.network.remove_router_from_agent(agent1_from_network.id, router)
Add Comment
Please, Sign In to add comment