OpenStack VM DHCP problem with Quantum? Guideline and real case

Today, OpenStack draws many eyeballs in deploying cloud-computingenvironments.
Whenusing OpenStack in practical scenarios, there will be numbers of detailedevils. One notorious bug is that booted vm sometimes cannot get an IP by DHCPautomatically. Many people encountered similar problems, and proposed severalsolutions, including restarting quantum related services. However, this maywork for some special cases, while fail on the others.
So,how to find out the crime culprit for your specified problem? In this article,we will show the guideline to locate the DHCP failure reason and demonstratewith a real case.
Debug Guideline:
0)Start a DHCP request in the vm using
sudo udhcpc
orother dhcp client.
1)Does the DHCP request reach the network node?
Ifnot, then you should use tcpdump to capture packets at the compute node’s andthe network node’s network interface (at the data network). A DHCP request usuallylooks like
IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP,Request from fa:16:3e:82:ee:fe, length 286
ifusing the following commands.
tcpdump -ni eth1 port 67 and port 68
2)If the DHCP request successfully reaches the network nodes, then make sure thequantum-dhcp-agent offers reply. This can be validated through the log file (/var/log/syslog),or by tcpdump also.
Thelog may look like
Jun 21 10:42:31 localhost, dnsmasq-dhcp[541]:DHCPREQUEST(tap9c753e61-fc) 50.50.1.6 fa:16:3e:82:ee:fe
Jun 21 10:42:31 localhost, dnsmasq-dhcp[541]:DHCPACK(tap9c753e61-fc) 50.50.1.6 fa:16:3e:82:ee:fe 50-50-1-6
Anda DHCP Reply usually looks like
IP 50.50.1.3.67 > 50.50.1.7.68: BOOTP/DHCP,Reply, length 308
Ifnot, make sure the quantum-* services starts successfully at the network node.
service quantum-dhcp-agent status
3)Make sure the DHCP reply goes back to the compute node using tcpdump too.
4)If the DHCP reply reach the compute node, then capture at the vm’scorresponding tap-* network interface, to make sure the reply can reach vm.
Ifnot, then try to check the quantum-plugin-openvswitch-agent services works fineat the compute node.
service quantum-plugin-openvswitch-agent status
5)Sometimes, you may need to restart the whole nodes if problem continues appearat a special machine.
A real case
Ihave met a weird case.
Inthe case, everything seems OK. The network node gets the DHCP request and givesback the offer, while the compute node successfully gets the DHCP offer. However,the vm still cannot get IP some times, while occasionally it will get one!
Ilook very carefully the entire process, and make sure all services are started.
Thenthe only suspicious component is the OpenvSwitch.
Icheck the of rules at the br-int (vm’s located bridge) using
ovs-ofctl dump-flows br-int
andthey looks like:
NXST_FLOW reply (xid=0x4):
 cookie=0x0,duration=2219.925s, table=0, n_packets=0, n_bytes=85038, idle_age=3,priority=3,in_port=1,dl_vlan=2 actions=mod_vlan_vid:1,NORMAL
 cookie=0x0,duration=2231.487s, table=0, n_packets=0, n_bytes=120021, idle_age=3,priority=1 actions=NORMAL
 cookie=0x0,duration=2227.341s, table=0, n_packets=0, n_bytes=16868, idle_age=5,priority=2,in_port=1 actions=drop
