Quantum关于Port的操作(LinuxBridge)
1 创建port
1.1 流程
(2012/12/13修正):为port分配IP时,当没有指定fixed_ip,是从network中选一个有空闲IP的subnet分配IP,而不是从所有subnet分配。
# 校验fixed_ips的合法性
def _test_fixed_ips_for_port(self, context, network_id, fixed_ips):
"""Test fixed IPs for port.
Check that configured subnets are valid prior to allocating any
IPs. Include the subnet_id in the result if only an IP address is
configured.
:raises: InvalidInput, IpAddressInUse
"""
fixed_ip_set = []
for fixed in fixed_ips:
found = False
# 如果没有指定subnet
if 'subnet_id' not in fixed:
# 如果既没有指定subnet,也没有指定ip_address,抛错
if 'ip_address' not in fixed:
msg = _('IP allocation requires subnet_id or ip_address')
raise q_exc.InvalidInput(error_message=msg)
# 如果没有指定subnet,但指定了ip_address
filter = {'network_id': [network_id]}
# 找到属于入参network_id的所有subnet
subnets = self.get_subnets(context, filters=filter)
for subnet in subnets:
# 检查ip_address是否在subnet中,返回subnet_id
if QuantumDbPluginV2._check_subnet_ip(subnet['cidr'],
fixed['ip_address']):
found = True
subnet_id = subnet['id']
break
# 如果在所有subnet都没有找到,抛错
if not found:
msg = _('IP address %s is not a valid IP for the defined '
'networks subnets') % fixed['ip_address']
raise q_exc.InvalidInput(error_message=msg)
# 如果指定了subnet
else:
subnet = self._get_subnet(context, fixed['subnet_id'])
# subnet所属network与入参不一致,抛错
if subnet['network_id'] != network_id:
msg = _('Failed to create port on network %s, '
'because fixed_ips included invalid subnet '
'%s') % (network_id, fixed['subnet_id'])
raise q_exc.InvalidInput(error_message=msg)
subnet_id = subnet['id']
# 如果指定了ip_address
if 'ip_address' in fixed:
# Ensure that the IP's are unique
# 在ipallocation表中查找,如果记录已存在,抛错
if not QuantumDbPluginV2._check_unique_ip(context, network_id,
subnet_id,
fixed['ip_address']):
raise q_exc.IpAddressInUse(net_id=network_id,
ip_address=fixed['ip_address'])
# Ensure that the IP is valid on the subnet
# 如果记录不存在,且同时指定了subnet和ip_address,则判断ip_address是否属于指定的subnet内
if (not found and
not QuantumDbPluginV2._check_subnet_ip(
subnet['cidr'], fixed['ip_address'])):
msg = _('IP address %s is not a valid IP for the defined '
'subnet') % fixed['ip_address']
raise q_exc.InvalidInput(error_message=msg)
fixed_ip_set.append({'subnet_id': subnet_id,
'ip_address': fixed['ip_address']})
else:
fixed_ip_set.append({'subnet_id': subnet_id})
return fixed_ip_set
2 删除port
2.1 流程
3 更新port
3.1 流程
4 总结
注意,这里对port的操作中,更新port是需要向下层的agent发送消息处理的,其他操作都只是上层的逻辑操作而已。
分享到:
相关推荐
openstack quantum网络介绍
这是有关openstack Grizzly安装的文档
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,亲测可用
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
openstack使用linux bridge+vxlan模式的网络变化与分析.pdf
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
OpenStack:云中的“LINUX”.pdf
OpenStack.云时代的Linux?——首届OpenStack亚太技术大会侧记.pdf
很多人在配置openstack+quantum时不知如何操作,命令到底有多少,因此整理OVS手册,供大家查阅。
主要介绍了浅谈openstack中使用linux_bridge实现vxlan网络,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装