[libvirt] [PATCH v2 6/8] logging: support truncation of logfiles when opening

Daniel P. Berrange berrange at redhat.com
Thu Mar 10 15:41:37 UTC 2016


On Fri, Mar 04, 2016 at 09:33:42AM -0500, John Ferlan wrote:
> 
> 
> On 02/29/2016 08:33 AM, Daniel P. Berrange wrote:
> > The virtlogd daemon currently opens all files for append, but
> > in some cases the user may wish to discard existing data. Define
> > a new flag to indicate that logfiles should be truncated when
> > opening.
> > ---
> >  src/logging/log_daemon_dispatch.c | 3 ++-
> >  src/logging/log_handler.c         | 6 ++----
> >  src/logging/log_handler.h         | 2 +-
> >  src/logging/log_manager.h         | 2 ++
> >  src/logging/log_protocol.x        | 4 ++++
> >  5 files changed, 11 insertions(+), 6 deletions(-)
> > 
> 
> [...]
> 
> > diff --git a/src/logging/log_protocol.x b/src/logging/log_protocol.x
> > index b0ac31b..0363c75 100644
> > --- a/src/logging/log_protocol.x
> > +++ b/src/logging/log_protocol.x
> > @@ -30,6 +30,10 @@ struct virLogManagerProtocolLogFilePosition {
> >  };
> >  typedef struct virLogManagerProtocolLogFilePosition virLogManagerProtocolLogFilePosition;
> >  
> > +enum virLogManagerProtocolDomainOpenLogFileFlags {
> > +    VIR_LOG_MANAGER_PROTOCOL_DOMAIN_OPEN_LOG_FILE_TRUNCATE = 1
> > +};
> > +
> 
> Use "= (1 << 0)" (just to be painfully obvious for the next adjustment)
> 
> Since the trunc setting is "flags & VIR_LOG_*_TRUNCATE"

Sadly you can't use  (1 << 0) in .x files


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list