[Libvir] [PATCH] Have xenDaemonDetachDevice() remove device configuration

Daniel Veillard veillard at redhat.com
Thu Apr 10 11:38:27 UTC 2008

On Wed, Apr 09, 2008 at 12:59:38PM +0100, John Levon wrote:
> On Wed, Apr 09, 2008 at 11:52:07AM +0100, Richard W.M. Jones wrote:
> > On Tue, Apr 08, 2008 at 01:06:12PM -0700, Ryan Scott wrote:
> > > When a user runs 'virsh detach-disk' on a running domain, the disk is 
> > > removed, but reappears after the domain is rebooted.  This seems odd, as 
> > > someone who types detach-disk most likely wants the change to be permanent.
> > 
> > Actually I wonder what the expectation is.
> > 
> > The QEMU driver only implements a very limited form of the
> > virDomainAttachDevice call (merely allowing you to signal that the
> > CD-ROM has been replaced) and doesn't implement virDomainDetachDevice
> > at all, so there is no example to go on there.
> > 
> > Maybe better to document what the behaviour is supposed to be in
> > src/libvirt.c?  After all you can effect a permanent change to the
> > device configuration by using virDomainDefineXML.
> Please think of the poor user. Dumping the XML, editing it by hand, and
> feeding it back in barely a user interface at all. virsh detach-disk is.
> (And yes, I would expect detach-disk to do exactly that, permanently.)

  I think what's most confusing to the 'poor user' is the inconsistency
of behaviour. For example if you were to run that command while the
domain is not running, it would detach the device in the configuration
file. The fact that the command behaves differently depending on the
current state of the domain is what sounds fundemantally wrong to me 
from an user perspective.
  This is also one more example why it makes sense to add flags to new
operations because in the end both behaviour have their own logic, for
example the diffence between (un)mounting a temporary device used while
running a domain (say an application install CD-Rom) versus a more 
persistent data volume. In the end we may want to separate the logic
without adding more entry points and an operation flag would have been
ideal for this, unfortunately virDomainAttachDevice/virDomainDetachDevice
don't have one, too bad.

   In that specific case of umounting a device, I think it's reasonable to
make the operation permanent, as that's the behaviour when the domain is
not running, but it's not an ideal situation.


Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

More information about the libvir-list mailing list