mirror of
https://github.com/GNS3/gns3-server
synced 2025-01-12 09:00:57 +00:00
Enable KVM acceleration option.
This commit is contained in:
parent
c7ea8517a1
commit
d518ac45f5
@ -84,6 +84,7 @@ class QemuVM(BaseVM):
|
|||||||
self._kernel_image = ""
|
self._kernel_image = ""
|
||||||
self._kernel_command_line = ""
|
self._kernel_command_line = ""
|
||||||
self._legacy_networking = False
|
self._legacy_networking = False
|
||||||
|
self._kvm = True
|
||||||
self._acpi_shutdown = False
|
self._acpi_shutdown = False
|
||||||
self._cpu_throttling = 0 # means no CPU throttling
|
self._cpu_throttling = 0 # means no CPU throttling
|
||||||
self._process_priority = "low"
|
self._process_priority = "low"
|
||||||
@ -354,6 +355,30 @@ class QemuVM(BaseVM):
|
|||||||
log.info('QEMU VM "{name}" [{id}] has disabled ACPI shutdown'.format(name=self._name, id=self._id))
|
log.info('QEMU VM "{name}" [{id}] has disabled ACPI shutdown'.format(name=self._name, id=self._id))
|
||||||
self._acpi_shutdown = acpi_shutdown
|
self._acpi_shutdown = acpi_shutdown
|
||||||
|
|
||||||
|
@property
|
||||||
|
def kvm(self):
|
||||||
|
"""
|
||||||
|
Returns either this QEMU VM uses KVM acceleration.
|
||||||
|
|
||||||
|
:returns: boolean
|
||||||
|
"""
|
||||||
|
|
||||||
|
return self._kvm
|
||||||
|
|
||||||
|
@kvm.setter
|
||||||
|
def kvm(self, kvm):
|
||||||
|
"""
|
||||||
|
Sets either this QEMU VM uses KVM acceleration.
|
||||||
|
|
||||||
|
:param kvm: boolean
|
||||||
|
"""
|
||||||
|
|
||||||
|
if kvm:
|
||||||
|
log.info('QEMU VM "{name}" [{id}] has enabled KVM acceleration'.format(name=self._name, id=self._id))
|
||||||
|
else:
|
||||||
|
log.info('QEMU VM "{name}" [{id}] has disabled KVM acceleration'.format(name=self._name, id=self._id))
|
||||||
|
self._kvm = kvm
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cpu_throttling(self):
|
def cpu_throttling(self):
|
||||||
"""
|
"""
|
||||||
@ -1127,6 +1152,8 @@ class QemuVM(BaseVM):
|
|||||||
command = [self.qemu_path]
|
command = [self.qemu_path]
|
||||||
command.extend(["-name", self._name])
|
command.extend(["-name", self._name])
|
||||||
command.extend(["-m", str(self._ram)])
|
command.extend(["-m", str(self._ram)])
|
||||||
|
if sys.platform.startswith("linux") and self._kvm:
|
||||||
|
command.extend(["-enable-kvm"])
|
||||||
disk_options = yield from self._disk_options()
|
disk_options = yield from self._disk_options()
|
||||||
command.extend(disk_options)
|
command.extend(disk_options)
|
||||||
command.extend(self._linux_boot_options())
|
command.extend(self._linux_boot_options())
|
||||||
|
@ -104,6 +104,10 @@ QEMU_CREATE_SCHEMA = {
|
|||||||
"description": "ACPI shutdown support",
|
"description": "ACPI shutdown support",
|
||||||
"type": ["boolean", "null"],
|
"type": ["boolean", "null"],
|
||||||
},
|
},
|
||||||
|
"kvm": {
|
||||||
|
"description": "KVM support",
|
||||||
|
"type": ["boolean", "null"],
|
||||||
|
},
|
||||||
"cpu_throttling": {
|
"cpu_throttling": {
|
||||||
"description": "Percentage of CPU allowed for QEMU",
|
"description": "Percentage of CPU allowed for QEMU",
|
||||||
"minimum": 0,
|
"minimum": 0,
|
||||||
@ -207,6 +211,10 @@ QEMU_UPDATE_SCHEMA = {
|
|||||||
"description": "ACPI shutdown support",
|
"description": "ACPI shutdown support",
|
||||||
"type": ["boolean", "null"],
|
"type": ["boolean", "null"],
|
||||||
},
|
},
|
||||||
|
"kvm": {
|
||||||
|
"description": "KVM support",
|
||||||
|
"type": ["boolean", "null"],
|
||||||
|
},
|
||||||
"cpu_throttling": {
|
"cpu_throttling": {
|
||||||
"description": "Percentage of CPU allowed for QEMU",
|
"description": "Percentage of CPU allowed for QEMU",
|
||||||
"minimum": 0,
|
"minimum": 0,
|
||||||
@ -319,6 +327,10 @@ QEMU_OBJECT_SCHEMA = {
|
|||||||
"description": "ACPI shutdown support",
|
"description": "ACPI shutdown support",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
},
|
},
|
||||||
|
"kvm": {
|
||||||
|
"description": "KVM support",
|
||||||
|
"type": ["boolean", "null"],
|
||||||
|
},
|
||||||
"cpu_throttling": {
|
"cpu_throttling": {
|
||||||
"description": "Percentage of CPU allowed for QEMU",
|
"description": "Percentage of CPU allowed for QEMU",
|
||||||
"minimum": 0,
|
"minimum": 0,
|
||||||
@ -342,7 +354,7 @@ QEMU_OBJECT_SCHEMA = {
|
|||||||
"additionalProperties": False,
|
"additionalProperties": False,
|
||||||
"required": ["vm_id", "project_id", "name", "qemu_path", "hda_disk_image", "hdb_disk_image",
|
"required": ["vm_id", "project_id", "name", "qemu_path", "hda_disk_image", "hdb_disk_image",
|
||||||
"hdc_disk_image", "hdd_disk_image", "ram", "adapters", "adapter_type", "mac_address", "console",
|
"hdc_disk_image", "hdd_disk_image", "ram", "adapters", "adapter_type", "mac_address", "console",
|
||||||
"initrd", "kernel_image", "kernel_command_line", "legacy_networking", "acpi_shutdown",
|
"initrd", "kernel_image", "kernel_command_line", "legacy_networking", "acpi_shutdown", "kvm",
|
||||||
"cpu_throttling", "process_priority", "options"]
|
"cpu_throttling", "process_priority", "options"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user