mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-19 04:47:54 +00: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):
|
||||
answer = {
|
||||
"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
|
||||
for field in QEMU_OBJECT_SCHEMA["required"]:
|
||||
|
@ -358,6 +358,10 @@ QEMU_OBJECT_SCHEMA = {
|
||||
"description": "QEMU hdd disk image checksum",
|
||||
"type": ["string", "null"],
|
||||
},
|
||||
"vm_directory": {
|
||||
"decription": "Path to the VM working directory",
|
||||
"type": "string"
|
||||
},
|
||||
"ram": {
|
||||
"description": "amount of RAM in MB",
|
||||
"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_md5sum", "hdd_disk_image_md5sum", "ram", "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"]
|
||||
"legacy_networking", "acpi_shutdown", "cpu_throttling", "process_priority", "options","vm_directory"]
|
||||
}
|
||||
|
||||
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.json["name"] == "PC TEST 1"
|
||||
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):
|
||||
|
Loading…
Reference in New Issue
Block a user