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(a)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
+ virBufferAsprintf(buf, "
append='%s'",
+ virTristateSwitchTypeToString(def->data.file.append));
virDomainSourceDefFormatSeclabel(buf, nseclabels, seclabels, flags);
}
break;
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 :|