[libvirt] On shutdown Destroy/Delete

Stefan de Konink skinkie at xs4all.nl
Wed Aug 20 18:30:24 UTC 2008


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




More information about the libvir-list mailing list