Fix issue with "usage" variable for Dynamips VMs. Fixes #1495

pull/1496/head
grossmj 5 years ago
parent b68c0cf176
commit f0ffb07165

@ -492,6 +492,10 @@ class Dynamips(BaseManager):
if sparse_memory_support is False: if sparse_memory_support is False:
await vm.set_sparsemem(False) await vm.set_sparsemem(False)
usage = settings.get("usage")
if usage and usage != vm.usage:
vm.usage = usage
# update the configs if needed # update the configs if needed
await self.set_vm_configs(vm, settings) await self.set_vm_configs(vm, settings)

@ -188,7 +188,6 @@ class Router(BaseNode):
else: else:
router_info["wic" + str(wic_slot_number)] = None router_info["wic" + str(wic_slot_number)] = None
return router_info return router_info
def _memory_changed(self, path): def _memory_changed(self, path):

@ -70,15 +70,15 @@ class DynamipsVMHandler:
if platform in DEFAULT_CHASSIS: if platform in DEFAULT_CHASSIS:
default_chassis = DEFAULT_CHASSIS[platform] default_chassis = DEFAULT_CHASSIS[platform]
vm = await dynamips_manager.create_node(request.json.pop("name"), vm = await dynamips_manager.create_node(request.json.pop("name"),
request.match_info["project_id"], request.match_info["project_id"],
request.json.get("node_id"), request.json.get("node_id"),
dynamips_id=request.json.get("dynamips_id"), dynamips_id=request.json.get("dynamips_id"),
platform=platform, platform=platform,
console=request.json.get("console"), console=request.json.get("console"),
console_type=request.json.get("console_type", "telnet"), console_type=request.json.get("console_type", "telnet"),
aux=request.json.get("aux"), aux=request.json.get("aux"),
chassis=request.json.pop("chassis", default_chassis), chassis=request.json.pop("chassis", default_chassis),
node_type="dynamips") node_type="dynamips")
await dynamips_manager.update_vm_settings(vm, request.json) await dynamips_manager.update_vm_settings(vm, request.json)
response.set_status(201) response.set_status(201)
response.json(vm) response.json(vm)

@ -30,6 +30,11 @@ DYNAMIPS_TEMPLATE_PROPERTIES = {
"type": "string", "type": "string",
"minLength": 1 "minLength": 1
}, },
"usage": {
"description": "How to use the Dynamips VM",
"type": "string",
"default": ""
},
"mmap": { "mmap": {
"description": "MMAP feature", "description": "MMAP feature",
"type": "boolean", "type": "boolean",

Loading…
Cancel
Save