mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-01 04:38:12 +00:00
Refresh mounted media after ISO switch.
This commit is contained in:
parent
61c87e57a4
commit
b7af2e4d5c
@ -434,10 +434,30 @@ class QemuVM(BaseNode):
|
|||||||
:param cdrom_image: QEMU cdrom image path
|
:param cdrom_image: QEMU cdrom image path
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self._cdrom_image = self.manager.get_abs_image_path(cdrom_image, self.project.path)
|
if cdrom_image:
|
||||||
log.info('QEMU VM "{name}" [{id}] has set the QEMU cdrom image path to {cdrom_image}'.format(name=self._name,
|
self._cdrom_image = self.manager.get_abs_image_path(cdrom_image, self.project.path)
|
||||||
id=self._id,
|
|
||||||
cdrom_image=self._cdrom_image))
|
log.info('QEMU VM "{name}" [{id}] has set the QEMU cdrom image path to {cdrom_image}'.format(name=self._name,
|
||||||
|
id=self._id,
|
||||||
|
cdrom_image=self._cdrom_image))
|
||||||
|
else:
|
||||||
|
self._cdrom_image = ""
|
||||||
|
|
||||||
|
async def update_cdrom_image(self):
|
||||||
|
"""
|
||||||
|
Update the cdrom image path for the Qemu guest OS
|
||||||
|
"""
|
||||||
|
|
||||||
|
if self.is_running():
|
||||||
|
if self._cdrom_image:
|
||||||
|
self._cdrom_option() # this will check the cdrom image is accessible
|
||||||
|
await self._control_vm("change ide1-cd0 {}".format(self._cdrom_image))
|
||||||
|
log.info('QEMU VM "{name}" [{id}] has changed the cdrom image path to {cdrom_image} for the guest OS'.format(name=self._name,
|
||||||
|
id=self._id,
|
||||||
|
cdrom_image=self._cdrom_image))
|
||||||
|
else:
|
||||||
|
await self._control_vm("eject ide1-cd0")
|
||||||
|
log.info('QEMU VM "{name}" [{id}] has ejected the cdrom image for the guest OS'.format(name=self._name, id=self._id))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def bios_image(self):
|
def bios_image(self):
|
||||||
|
@ -116,7 +116,7 @@ class QEMUHandler:
|
|||||||
description="Update a Qemu VM instance",
|
description="Update a Qemu VM instance",
|
||||||
input=QEMU_UPDATE_SCHEMA,
|
input=QEMU_UPDATE_SCHEMA,
|
||||||
output=QEMU_OBJECT_SCHEMA)
|
output=QEMU_OBJECT_SCHEMA)
|
||||||
def update(request, response):
|
async def update(request, response):
|
||||||
|
|
||||||
qemu_manager = Qemu.instance()
|
qemu_manager = Qemu.instance()
|
||||||
vm = qemu_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
vm = qemu_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||||
@ -125,6 +125,9 @@ class QEMUHandler:
|
|||||||
for name, value in request.json.items():
|
for name, value in request.json.items():
|
||||||
if hasattr(vm, name) and getattr(vm, name) != value:
|
if hasattr(vm, name) and getattr(vm, name) != value:
|
||||||
setattr(vm, name, value)
|
setattr(vm, name, value)
|
||||||
|
if name == "cdrom_image":
|
||||||
|
# let the guest know about the new cdrom image
|
||||||
|
await vm.update_cdrom_image()
|
||||||
|
|
||||||
vm.updated()
|
vm.updated()
|
||||||
response.json(vm)
|
response.json(vm)
|
||||||
|
Loading…
Reference in New Issue
Block a user