mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Support for CPUs setting for Qemu VMs.
This commit is contained in:
parent
217945339e
commit
5121753232
@ -97,6 +97,7 @@ class QemuVM(BaseVM):
|
|||||||
self._mac_address = ""
|
self._mac_address = ""
|
||||||
self._options = ""
|
self._options = ""
|
||||||
self._ram = 256
|
self._ram = 256
|
||||||
|
self._cpus = 1
|
||||||
self._ethernet_adapters = []
|
self._ethernet_adapters = []
|
||||||
self._adapter_type = "e1000"
|
self._adapter_type = "e1000"
|
||||||
self._initrd = ""
|
self._initrd = ""
|
||||||
@ -602,6 +603,27 @@ class QemuVM(BaseVM):
|
|||||||
log.info('QEMU VM "{name}" [{id}] has set the RAM to {ram}'.format(name=self._name, id=self._id, ram=ram))
|
log.info('QEMU VM "{name}" [{id}] has set the RAM to {ram}'.format(name=self._name, id=self._id, ram=ram))
|
||||||
self._ram = ram
|
self._ram = ram
|
||||||
|
|
||||||
|
@property
|
||||||
|
def cpus(self):
|
||||||
|
"""
|
||||||
|
Returns the number of vCPUs this QEMU VM.
|
||||||
|
|
||||||
|
:returns: number of vCPUs.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return self._cpus
|
||||||
|
|
||||||
|
@cpus.setter
|
||||||
|
def cpus(self, cpus):
|
||||||
|
"""
|
||||||
|
Sets the number of vCPUs this QEMU VM.
|
||||||
|
|
||||||
|
:param cpus: number of vCPUs.
|
||||||
|
"""
|
||||||
|
|
||||||
|
log.info('QEMU VM "{name}" [{id}] has set the number of vCPUs to {cpus}'.format(name=self._name, id=self._id, cpus=cpus))
|
||||||
|
self._cpus = cpus
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def options(self):
|
def options(self):
|
||||||
"""
|
"""
|
||||||
@ -1344,6 +1366,7 @@ 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)])
|
||||||
|
command.extend(["-smp", "cpus={}".format(self._cpus)])
|
||||||
if sys.platform.startswith("linux") and self.manager.config.get_section_config("Qemu").getboolean("enable_kvm", True) \
|
if sys.platform.startswith("linux") and self.manager.config.get_section_config("Qemu").getboolean("enable_kvm", True) \
|
||||||
and "-no-kvm" not in self._options:
|
and "-no-kvm" not in self._options:
|
||||||
if not os.path.exists("/dev/kvm"):
|
if not os.path.exists("/dev/kvm"):
|
||||||
|
@ -121,6 +121,12 @@ QEMU_CREATE_SCHEMA = {
|
|||||||
"description": "amount of RAM in MB",
|
"description": "amount of RAM in MB",
|
||||||
"type": ["integer", "null"]
|
"type": ["integer", "null"]
|
||||||
},
|
},
|
||||||
|
"cpus": {
|
||||||
|
"description": "number of vCPUs",
|
||||||
|
"type": ["integer", "null"],
|
||||||
|
"minimum": 1,
|
||||||
|
"maximum": 255,
|
||||||
|
},
|
||||||
"adapters": {
|
"adapters": {
|
||||||
"description": "number of adapters",
|
"description": "number of adapters",
|
||||||
"type": ["integer", "null"],
|
"type": ["integer", "null"],
|
||||||
@ -284,6 +290,12 @@ QEMU_UPDATE_SCHEMA = {
|
|||||||
"description": "amount of RAM in MB",
|
"description": "amount of RAM in MB",
|
||||||
"type": ["integer", "null"]
|
"type": ["integer", "null"]
|
||||||
},
|
},
|
||||||
|
"cpus": {
|
||||||
|
"description": "number of vCPUs",
|
||||||
|
"type": ["integer", "null"],
|
||||||
|
"minimum": 1,
|
||||||
|
"maximum": 255,
|
||||||
|
},
|
||||||
"adapters": {
|
"adapters": {
|
||||||
"description": "number of adapters",
|
"description": "number of adapters",
|
||||||
"type": ["integer", "null"],
|
"type": ["integer", "null"],
|
||||||
@ -450,6 +462,12 @@ QEMU_OBJECT_SCHEMA = {
|
|||||||
"description": "amount of RAM in MB",
|
"description": "amount of RAM in MB",
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
"cpus": {
|
||||||
|
"description": "number of vCPUs",
|
||||||
|
"type": ["integer", "null"],
|
||||||
|
"minimum": 1,
|
||||||
|
"maximum": 255,
|
||||||
|
},
|
||||||
"adapters": {
|
"adapters": {
|
||||||
"description": "number of adapters",
|
"description": "number of adapters",
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
@ -529,7 +547,7 @@ QEMU_OBJECT_SCHEMA = {
|
|||||||
"required": ["vm_id", "project_id", "name", "qemu_path", "platform", "console_type", "hda_disk_image", "hdb_disk_image",
|
"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", "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",
|
"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", "adapters", "adapter_type",
|
"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",
|
"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"]
|
"legacy_networking", "acpi_shutdown", "cpu_throttling", "process_priority", "options", "vm_directory"]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user