# under the License.
+from oslo.config import cfg
import webob.exc
from cinder.api import extensions
from cinder import utils
+CONF = cfg.CONF
+
LOG = logging.getLogger(__name__)
authorize = extensions.extension_authorizer('volume', 'services')
svcs = []
for svc in services:
delta = now - (svc['updated_at'] or svc['created_at'])
- alive = abs(utils.total_seconds(delta))
+ alive = abs(utils.total_seconds(delta)) <= CONF.service_down_time
art = (alive and "up") or "down"
active = 'enabled'
if svc['disabled']:
'updated_at': datetime(2012, 10, 29, 13, 42, 5)},
{'binary': 'cinder-scheduler', 'host': 'host2',
'zone': 'cinder',
- 'status': 'enabled', 'state': 'up',
+ 'status': 'enabled', 'state': 'down',
'updated_at': datetime(2012, 9, 19, 6, 55, 34)},
{'binary': 'cinder-volume', 'host': 'host2',
'zone': 'cinder',
- 'status': 'disabled', 'state': 'up',
+ 'status': 'disabled', 'state': 'down',
'updated_at': datetime(2012, 9, 18, 8, 3, 38)}]}
self.assertEqual(res_dict, response)
'host': 'host2',
'zone': 'cinder',
'status': 'disabled',
- 'state': 'up',
+ 'state': 'down',
'updated_at': datetime(2012, 9, 18,
8, 3, 38)}]}
self.assertEqual(res_dict, response)