Merge branch 'master' of code.ungleich.ch:ucloud/ucloud
This commit is contained in:
commit
26aeb78f61
2 changed files with 13 additions and 9 deletions
|
@ -54,4 +54,8 @@ CEPH_IMG_POOL =
|
||||||
|
|
||||||
# Importing uploaded files
|
# Importing uploaded files
|
||||||
FILE_DIR = /var/lib/ucloud/files
|
FILE_DIR = /var/lib/ucloud/files
|
||||||
FILE_PREFIX = noclue-ahmed
|
FILE_PREFIX = noclue-ahmed
|
||||||
|
|
||||||
|
[ssh]
|
||||||
|
SSH_USERNAME =
|
||||||
|
SSH_PRIVATEKEY =
|
||||||
|
|
|
@ -22,7 +22,7 @@ from ucloud.common.helpers import get_ipv6_address
|
||||||
from ucloud.common.request import RequestEntry, RequestType
|
from ucloud.common.request import RequestEntry, RequestType
|
||||||
from ucloud.common.vm import VMEntry, VMStatus
|
from ucloud.common.vm import VMEntry, VMStatus
|
||||||
from ucloud.config import (etcd_client, request_pool,
|
from ucloud.config import (etcd_client, request_pool,
|
||||||
running_vms, vm_pool, env_vars,
|
running_vms, vm_pool, config,
|
||||||
image_storage_handler)
|
image_storage_handler)
|
||||||
from . import qmp
|
from . import qmp
|
||||||
from ucloud.host import logger
|
from ucloud.host import logger
|
||||||
|
@ -46,7 +46,7 @@ def delete_network_interface(iface):
|
||||||
|
|
||||||
|
|
||||||
def resolve_network(network_name, network_owner):
|
def resolve_network(network_name, network_owner):
|
||||||
network = etcd_client.get(join_path(env_vars.get("NETWORK_PREFIX"),
|
network = etcd_client.get(join_path(config['etcd']["NETWORK_PREFIX"],
|
||||||
network_owner,
|
network_owner,
|
||||||
network_name),
|
network_name),
|
||||||
value_in_json=True)
|
value_in_json=True)
|
||||||
|
@ -179,7 +179,7 @@ def get_start_command_args(vm_entry, vnc_sock_filename: str, migration=False, mi
|
||||||
for network_mac_and_tap in vm_networks:
|
for network_mac_and_tap in vm_networks:
|
||||||
network_name, mac, tap = network_mac_and_tap
|
network_name, mac, tap = network_mac_and_tap
|
||||||
|
|
||||||
_key = os.path.join(env_vars.get('NETWORK_PREFIX'), vm_entry.owner, network_name)
|
_key = os.path.join(config['etcd']['NETWORK_PREFIX'], vm_entry.owner, network_name)
|
||||||
network = etcd_client.get(_key, value_in_json=True)
|
network = etcd_client.get(_key, value_in_json=True)
|
||||||
network_type = network.value["type"]
|
network_type = network.value["type"]
|
||||||
network_id = str(network.value["id"])
|
network_id = str(network.value["id"])
|
||||||
|
@ -187,7 +187,7 @@ def get_start_command_args(vm_entry, vnc_sock_filename: str, migration=False, mi
|
||||||
|
|
||||||
if network_type == "vxlan":
|
if network_type == "vxlan":
|
||||||
tap = create_vxlan_br_tap(_id=network_id,
|
tap = create_vxlan_br_tap(_id=network_id,
|
||||||
_dev=env_vars.get("VXLAN_PHY_DEV"),
|
_dev=config['etcd']["VXLAN_PHY_DEV"],
|
||||||
tap_id=tap,
|
tap_id=tap,
|
||||||
ip=network_ipv6)
|
ip=network_ipv6)
|
||||||
update_radvd_conf(etcd_client)
|
update_radvd_conf(etcd_client)
|
||||||
|
@ -303,13 +303,13 @@ def transfer(request_event):
|
||||||
_host, _port = request_event.parameters["host"], request_event.parameters["port"]
|
_host, _port = request_event.parameters["host"], request_event.parameters["port"]
|
||||||
_uuid = request_event.uuid
|
_uuid = request_event.uuid
|
||||||
_destination = request_event.destination_host_key
|
_destination = request_event.destination_host_key
|
||||||
vm = get_vm(running_vms, join_path(env_vars.get('VM_PREFIX'), _uuid))
|
vm = get_vm(running_vms, join_path(config['etcd']['VM_PREFIX'], _uuid))
|
||||||
|
|
||||||
if vm:
|
if vm:
|
||||||
tunnel = sshtunnel.SSHTunnelForwarder(
|
tunnel = sshtunnel.SSHTunnelForwarder(
|
||||||
_host,
|
_host,
|
||||||
ssh_username=env_vars.get("ssh_username"),
|
ssh_username=config['ssh']["ssh_username"],
|
||||||
ssh_pkey=env_vars.get("ssh_pkey"),
|
ssh_pkey=config['ssh']["SSH_PRIVATEKEY"],
|
||||||
remote_bind_address=("127.0.0.1", _port),
|
remote_bind_address=("127.0.0.1", _port),
|
||||||
ssh_proxy_enabled=True,
|
ssh_proxy_enabled=True,
|
||||||
ssh_proxy=(_host, 22)
|
ssh_proxy=(_host, 22)
|
||||||
|
@ -373,7 +373,7 @@ def launch_vm(vm_entry, migration=False, migration_port=None, destination_host_k
|
||||||
parameters={"host": get_ipv6_address(), "port": migration_port},
|
parameters={"host": get_ipv6_address(), "port": migration_port},
|
||||||
uuid=vm_entry.uuid,
|
uuid=vm_entry.uuid,
|
||||||
destination_host_key=destination_host_key,
|
destination_host_key=destination_host_key,
|
||||||
request_prefix=env_vars.get("REQUEST_PREFIX")
|
request_prefix=config['etcd']["REQUEST_PREFIX"]
|
||||||
)
|
)
|
||||||
request_pool.put(r)
|
request_pool.put(r)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue