fix some bugs

This commit is contained in:
zhuyj17 2017-05-09 01:31:21 +08:00
parent 1148f766e5
commit 9839097b5c
5 changed files with 11 additions and 7 deletions

View File

@ -8,7 +8,7 @@
# $5 : value of lxc.network.veth.pair
ovs-vsctl --may-exist add-br $Bridge
if [ "$GatewayIP" != "NULL" ]; then
if [ "$GatewayHost" != "NULL" ]; then
ovs-vsctl --may-exist add-port $Bridge vxlan-$UserID-$GatewayHost -- set interface vxlan-$UserID-$GatewayHost type=vxlan options:remote_ip=$GatewayHost options:key=$UserID
fi
ovs-vsctl --may-exist add-port $Bridge $5

View File

@ -139,7 +139,7 @@ def create_cluster(user, beans, form):
image['type'] = form.get("imagetype", None)
image['owner'] = form.get("imageowner", None)
user_info = post_to_user("/user/selfQuery/", {'token':form.get("token")})
uid = user_info['id']
uid = user_info['data']['id']
user_info = json.dumps(user_info)
logger.info ("handle request : create cluster %s with image %s " % (clustername, image['name']))
setting = {
@ -174,7 +174,7 @@ def scaleout_cluster(user, beans, form):
image['type'] = form.get("imagetype", None)
image['owner'] = form.get("imageowner", None)
user_info = post_to_user("/user/selfQuery/", {'token':form.get("token")})
uid = user_info['id']
uid = user_info['data']['id']
user_info = json.dumps(user_info)
setting = {
'cpu': form.get('cpuSetting'),
@ -218,7 +218,7 @@ def start_cluster(user, beans, form):
if (clustername == None):
return json.dumps({'success':'false', 'message':'clustername is null'})
user_info = post_to_user("/user/selfQuery/", {'token':form.get("token")})
uid = user_info['id']
uid = user_info['data']['id']
logger.info ("handle request : start cluster %s" % clustername)
[status, result] = G_vclustermgr.start_cluster(clustername, user, uid)
if status:

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3
import subprocess,network
import subprocess
class ipcontrol(object):
@staticmethod

View File

@ -4,10 +4,14 @@ import os, random, json, sys, imagemgr
import datetime
import xmlrpc.client
from httprest import post_to_user
from log import logger
import env
import proxytool
import requests
userpoint = "http://" + env.getenv('USER_IP') + ":" + str(env.getenv('USER_PORT'))
def post_to_user(url = '/', data={}):
return requests.post(userpoint+url,data=data).json()
##################################################
# VclusterMgr

View File

@ -14,7 +14,7 @@ import xmlrpc.server, sys, time
from socketserver import ThreadingMixIn
import threading
import etcdlib, network, container
from nettools import netcontrol
from nettools import netcontrol,ovscontrol
import monitor, proxytool
from lvmtool import new_group, recover_group