From Fedora Project Wiki

Description

Change ISO media for a running guest.

Setup

Functioning virt host and VM. All VM OS welcome.

How to test

Add an empty CDROM device

If the guest does not have a CDROM device attached to it, add one:

  • Open virt-manager. Start with a shutoff VM.
  • Details->Add Hardware->Storage
  • Select 'Select managed or existing storage' but leave the text field blank. This creates a CDROM device with no media attached.
  • Select Device type: IDE CDROM
  • Select Finish

Change media in virt-manager

  • Start the VM. Log in to the desktop environment.
  • In virt-manager, select the CDROM device in the Details window.
  • Click 'Connect'. Specify ISO media of your choice. Click 'OK'.
  • Verify that the media is accessible in the guest.
  • In virt-manager, click 'Disconnect'.
  • Verify the media is no longer present in the guest.

Change media with virsh

  • With the guest still running as above, stay connected to the guest with virt-manager
  • In a terminal, insert media to the cdrom: sudo virsh change-media test-day-vm hda /path/to/my.iso
  • Verify the media is usable in the guest
  • Eject the media: sudo virsh change-media test-day-vm hda --eject
  • Verify the media is no longer present in the guest.

Expected Results

No obvious errors occur.