Esempio n. 1
0
 def create_eru_node(request):
     container_info = None
     try:
         port = int(request.form.get('port', 6379))
         if not 6000 <= port <= 7999:
             raise ValueError('invalid port')
         container_info = deploy_node(
             request.form['pod'], request.form['aof'] == 'y',
             request.form['netmode'], request.form['cluster'] == 'y',
             host=request.form.get('host'), port=port)
         models.node.create_eru_instance(container_info['address'], port,
                                         container_info['container_id'])
         return base.json_result(container_info)
     except IntegrityError:
         if container_info is not None:
             rm_containers([container_info['container_id']])
         raise ValueError('exists')
     except BaseException as exc:
         logging.exception(exc)
         raise
Esempio n. 2
0
def _deploy_node(pod, aof, host):
    depl = deploy_node(pod, aof, 'macvlan', host=host)
    cid = depl['container_id']
    h = depl['address']
    models.node.create_eru_instance(h, 6379, cid)
    return cid, h