mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Merge branch 'master' into unstable
This commit is contained in:
commit
cf0adf56a8
8 files changed
+20
-32
No files matched your search
@@ -59,8 +59,6 @@ class IOUHandler:
|
||||
for name, value in request.json.items():
|
||||
if hasattr(vm, name) and getattr(vm, name) != value:
|
||||
setattr(vm, name, value)
|
||||
if "initial_config_content" in request.json:
|
||||
vm.initial_config = request.json.get("initial_config_content")
|
||||
response.set_status(201)
|
||||
response.json(vm)
|
||||
|
||||
@@ -108,8 +106,6 @@ class IOUHandler:
|
||||
for name, value in request.json.items():
|
||||
if hasattr(vm, name) and getattr(vm, name) != value:
|
||||
setattr(vm, name, value)
|
||||
if "initial_config_content" in request.json:
|
||||
vm.initial_config = request.json.get("initial_config_content")
|
||||
response.json(vm)
|
||||
|
||||
@classmethod
|
||||
@@ -309,4 +305,4 @@ class IOUHandler:
|
||||
vm = iou_manager.get_vm(request.match_info["vm_id"],
|
||||
project_id=request.match_info["project_id"])
|
||||
response.set_status(200)
|
||||
response.json({"content": vm.initial_config})
|
||||
response.json({"content": vm.initial_config_content})
|
||||
@@ -317,9 +317,9 @@ class IOUVM(BaseVM):
|
||||
"""
|
||||
|
||||
if self.initial_config_file:
|
||||
content = self.initial_config
|
||||
content = self.initial_config_content
|
||||
content = content.replace(self._name, new_name)
|
||||
self.initial_config = content
|
||||
self.initial_config_content = content
|
||||
|
||||
super(IOUVM, IOUVM).name.__set__(self, new_name)
|
||||
|
||||
@@ -939,7 +939,7 @@ class IOUVM(BaseVM):
|
||||
log.warn("could not determine if layer 1 keepalive messages are supported by {}: {}".format(os.path.basename(self._path), e))
|
||||
|
||||
@property
|
||||
def initial_config(self):
|
||||
def initial_config_content(self):
|
||||
"""
|
||||
Returns the content of the current initial-config file.
|
||||
"""
|
||||
@@ -952,10 +952,10 @@ class IOUVM(BaseVM):
|
||||
with open(config_file) as f:
|
||||
return f.read()
|
||||
except OSError as e:
|
||||
raise IOUError("Can't read configuration file '{}'".format(config_file))
|
||||
raise IOUError("Can't read configuration file '{}': {}".format(config_file, e))
|
||||
|
||||
@initial_config.setter
|
||||
def initial_config(self, initial_config):
|
||||
@initial_config_content.setter
|
||||
def initial_config_content(self, initial_config):
|
||||
"""
|
||||
Update the initial config
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ class Qemu(BaseManager):
|
||||
for path in paths:
|
||||
try:
|
||||
for f in os.listdir(path):
|
||||
if (f.startswith("qemu-system") or f == "qemu" or f == "qemu.exe") and \
|
||||
if (f.startswith("qemu-system") or f.startswith("qemu-kvm") or f == "qemu" or f == "qemu.exe") and \
|
||||
os.access(os.path.join(path, f), os.X_OK) and \
|
||||
os.path.isfile(os.path.join(path, f)):
|
||||
qemu_path = os.path.join(path, f)
|
||||
|
||||
@@ -284,20 +284,10 @@ VM_UPDATE_SCHEMA = {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
},
|
||||
"startup_config": {
|
||||
"description": "path to the IOS startup configuration file",
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
},
|
||||
"startup_config_content": {
|
||||
"description": "Content of IOS startup configuration file",
|
||||
"type": "string",
|
||||
},
|
||||
"private_config": {
|
||||
"description": "path to the IOS private configuration file",
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
},
|
||||
"private_config_content": {
|
||||
"description": "Content of IOS private configuration file",
|
||||
"type": "string",
|
||||
|
||||
@@ -127,10 +127,6 @@ IOU_UPDATE_SCHEMA = {
|
||||
"description": "Always up ethernet interface",
|
||||
"type": ["boolean", "null"]
|
||||
},
|
||||
"initial_config": {
|
||||
"description": "Path to the initial configuration of IOU",
|
||||
"type": ["string", "null"]
|
||||
},
|
||||
"initial_config_content": {
|
||||
"description": "Initial configuration of IOU",
|
||||
"type": ["string", "null"]
|
||||
|
||||
@@ -225,6 +225,11 @@ class Server:
|
||||
|
||||
try:
|
||||
self._loop.run_forever()
|
||||
except OSError as e:
|
||||
# This is to ignore OSError: [WinError 0] The operation completed successfully
|
||||
# exception on Windows.
|
||||
if not sys.platform.startswith("win") and not e.winerror == 0:
|
||||
raise
|
||||
except TypeError as e:
|
||||
# This is to ignore an asyncio.windows_events exception
|
||||
# on Windows when the process gets the SIGBREAK signal
|
||||
|
||||
Reference in new issue
Block a user