[libvirt] On shutdown Destroy/Delete

Hi, I would really like to know how I can make a defined domain *gone* after shutdown :) (instead of it still be defined, after shutdown) Stefan

On Tue, Aug 19, 2008 at 10:26:33PM +0200, Stefan de Konink wrote:
Hi,
I would really like to know how I can make a defined domain *gone* after shutdown :) (instead of it still be defined, after shutdown)
make a separate call to virDomainUndefine() Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Tue, Aug 19, 2008 at 10:26:33PM +0200, Stefan de Konink wrote:
I would really like to know how I can make a defined domain *gone* after shutdown :) (instead of it still be defined, after shutdown)
virsh undefine? Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v

On Wed, Aug 20, 2008 at 02:31:52PM +0100, Richard W.M. Jones wrote:
On Tue, Aug 19, 2008 at 10:26:33PM +0200, Stefan de Konink wrote:
I would really like to know how I can make a defined domain *gone* after shutdown :) (instead of it still be defined, after shutdown)
[...] Oh right, so am I correct in thinking you want the domain to be undefined after it has shutdown itself? That's not possible currently. AIUI undefining a running domain is either an illegal operation or shuts it down abruptly -- you'll need to look in the source to see which. So you'd need some sort of 'reaper' cronjob to regularly undefine domains after they have gone into the shutdown state. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 60 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora

On Wed, Aug 20, 2008 at 02:34:22PM +0100, Richard W.M. Jones wrote:
On Wed, Aug 20, 2008 at 02:31:52PM +0100, Richard W.M. Jones wrote:
On Tue, Aug 19, 2008 at 10:26:33PM +0200, Stefan de Konink wrote:
I would really like to know how I can make a defined domain *gone* after shutdown :) (instead of it still be defined, after shutdown)
[...]
Oh right, so am I correct in thinking you want the domain to be undefined after it has shutdown itself? That's not possible currently. AIUI undefining a running domain is either an illegal operation or shuts it down abruptly -- you'll need to look in the source to see which. So you'd need some sort of 'reaper' cronjob to regularly undefine domains after they have gone into the shutdown state.
The easy answer is to simply *not* define it in the first place. If you use virDomainCreateLinux() instead of virDomainDefine+virDomainCreate then you'll get a running VM without any persistent config file behind it. Then all trace will disappear when it shuts down. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Daniel P. Berrange schreef:
On Wed, Aug 20, 2008 at 02:34:22PM +0100, Richard W.M. Jones wrote:
On Wed, Aug 20, 2008 at 02:31:52PM +0100, Richard W.M. Jones wrote:
On Tue, Aug 19, 2008 at 10:26:33PM +0200, Stefan de Konink wrote:
I would really like to know how I can make a defined domain *gone* after shutdown :) (instead of it still be defined, after shutdown) [...]
Oh right, so am I correct in thinking you want the domain to be undefined after it has shutdown itself? That's not possible currently. AIUI undefining a running domain is either an illegal operation or shuts it down abruptly -- you'll need to look in the source to see which. So you'd need some sort of 'reaper' cronjob to regularly undefine domains after they have gone into the shutdown state.
The easy answer is to simply *not* define it in the first place. If you use virDomainCreateLinux() instead of virDomainDefine+virDomainCreate then you'll get a running VM without any persistent config file behind it. Then all trace will disappear when it shuts down.
That would be too easy ;) I define the domain because my API interacts and ads resources before it is started. What I could do is before the actualy 'start' command to undefine it, and start it with a virDomainCreateLinux. That would be an interesting thought and now I think of it, probably a clean way :) My domains are automatically migrated across my cluster, so I am not able to undefine it after shutdown, because technically I cannot know that a domain is defined at that place. Alternatively I really hope that the the ListDomains command shows the defined domains too :) Stefan
participants (4)
-
Daniel P. Berrange
-
Daniel Veillard
-
Richard W.M. Jones
-
Stefan de Konink