mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-25 19:32:24 +02:00
Return the working directory of a Qemu VM
This commit is contained in:
parent
d9745644cd
commit
2b36746d52
@ -1229,7 +1229,8 @@ class QemuVM(BaseVM):
|
|||||||
def __json__(self):
|
def __json__(self):
|
||||||
answer = {
|
answer = {
|
||||||
"project_id": self.project.id,
|
"project_id": self.project.id,
|
||||||
"vm_id": self.id
|
"vm_id": self.id,
|
||||||
|
"vm_directory": self.working_dir
|
||||||
}
|
}
|
||||||
# Qemu has a long list of options. The JSON schema is the single source of information
|
# Qemu has a long list of options. The JSON schema is the single source of information
|
||||||
for field in QEMU_OBJECT_SCHEMA["required"]:
|
for field in QEMU_OBJECT_SCHEMA["required"]:
|
||||||
|
|||||||
@ -358,6 +358,10 @@ QEMU_OBJECT_SCHEMA = {
|
|||||||
"description": "QEMU hdd disk image checksum",
|
"description": "QEMU hdd disk image checksum",
|
||||||
"type": ["string", "null"],
|
"type": ["string", "null"],
|
||||||
},
|
},
|
||||||
|
"vm_directory": {
|
||||||
|
"decription": "Path to the VM working directory",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"ram": {
|
"ram": {
|
||||||
"description": "amount of RAM in MB",
|
"description": "amount of RAM in MB",
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
@ -442,7 +446,7 @@ QEMU_OBJECT_SCHEMA = {
|
|||||||
"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", "ram", "adapters", "adapter_type", "mac_address",
|
"hdc_disk_image_md5sum", "hdd_disk_image_md5sum", "ram", "adapters", "adapter_type", "mac_address",
|
||||||
"console", "initrd", "kernel_image", "initrd_md5sum", "kernel_image_md5sum", "kernel_command_line",
|
"console", "initrd", "kernel_image", "initrd_md5sum", "kernel_image_md5sum", "kernel_command_line",
|
||||||
"legacy_networking", "acpi_shutdown", "cpu_throttling", "process_priority", "options"]
|
"legacy_networking", "acpi_shutdown", "cpu_throttling", "process_priority", "options","vm_directory"]
|
||||||
}
|
}
|
||||||
|
|
||||||
QEMU_BINARY_LIST_SCHEMA = {
|
QEMU_BINARY_LIST_SCHEMA = {
|
||||||
|
|||||||
@ -108,6 +108,7 @@ def test_qemu_get(server, project, vm):
|
|||||||
assert response.route == "/projects/{project_id}/qemu/vms/{vm_id}"
|
assert response.route == "/projects/{project_id}/qemu/vms/{vm_id}"
|
||||||
assert response.json["name"] == "PC TEST 1"
|
assert response.json["name"] == "PC TEST 1"
|
||||||
assert response.json["project_id"] == project.id
|
assert response.json["project_id"] == project.id
|
||||||
|
assert response.json["vm_directory"] == os.path.join(project.path, "project-files", "qemu", vm["vm_id"])
|
||||||
|
|
||||||
|
|
||||||
def test_qemu_start(server, vm):
|
def test_qemu_start(server, vm):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user