[Libvir] [PATCH] Allow modifying existing block device, making virDomainAttachDevice modify the device if it already exists

Hugh Brock hbrock at redhat.com
Thu Sep 6 18:37:50 UTC 2007


Daniel P. Berrange wrote:
> On Thu, Sep 06, 2007 at 11:59:08AM -0400, Daniel Veillard wrote:
>> On Thu, Sep 06, 2007 at 11:45:39AM -0400, Hugh Brock wrote:
>>> The attached patch adds code to xend_internal.c:xenDomainAttachDevice 
>>> that checks to see if the device mentioned in the passed-in XML already 
>>> exists, and if so calls op_device_configure to modify the device. It is 
>>> particularly useful for connecting and disconnecting a hardware cdrom 
>>> device to an FV guest.
>>>
>>   virDomainXMLDevID looks frightening to me since we write to an array of
>> undisclosed size, but that is independant from the patch which looks fine to
>> me.
> 
> Yep, this patch is fine, but we absolutely have to fix virDomainXMLDevID
> as the value it writes into the pre-allocated 'ref' parameter is taken from
> an XML attribute which can be an arbitrary size & can thus potentially 
> overflow the '80' char buffer passed from xenDaemonDetachDevice or this
> new call for changing CD media.
> 
> Dan.

Very good -- if someone would apply this one please, I will have a look 
at making the XMLDevID code a bit saner...

--Hugh

-- 
Red Hat Virtualization Group http://redhat.com/virtualization
Hugh Brock           | virt-manager http://virt-manager.org
hbrock at redhat.com    | virtualization library http://libvirt.org




More information about the libvir-list mailing list