Theylook quite normal, as all the rules are generated by the quantum-plugin-openvswitch-agent service.
I also make sure the DHCP offerreach br-int with capturing packet at it’s data network interface.
tcpdump –ni int-br-eth1 port 67 or port 68
As I guess, the DHCP offershould match rule#1 (vlan mode), and send out. However, watch a while, then_packets does not increase, which means the DHCP offer does not match therule.
It is strange right? Why ovsdoes not work as expected?
Based on my years’ experienceon ovs, I think there must be some HIDDEN rule destroying the processing. Then Icheck more details of the rules.
ovs-appctl bridge/dump-flows br-int
HAHA,some thing now is floating outside.
duration=151s, priority=180001, n_packets=0,n_bytes=0, priority=180001,arp,dl_dst=fe:86:a7:fd:c0:4f,arp_op=2,actions=NORMAL
duration=151s, priority=180003, n_packets=0,n_bytes=0, priority=180003,arp,dl_dst=00:1a:64:99:f2:72,arp_op=2,actions=NORMAL
duration=148s, priority=3, n_packets=0, n_bytes=0,priority=3,in_port=1,dl_vlan=2,actions=mod_vlan_vid:1,NORMAL
duration=151s, priority=180006, n_packets=0,n_bytes=0, priority=180006,arp,nw_src=10.0.1.197,arp_op=1,actions=NORMAL
duration=151s, priority=180004, n_packets=0,n_bytes=0, priority=180004,arp,dl_src=00:1a:64:99:f2:72,arp_op=1,actions=NORMAL
duration=151s, priority=180002, n_packets=0,n_bytes=0, priority=180002,arp,dl_src=fe:86:a7:fd:c0:4f,arp_op=1,actions=NORMAL
duration=151s, priority=15790320,n_packets=174, n_bytes=36869, priority=15790320,actions=NORMAL
duration=151s, priority=180005, n_packets=0,n_bytes=0, priority=180005,arp,nw_dst=10.0.1.197,arp_op=2,actions=NORMAL
duration=151s, priority=180008, n_packets=0,n_bytes=0, priority=180008,tcp,nw_src=10.0.1.197,tp_src=6633,actions=NORMAL
duration=151s, priority=180007, n_packets=0,n_bytes=0, priority=180007,tcp,nw_dst=10.0.1.197,tp_dst=6633,actions=NORMAL
duration=151s, priority=180000, n_packets=0,n_bytes=0, priority=180000,udp,in_port=65534,dl_src=fe:86:a7:fd:c0:4f,tp_src=68,tp_dst=67,actions=NORMAL
table_id=254, duration=165s, priority=0,n_packets=13, n_bytes=2146,priority=0,reg0=0x1,actions=controller(reason=no_match)
table_id=254, duration=165s, priority=0,n_packets=0, n_bytes=0, priority=0,reg0=0x2,drop
Seethat? Packets are matching the red rule, which owns a high priority and justforward the vlan packet as NORMAL!!
Sowhere does the rule come from?
Insome version of ovs, when we start ovs without any controller specified, then itmay smartly works like a L2 switch, and some rules will be added automatically.
Nowhow to solve the problem?
Weneed to tell the ovs do not be that “Smart” with the commands:
ovs-vsctl set bridge br-int fail-mode=secure

