mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 03:08:14 +00:00
IOUCON start when vm start
This commit is contained in:
parent
986c63f344
commit
faa7472670
@ -46,10 +46,10 @@ class IOUHandler:
|
||||
|
||||
iou = IOU.instance()
|
||||
vm = yield from iou.create_vm(request.json["name"],
|
||||
request.match_info["project_id"],
|
||||
request.json.get("vm_id"),
|
||||
console=request.json.get("console"),
|
||||
)
|
||||
request.match_info["project_id"],
|
||||
request.json.get("vm_id"),
|
||||
console=request.json.get("console"),
|
||||
)
|
||||
vm.iou_path = request.json.get("iou_path", vm.iou_path)
|
||||
vm.iourc_path = request.json.get("iourc_path", vm.iourc_path)
|
||||
response.set_status(201)
|
||||
|
@ -27,12 +27,15 @@ import signal
|
||||
import re
|
||||
import asyncio
|
||||
import shutil
|
||||
import argparse
|
||||
import threading
|
||||
|
||||
from pkg_resources import parse_version
|
||||
from .iou_error import IOUError
|
||||
from ..adapters.ethernet_adapter import EthernetAdapter
|
||||
from ..adapters.serial_adapter import SerialAdapter
|
||||
from ..base_vm import BaseVM
|
||||
from .ioucon import start_ioucon
|
||||
|
||||
|
||||
import logging
|
||||
@ -50,9 +53,12 @@ class IOUVM(BaseVM):
|
||||
:param project: Project instance
|
||||
:param manager: parent VM Manager
|
||||
:param console: TCP console port
|
||||
:params console_host: TCP console host IP
|
||||
"""
|
||||
|
||||
def __init__(self, name, vm_id, project, manager, console=None):
|
||||
def __init__(self, name, vm_id, project, manager,
|
||||
console=None,
|
||||
console_host="0.0.0.0"):
|
||||
|
||||
super().__init__(name, vm_id, project, manager)
|
||||
|
||||
@ -65,6 +71,7 @@ class IOUVM(BaseVM):
|
||||
self._iou_path = None
|
||||
self._iourc_path = None
|
||||
self._ioucon_thread = None
|
||||
self._console_host = console_host
|
||||
|
||||
# IOU settings
|
||||
self._ethernet_adapters = [EthernetAdapter(), EthernetAdapter()] # one adapter = 4 interfaces
|
||||
@ -292,7 +299,7 @@ class IOUVM(BaseVM):
|
||||
raise IOUError("could not start IOU {}: {}\n{}".format(self._iou_path, e, iou_stdout))
|
||||
|
||||
# start console support
|
||||
# self._start_ioucon()
|
||||
self._start_ioucon()
|
||||
# connections support
|
||||
# self._start_iouyap()
|
||||
|
||||
|
@ -55,7 +55,7 @@ EXIT_ABORT = 2
|
||||
|
||||
# Mostly from:
|
||||
# https://code.google.com/p/miniboa/source/browse/trunk/miniboa/telnet.py
|
||||
#--[ Telnet Commands ]---------------------------------------------------------
|
||||
# --[ Telnet Commands ]---------------------------------------------------------
|
||||
SE = 240 # End of sub-negotiation parameters
|
||||
NOP = 241 # No operation
|
||||
DATMK = 242 # Data stream portion of a sync.
|
||||
@ -74,7 +74,7 @@ DONT = 254 # Don't = Demand or confirm option halt
|
||||
IAC = 255 # Interpret as Command
|
||||
SEND = 1 # Sub-process negotiation SEND command
|
||||
IS = 0 # Sub-process negotiation IS command
|
||||
#--[ Telnet Options ]----------------------------------------------------------
|
||||
# --[ Telnet Options ]----------------------------------------------------------
|
||||
BINARY = 0 # Transmit Binary
|
||||
ECHO = 1 # Echo characters back to sender
|
||||
RECON = 2 # Reconnection
|
@ -32,6 +32,7 @@ def fake_iou_bin(tmpdir):
|
||||
os.chmod(path, stat.S_IREAD | stat.S_IEXEC)
|
||||
return path
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def base_params(tmpdir, fake_iou_bin):
|
||||
"""Return standard parameters"""
|
||||
@ -91,7 +92,7 @@ def test_iou_delete(server, vm):
|
||||
|
||||
def test_iou_update(server, vm, tmpdir, free_console_port):
|
||||
response = server.put("/projects/{project_id}/iou/vms/{vm_id}".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), {"name": "test",
|
||||
"console": free_console_port})
|
||||
"console": free_console_port})
|
||||
assert response.status == 200
|
||||
assert response.json["name"] == "test"
|
||||
assert response.json["console"] == free_console_port
|
||||
|
Loading…
Reference in New Issue
Block a user