OpenStack Cinder服务状态优化


  1. now = timeutils.utcnow(with_timezone=True

由于openstack-cinder-api.servic服务在controller节点启动,所以获取的是controller节点的当前时间。

services = objects.ServiceList.get_all(context, filters)最终会从cinder数据库的services表中获取所有服务数据。

alive = abs(delta_sec) <= CONF.service_down_time,比较时间差的绝对值是否小于配置的service_down_time,其中service_down_time默认时间是60s。


  1. cfg.IntOpt('service_down_time'
  2.            default=60, 
  3.            help='Maximum time since last check-in for a service to be ' 
  4.            'considered up'), 

art = "up" if alive else "down" 差值小于60,则service 状态为 up,否则为down。由此可见cinder service的state值取决于cinder数据库中 service 表每行数据的 updated_at 列的值和当前 controller 节点的时间差是否在配置的范围之内。

解决问题

上面cinder-volume出现down的原因就是因为运行openstack-cinder-volume.service服务的存储节点时间与controller节点时间差值过大。为了保证状态为up,必须保证两节点的时间差在service_down_time – report_interval之内,默认情况下,差值为50秒。所以同步两台服务器时间之后,再次查看,发现cinder-volume的state变为up。

cinder服务更新机制

下面说下 Cinder Service 的更新机制。

report_interval默认时间是10s,


  1. cfg.IntOpt('report_interval'
  2.            default=10, 
  3.            help='Interval, in seconds, between nodes reporting state ' 
  4.            'to datastore'), 
【声明】:芜湖站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

相关文章