Daniel Veillard wrote:
On Wed, Jul 18, 2007 at 10:40:48AM +0100, Richard W.M. Jones wrote:
> Hugh Brock wrote:
>> I'm looking at ways to replicate xm block-configure at the libvirt
>> level. xm block-configure is useful in that it allows you to change the
>> back device for an HVM guest while the guest is still running; this
>> permits you for example to change the CDROM without shutting down your
>> guest or poking around in xenstore. Thus we can have an "eject" button
>> on cdrom devices in virt-manager (or "eject" and "load"
buttons, I
>> guess), which we really need.
>>
>> The issue of course is that xm block-configure is specifically intended
>> for block devices and takes arguments for the back device and the front
>> device (among others). We would naturally prefer to accept a block of
>> XML just as virDomainAttachDevice does and then parse it, determine if
>> the device in question is of a type we can actually edit, determine if
>> the new backdev is appropriate, and so on.
> Definitely this will be useful for USB ...
>
> I think the question is: Should we have another entry point
> (virDomainConfigureDevice), or should we just modify
> virDomainAttachDevice so that if it sees XML for a device which is
> already attached it just modifies the device?
It was raised previously that it's okay to recreate an existing domain
to modify its configuration, then allowing virDomainAttachDevice to
override an existing definition would be consistent with this. Another
bonus point is one less entry point in the library and drivers.
Yes, that's right. I'm certainly in favor of reducing entry points,
although if we allow virDomainAttachDevice to also modify existing
devices, then it isn't quite named correctly... virDomainDefineDevice
would probably be better. Too bad I guess.
Next question is, how much protection do we want to build into the API?
Do we want to rely on whatever hypervisor we're talking to to, for
example, not allow us to change the back device for a disk on a running
guest, or do we need to protect against that ourselves?
--Hugh
--
Red Hat Virtualization Group
http://redhat.com/virtualization
Hugh Brock | virt-manager
http://virt-manager.org
hbrock(a)redhat.com | virtualization library
http://libvirt.org