def __update_db(ser): values = {} values['id'] = ser['id'] node_type = "" if ser['is_storage'] == True: node_type += "storage," if ser['is_monitor'] == True: node_type += "monitor," values['type'] = node_type db.init_node_update(context, ser['id'], values)
def _add_servers(self, context, body=None): """Add the servers into ceph cluster. It's notable that, the type of body['servers'] looks as below: [ {u'is_storage': True, u'is_monitor': True, u'id': u'1', u'zone_id': u'1'}, {u'is_storage': True, u'is_monitor': False, u'id': u'2', u'zone_id': u'2'} ] Here we also need to fetch info from DB. """ def _update_ssh_key(): server_list = db.init_node_get_all(context) for ser in server_list: if ser['status'] == 'Active' or ser['status'] == 'available': self._agent_rpcapi.update_ssh_keys(context, ser['host']) server_list = body['servers'] for ser in server_list: ser_ref = db.init_node_get(context, ser['id']) ser['host'] = ser_ref['host'] ser['cluster_id'] = self._agent_rpcapi.cluster_id(context, ser['host']) # It need to change the role defined in # server.manifest if ser['is_monitor'] == False: if ser_ref['type'].find('monitor') != -1: values = {'type': 'storage'} db.init_node_update(context, ser_ref['id'], values) self._update_server_list_status(context, server_list, 'running') _update_ssh_key() self.add_monitor(context, server_list) # Begin to add osds. LOG.info("start to add storage") self.add_osd(context, server_list) self._judge_drive_ext_threshold(context) return True
def init_node_update(self, context, id, values): return db.init_node_update(context, id, values)
def init_node_update(self, context, id, values): return db.init_node_update(context, id, values)