Support VM usage for qemu

Ref https://github.com/GNS3/gns3-gui/issues/829
This commit is contained in:
Julien Duponchelle 2015-12-01 10:54:51 +01:00
parent e626c0b55c
commit 42a4df5079
2 changed files with 72 additions and 6 deletions

View File

@ -48,6 +48,7 @@ class BaseVM:
def __init__(self, name, vm_id, project, manager, console=None, console_type="telnet"):
self._name = name
self._usage = ""
self._id = vm_id
self._project = project
self._manager = manager
@ -124,6 +125,26 @@ class BaseVM:
new_name=new_name))
self._name = new_name
@property
def usage(self):
"""
Returns the usage for this VM.
:returns: usage
"""
return self._usage
@usage.setter
def usage(self, new_usage):
"""
Sets the usage of this VM.
:param new_usage: usage
"""
self._usage = new_usage
@property
def id(self):
"""

View File

@ -38,6 +38,10 @@ QEMU_CREATE_SCHEMA = {
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the qemu VM",
"type": "string",
},
"linked_clone": {
"description": "either the VM is a linked clone or not",
"type": "boolean"
@ -211,6 +215,10 @@ QEMU_UPDATE_SCHEMA = {
"type": ["string", "null"],
"minLength": 1,
},
"usage": {
"description": "How to use the qemu VM",
"type": "string",
},
"qemu_path": {
"description": "Path to QEMU",
"type": ["string", "null"],
@ -389,6 +397,10 @@ QEMU_OBJECT_SCHEMA = {
"type": "string",
"minLength": 1,
},
"usage": {
"description": "How to use the qemu VM",
"type": "string",
},
"qemu_path": {
"description": "path to QEMU",
"type": "string",
@ -548,12 +560,45 @@ QEMU_OBJECT_SCHEMA = {
},
},
"additionalProperties": False,
"required": ["vm_id", "project_id", "name", "qemu_path", "platform", "console_type", "hda_disk_image", "hdb_disk_image",
"hdc_disk_image", "hdd_disk_image", "hda_disk_image_md5sum", "hdb_disk_image_md5sum",
"hdc_disk_image_md5sum", "hdd_disk_image_md5sum", "hda_disk_interface", "hdb_disk_interface", "hdc_disk_interface",
"hdd_disk_interface", "cdrom_image", "cdrom_image_md5sum", "boot_priority", "ram", "cpus", "adapters", "adapter_type",
"mac_address", "console", "initrd", "kernel_image", "initrd_md5sum", "kernel_image_md5sum", "kernel_command_line",
"legacy_networking", "acpi_shutdown", "cpu_throttling", "process_priority", "options", "vm_directory"]
"required": ["vm_id",
"project_id",
"name",
"usage",
"qemu_path",
"platform",
"console_type",
"hda_disk_image",
"hdb_disk_image",
"hdc_disk_image",
"hdd_disk_image",
"hda_disk_image_md5sum",
"hdb_disk_image_md5sum",
"hdc_disk_image_md5sum",
"hdd_disk_image_md5sum",
"hda_disk_interface",
"hdb_disk_interface",
"hdc_disk_interface",
"hdd_disk_interface",
"cdrom_image",
"cdrom_image_md5sum",
"boot_priority",
"ram",
"cpus",
"adapters",
"adapter_type",
"mac_address",
"console",
"initrd",
"kernel_image",
"initrd_md5sum",
"kernel_image_md5sum",
"kernel_command_line",
"legacy_networking",
"acpi_shutdown",
"cpu_throttling",
"process_priority",
"options",
"vm_directory"]
}
QEMU_BINARY_LIST_SCHEMA = {