Re: [PATCH v2] qemu: Unlink managed state file when a domain is undefined

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/25/2011 08:29 AM, Eric Blake wrote:
> On 04/25/2011 03:41 AM, Osier Yang wrote:
>> The managed state file is not useful anymore after the domain is
>> undefined, and perhaps cause confusion. E.g. define & start a domain
>> which has same name but different UUID with previous undefined
>> domain later.
>>
>> v1 - v2:
>>    * Try to delete the managed state file before delete domain
>> config file, and goto fail if it failed to delete it.
>> ---
>>  src/qemu/qemu_driver.c |   10 ++++++++++
>>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> Ouch.  virDomainUndefine doesn't have a flags argument.  But this is
> changing behavior in a user-visible manner (arguably for the better, but
> any change is risky)
> 
> We have two options:
> 
> 1. Proceed with the change: virDomainUndefine removes all associated
> snapshot data; but this is a silent change in behavior
> 
> 2. Add a new API: virDomainUndefineFlags; flag 0 leaves snapshot data
> around (but warns), flag VIR_DOMAIN_UNDEFINE_ALL_ASSOCIATED_DATA (or
> some better name) guarantees that snapshots are also removed

Option 3: no silent deletion on undefine, and no new API, but make
virDomainUndefine fail if the managed state file exists.  The user is
then responsible for using virDomainHasManagedSaveImage and
virDomainManagedSaveRemove prior to undefining a domain.  But whereas
with option 1, people might complain that we removed the managed state
file, now with option 3 people might complain that we prevent the
undefine of a domain.  Which leads to:

Option 4: Add virDomainUndefineFlags().  virDomainUndefineFlags(,0)
refuses to undefine a domain if state exists, while
virDomainUndefineFlags(,VIR_DOMAIN_UNDEFINE_FORCE) proceeds to undefine
the domain even if a managed state file exists.  We'd still have to
decide whether virDomainUndefine maps to Flags(,0) or Flags(,FORCE), but
at least the default option is safer than in option 2 where you have to
use a flag to get the safe behavior.

At any rate, at the virsh level we can add a flag that maps into two API
calls as necessary to use virDomainManagedSaveRemove prior to
virDomainUndefine, regardless of what we do at the API level.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]