Atlast, the problem has puzzled our team for several weeks. During solving theproblem, I summarize the guideline and wish it would be a little bit helpful.
标题Python网络课程在线学习平台研究AI更换标题第1章引言介绍Python网络课程在线学习平台的研究背景、意义、国内外现状和研究方法。1.1研究背景与意义阐述Python在线学习平台的重要性和研究意义。1.2国内外研究现状概述国内外Python在线学习平台的发展现状。1.3研究方法与论文结构介绍本文的研究方法和整体论文结构。第2章相关理论总结在线学习平台及Python教育的相关理论。2.1在线学习平台概述介绍在线学习平台的基本概念、特点和发展趋势。2.2Python教育理论阐述Python语言教学的理论和方法。2.3技术支持理论讨论构建在线学习平台所需的技术支持理论。第3章Python网络课程在线学习平台设计详细介绍Python网络课程在线学习平台的设计方案。3.1平台功能设计阐述平台的核心功能,如课程管理、用户管理、学习跟踪等。3.2平台架构设计给出平台的整体架构,包括前后端设计、数据库设计等。3.3平台界面设计介绍平台的用户界面设计,强调用户体验和易用性。第4章平台实现与测试详细阐述Python网络课程在线学习平台的实现过程和测试方法。4.1平台实现介绍平台的开发环境、技术栈和实现细节。4.2平台测试对平台进行功能测试、性能测试和安全测试,确保平台稳定可靠。第5章平台应用与效果分析分析Python网络课程在线学习平台在实际应用中的效果。5.1平台应用案例介绍平台在实际教学或培训中的应用案例。5.2效果评估与分析通过数据分析和用户反馈,评估平台的应用效果。第6章结论与展望总结Python网络课程在线学习平台的研究成果,并展望未来发展方向。6.1研究结论概括本文关于Python在线学习平台的研究结论。6.2研究展望提出未来Python在线学习平台的研究方向和发展建议。
标题Django基于Python的毕业生去向反馈调查平台设计与实现AI更换标题第1章引言介绍研究背景、意义,分析国内外相关平台的现状,并阐述论文的研究方法和创新点。1.1研究背景与意义说明毕业生去向反馈的重要性及现有调查方式的不足。1.2国内外研究现状概述国内外在毕业生去向反馈调查平台方面的发展现状。1.3研究方法与创新点阐述本文采用的研究方法和在平台设计中的创新之处。第2章相关理论与技术介绍Django框架、Python语言以及相关的Web开发技术。2.1Django框架概述简述Django框架的特点、优势及其在Web开发中的应用。2.2Python语言基础概述Python语言的基本语法、特点及其在Web开发中的作用。2.3Web开发相关技术介绍与平台设计相关的Web前端技术、数据库技术等。第3章平台需求分析对毕业生去向反馈调查平台进行需求分析,包括功能需求和非功能需求。3.1功能需求分析详细阐述平台应具备的各项功能,如用户管理、问卷调查、数据分析等。3.2非功能需求分析分析平台的性能、安全性、易用性等非功能需求。第4章平台设计根据需求分析结果,设计平台的整体架构、功能模块和数据库。4.1平台整体架构设计给出平台的整体架构图,并说明各个组成部分的作用。4.2功能模块设计详细设计平台的各个功能模块,包括用户模块、问卷模块、数据分析模块等。4.3数据库设计设计平台的数据库结构,包括数据表的设计、数据关系的建立等。第5章平台实现与测试介绍平台的实现过程、关键代码以及测试方法和结果。5.1平台实现阐述平台的实现过程,包括开发环境的搭建、代码的编写等。5.2关键代码展示展示实现平台功能的关键代码片段,如用户认证、问卷调查等。5.3平台测试说明平台的测试方法,包括功能测试、性能测试等,并给出测试结果。第6章结论与展望总结论文的研究成果,指出平台的优点与不足,并展望未来的研究方向。6.
Spring Boot处理OpenStack API的OAuth2认证通常涉及以下几个步骤: 1. **添加依赖**:在pom.xml中添加Spring Security以及OpenStack4J的OAuth2模块作为依赖: ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>com.netflix.openstack4j</groupId> <artifactId>openstack4j-oauth2</artifactId> <version>4.x.x</version> <!-- 更新到最新版本 --> </dependency> ``` 2. **配置客户端信息**:在application.properties或application.yml中,设置OpenStack的OAuth2客户端ID、密钥和授权URL,以及其他相关配置。 ``` openstack4j.oauth2.client.id=your-client-id openstack4j.oauth2.client.secret=your-client-secret openstack4j.oauth2.authorize.url=https://identity.example.com/v3/auth/tokens ``` 3. **启用Security**:在@Configuration类上添加@EnableWebSecurity注解开启Spring Security,并配置一个AuthenticationManager,指定使用OpenStack4j OAuth2认证策略。 ```java @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Bean public AuthenticationProvider authenticationProvider() { OAuth2AuthenticationProvider oauth2AuthProvider = new OAuth2AuthenticationProvider(); oauth2AuthProvider.setOAuth2Template(new OAuth2Template(openstack4j.getAuth()); return oauth2AuthProvider; } } ``` 4. **保护API端点**:标记需要身份验证的REST控制器或路径,通常是使用@PreAuthorize("hasRole('ROLE_USER')")这样的注解。 ```java @RestController @RequestMapping("/protected") @PreAuthorize("hasAuthority('OS_AUTH_API')") public class ProtectedController { //... } ``` 5. **处理回调和刷新令牌**:如果需要长期会话,你需要处理token的刷新。Spring Security允许自定义TokenEnhancer来修改或刷新令牌。 ```java @Configuration public class OAuth2TokenAutoConfiguration { //... @Bean public TokenEnhancer tokenEnhancer() { return new JWTTokenEnhancer(openstack4j); } //... } ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值