diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 6e5d203f06..7b30441ac7 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -308,6 +308,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"virtio-tablet", /* 205 */
"virtio-input-host",
+ "chardev-file-append",
);
@@ -2600,6 +2601,7 @@ static struct virQEMUCapsCommandLineProps virQEMUCapsCommandLine[] = {
{ "drive", "throttling.bps-total-max", QEMU_CAPS_DRIVE_IOTUNE_MAX},
{ "machine", "aes-key-wrap", QEMU_CAPS_AES_KEY_WRAP },
{ "machine", "dea-key-wrap", QEMU_CAPS_DEA_KEY_WRAP },
+ { "chardev", "append", QEMU_CAPS_CHARDEV_FILE_APPEND },
};
static int
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 61d637997d..c148f2d9d3 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -335,6 +335,7 @@ typedef enum {
/* 205 */
QEMU_CAPS_VIRTIO_TABLET, /* -device virtio-tablet-{device,pci} */
QEMU_CAPS_VIRTIO_INPUT_HOST, /* -device virtio-input-host-{device,pci} */
+ QEMU_CAPS_CHARDEV_FILE_APPEND, /* -chardev file,append=on|off */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 9822cf7898..d40198128d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6555,6 +6555,16 @@ qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias,
case VIR_DOMAIN_CHR_TYPE_FILE:
virBufferAsprintf(&buf, "file,id=char%s,path=%s", alias,
dev->data.file.path);
+ if (dev->data.file.append) {
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_FILE_APPEND)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("append not supported in this QEMU binary"));
+ goto error;
+ }
+
+ virBufferAsprintf(&buf, ",append=%s",
+ virTristateSwitchTypeToString(dev->data.file.append));
+ }
break;
case VIR_DOMAIN_CHR_TYPE_PIPE:
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-1.caps b/tests/qemucapabilitiesdata/caps_2.6.0-1.caps
index d9a8f3f7a4..e296efc90d 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0-1.caps
+++ b/tests/qemucapabilitiesdata/caps_2.6.0-1.caps
@@ -169,4 +169,5 @@
+
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-file-chardev.args b/tests/qemuxml2argvdata/qemuxml2argv-serial-file-chardev.args
index 64fcd297c6..4345eb02c2 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-file-chardev.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-file-chardev.args
@@ -21,6 +21,6 @@ QEMU_AUDIO_DRV=none \
-usb \
-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-ide0-0-0,format=raw \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
--chardev file,id=charserial0,path=/tmp/serial.log \
+-chardev file,id=charserial0,path=/tmp/serial.log,append=on \
-device isa-serial,chardev=charserial0,id=serial0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-file-chardev.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-file-chardev.xml
index 2527e7d2b6..08ddfaa427 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-file-chardev.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-file-chardev.xml
@@ -22,7 +22,7 @@
-
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 37f806edd3..63480ce8af 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1047,7 +1047,8 @@ mymain(void)
DO_TEST("serial-dev-chardev-iobase",
QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
DO_TEST("serial-file-chardev",
- QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
+ QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
+ QEMU_CAPS_CHARDEV_FILE_APPEND);
DO_TEST("serial-unix-chardev",
QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
DO_TEST("serial-tcp-chardev",