Bug 951192

Summary: virsh change-media does not work with VM which hasn't got a connected cdrom
Product: [Fedora] Fedora Reporter: Fabian Deutsch <fdeutsch>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: berrange, clalancette, crobinso, itamar, jforbes, jyang, laine, libvirt-maint, pkrempa, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.10.2.8-1.fc18 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-01 02:12:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 952499    
Bug Blocks: 948691    

Description Fabian Deutsch 2013-04-11 15:53:53 UTC
Description of problem:
A e.g. CDROM needs to be connected to a VM before it can be changed using change-media.
If no CDROM (source file) is connected then any change-media call will have no effect and virsh doesn't even complain about it!


Version-Release number of selected component (if applicable):


How reproducible:
always


Steps to Reproduce:
1. Define a VM with a ide cdrom but no connected file
2. use virsh --connect='qemu:///system' change-media dom-abc --path hdc --source /whatever/iso --force (with or without force)
3.
  
Actual results:
The cdrom file doesn't change

Expected results:
The cdrom file is changed

Additional info:

Comment 1 Fabian Deutsch 2013-04-11 16:16:44 UTC
I suppose virt-managre works because it's using it's own change-media thingy. ...

Comment 2 Fabian Deutsch 2013-04-12 08:59:06 UTC
I can get this working by assigning a dummy file as a source to a fresh VM initially, but this is not very nice and I haven't got this possibility in my scenario.

So does someone maybe know a workaround?

Comment 3 Peter Krempa 2013-04-12 09:06:31 UTC
Did you try it with specifying the "--insert" flag along with others you tried?

Comment 4 Fabian Deutsch 2013-04-12 09:19:08 UTC
Hey Peter,

yes I did, I tried several combinations, let me list them:

$ sudo virsh --connect='qemu:///system' change-media --domain default-i-i2FFoKDTc2 --path hdc --source /var/tmp/igor/boot.iso --insert
succeeded to complete action insert on media

$ sudo virsh --connect='qemu:///system' change-media --domain default-i-i2FFoKDTc2 --path hdc --source /var/tmp/igor/boot.iso --insert --force
succeeded to complete action insert on media

$ sudo virsh --connect='qemu:///system' change-media --domain default-i-i2FFoKDTc2 --path hdc --source /var/tmp/igor/boot.iso --update
succeeded to complete action update on media

$ sudo virsh --connect='qemu:///system' change-media --domain default-i-i2FFoKDTc2 --path hdc --source /var/tmp/igor/boot.iso --update --force
succeeded to complete action update on media

$ sudo virsh --connect='qemu:///system' change-media --domain default-i-i2FFoKDTc2 --path hdc --source /var/tmp/igor/boot.iso --live 
succeeded to complete action update on media

$ sudo virsh --connect='qemu:///system' change-media --domain default-i-i2FFoKDTc2 --path hdc --source /var/tmp/igor/boot.iso --live --force
succeeded to complete action update on media


But the media never changed

Comment 5 Fabian Deutsch 2013-04-15 07:50:23 UTC
Any news or hints on this?

Comment 6 Peter Krempa 2013-04-16 08:55:42 UTC
This seems to be a bug in the qemu driver or qemu. We will need to investigate this further.

Comment 7 Fabian Deutsch 2013-04-19 11:54:44 UTC
Hey Peter,

I suppose the problem was that i created a block device:

    <disk type='block' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hdc' bus='ide' tray='open'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>

it works when using type='file'

Comment 8 Cole Robinson 2013-09-01 00:27:44 UTC
This is fixed upstream, but needs backport to F18 and F19:

commit 7729a16814d5bf3aebd248c9af00296ae2773818
Author: Guannan Ren <gren>
Date:   Mon Jul 22 15:38:43 2013 +0800

    virsh: fix change-media bug on disk block type
    
    Resolves:https://bugzilla.redhat.com/show_bug.cgi?id=923053
    When cdrom is block type, the virsh change-media failed to insert
    source info because virsh uses "<source block='/dev/sdb'/>" while
    the correct name of the attribute for block disks is "dev".

Comment 9 Fabian Deutsch 2013-09-02 12:39:26 UTC
Thanks for this update. I'm looking forward to this change!

Comment 10 Fedora Update System 2013-09-20 21:42:35 UTC
libvirt-0.10.2.8-1.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/libvirt-0.10.2.8-1.fc18

Comment 11 Fedora Update System 2013-09-21 08:30:25 UTC
Package libvirt-0.10.2.8-1.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing libvirt-0.10.2.8-1.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-17305/libvirt-0.10.2.8-1.fc18
then log in and leave karma (feedback).

Comment 12 Fedora Update System 2013-10-01 02:12:21 UTC
libvirt-0.10.2.8-1.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.