用devstack multi-node模式,分为controller node 和 stroage node, stroage node上只有cinder-volume
安装完后发现iscsitarget@lvmdriver-1上的cinder-volume的state老是down. 如下所示:
#cinder service-list
+------------------+-------------------------+------+---------+-------+----------------------------+-----------------+
| Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+------------------+-------------------------+------+---------+-------+----------------------------+-----------------+
| cinder-backup | dev1 | nova | enabled | up | 2015-05-12T12:12:41.000000 | - |
| cinder-scheduler | dev1 | nova | enabled | up | 2015-05-12T12:12:37.000000 | - |
| cinder-volume | dev1@lvmdriver-1 | nova | enabled | down | 2015-05-12T09:07:04.000000 | - |
| cinder-volume | iscsitarget@lvmdriver-1 | nova | enabled | down | 2015-05-12T12:19:03.000000 | - |
+------------------+----------------------
上源码:
[mw_shl_code=bash,true] for svc in services:
delta = now - (svc['updated_at'] or svc['created_at'])
alive = abs(utils.total_seconds(delta)) <= CONF.service_down_time#default value is 60s
art = (alive and "up") or "down"
active = 'enabled'
if svc['disabled']:
active = 'disabled'
ret_fields = {'binary': svc['binary'], 'host': svc['host'],
'zone': svc['availability_zone'],
'status': active, 'state': art,
'updated_at': svc['updated_at']}
if detailed:
ret_fields['disabled_reason'] = svc['disabled_reason']
svcs.append(ret_fields)[/mw_shl_code]
分析可知,service的state为up 或down 的依据是 :
现在的时间- updated的时间 <= 60s
由此判定是controller node和 stroage node的时间不一致导致的,分别查看一下时间:
ubuntu@dev1:~$ date
Tue May 12 12:23:13 UTC 2015
ubuntu@iscsitarget:~$ date
Tue May 12 12:28:16 UTC 2015
分别用上海交通大学网络中心NTP服务器跟新一下时间:
ubuntu@iscsitarget:~$ sudo ntpdate 202.120.2.101
12 May 12:27:21 ntpdate[5125]: adjust time server 202.120.2.101 offset -0.098167 sec
再次查看一下服务:
#cinder service-list
-----------------------+-----------------+
| Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+------------------+-------------------------+------+---------+-------+----------------------------+-----------------+
| cinder-backup | dev1 | nova | enabled | up | 2015-05-12T12:28:28.000000 | - |
| cinder-scheduler | dev1 | nova | enabled | up | 2015-05-12T12:28:27.000000 | - |
| cinder-volume | dev1@lvmdriver-1 | nova | enabled | down | 2015-05-12T09:07:04.000000 | - |
| cinder-volume | iscsitarget@lvmdriver-1 | nova | enabled | up | 2015-05-12T12:28:23.000000 | - |
Done
+------------------+-----------------------
|
|