[libvirt] [PATCH/RFC]: don't ignore errors to save the domain status file
Daniel P. Berrange
berrange at redhat.com
Thu Feb 5 17:46:51 UTC 2009
On Sat, Jan 31, 2009 at 02:32:09PM +0100, Guido G?nther wrote:
> Hi,
> we currently don't report errors to save qemu's domain status file back
> to the caller. That was o.k. as long as the code was there for testing
> but now that the XML is being picked up on daemon restart we must
> handle these.
> The attached patch does that, although I'm not confident that it's
> enough. While we return error on device attach/unattach the device
> actually got attached/unattached already. Same is true for
> suspend/resume.
> A better solution would be to write out the new domain status into a
> temp file and simply call rename(2) on it when the attach/unattach
> succeeds and discard it if it fails. This would minimize the possible
> error conditions like disk full, missing permissions to write into that
> directory etc. Does this sound reasonable?
Yeah, I think that sounds like a reasonable idea
virPrepareStatusFile()
virSaveStatusFile()
the former creates the temporary file, and the latter does
the rename().
In the prepare stage, we could also do a access(R_OK)
check on the eventual target, as a sanity check that
we're likely to be able to complete the rename() later.
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 :|
More information about the libvir-list
mailing list