[libvirt] [PATCH] virsh: Correctly detect inserted media in change-media command

Pavel Hrdina phrdina at redhat.com
Mon Jan 25 12:45:03 UTC 2016


On Wed, Jan 13, 2016 at 05:39:10PM +0100, Michal Privoznik wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1250331
> 
> It all works like this. The change-media command dumps domain
> XML, finds the corresponding cdrom device we want to change media
> in and returns it in the xmlNodePtr form. This way we don't have
> to bother with keeping all the subelements or attributes that we
> don't care about in the XML that is fed back to libvirt for the
> update API.
> 
> Now, the problem is we try to be clever here and detect if disk
> already has a source (indicated by <source/> subelement).
> However, bare fact that the element is there does not mean disk
> has source. The element has some attributes and only if @file or
> @dev is within them disk has source. Any other attribute is
> meaningless for our purpose now. Make our clever check better.

That's not true, what about disk type='dir|volume|network'?  Those could be also
used as cdrom or floppy.  The patch looks good, but extend it to detect all
possible disk types.




More information about the libvir-list mailing list