[libvirt] [PATCHv2 2/3] conf: Add new 'append' attribute for chardevs with file source

Daniel P. Berrange berrange at redhat.com
Thu Dec 24 15:13:36 UTC 2015


On Thu, Dec 24, 2015 at 02:48:34PM +0000, Daniel P. Berrange wrote:
> On Thu, Dec 24, 2015 at 05:27:54PM +0300, Dmitry Mishin wrote:
> > Currently, there is no possibility for user to specify desired behaviour of
> > output to file - truncate or append. This patch adds an ability to explicitly
> > specify that user wants to preserve file's content on reopen.
> > 
> > Signed-off-by: Dmitry Mishin <dim at virtuozzo.com>
> > ---
> >  docs/schemas/domaincommon.rng |  5 +++++
> >  src/conf/domain_conf.c        | 28 ++++++++++++++++++++++++----
> >  src/conf/domain_conf.h        |  1 +
> >  3 files changed, 30 insertions(+), 4 deletions(-)
> 
> Can you update docs/formatdomain.html.in too to mentio the new
> attribute.
> 
> 
> > @@ -20051,11 +20065,17 @@ virDomainChrSourceDefFormat(virBufferPtr buf,
> >      case VIR_DOMAIN_CHR_TYPE_DEV:
> >      case VIR_DOMAIN_CHR_TYPE_FILE:
> >      case VIR_DOMAIN_CHR_TYPE_PIPE:
> > +        /* 'append' makes sense only for files */
> > +        if (def->type != VIR_DOMAIN_CHR_TYPE_FILE)
> > +            def->data.file.append = 0;
> 
> While this should never occur, it is still a little unpleasant
> to modify the def during formatting. Instead of this...
> 
> >          if (def->type != VIR_DOMAIN_CHR_TYPE_PTY ||
> >              (def->data.file.path &&
> >               !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE))) {
> >              virBufferEscapeString(buf, "<source path='%s'",
> >                                    def->data.file.path);
> 
> 
> > +            if (def->data.file.append)
> 
> Add  (def->type == VIR_DOMAIN_CHR_TYPE_FILE) to this condition


Since this was the only real bug in the series, I've just fixed this myself
and pushed the 3 patches to git.

Please just send a separate patch to add the docs/formatdomain.html.in
documentation.

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