Eject cdrom first before changing an image. Use 'force' when ejecting.

This commit is contained in:
grossmj 2019-06-15 15:20:21 +02:00
parent b7af2e4d5c
commit 7a463676cd

View File

@ -451,13 +451,14 @@ class QemuVM(BaseNode):
if self.is_running(): if self.is_running():
if self._cdrom_image: if self._cdrom_image:
self._cdrom_option() # this will check the cdrom image is accessible self._cdrom_option() # this will check the cdrom image is accessible
await self._control_vm("eject -f ide1-cd0")
await self._control_vm("change ide1-cd0 {}".format(self._cdrom_image)) 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, log.info('QEMU VM "{name}" [{id}] has changed the cdrom image path to {cdrom_image}'.format(name=self._name,
id=self._id, id=self._id,
cdrom_image=self._cdrom_image)) cdrom_image=self._cdrom_image))
else: else:
await self._control_vm("eject ide1-cd0") await self._control_vm("eject -f ide1-cd0")
log.info('QEMU VM "{name}" [{id}] has ejected the cdrom image for the guest OS'.format(name=self._name, id=self._id)) log.info('QEMU VM "{name}" [{id}] has ejected the cdrom image'.format(name=self._name, id=self._id))
@property @property
def bios_image(self): def bios_image(self):