Add support for the new 9pfs backend "xenlogd". For this backend type
the tag defaults to "Xen" and the host side path to
"/var/log/xen/guests/".
Signed-off-by: Juergen Gross
---
docs/man/xl.cfg.5.pod.in | 36 ++--
tools/xl/xl_parse.c | 35 +++
2 files changed, 69 insertions(+), 2 deletions(-)
diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index 2e234b450e..be82d35eed 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -772,10 +772,16 @@ settings, from the following list:
=over 4
+=item B
+
+The backendtype for the PV device. Supported values are B and B.
+The default is B.
+
=item B
9pfs tag to identify the filesystem share. The tag is needed on the
-guest side to mount it.
+guest side to mount it. For the backendtype of B the tag defaults to
+"Xen".
=item B
@@ -785,12 +791,38 @@ squash or remap).
=item B
-Filesystem path on the backend to export.
+Filesystem path on the backend to export. For the backendtype of B
+the path defaults to "@XEN_LOG_DIR@/guests/".
=item B
Specify the backend domain name or id, defaults to dom0.
+=item B
+
+Specify the maximum number of files below B. A value of 0 (which
+is the default) doesn't limit the number of files. Only valid for
+B.
+
+=item B
+
+Specify the maximum number of concurrently opened files below B.
+Multiple opens of the same file are counted individually. Only valid for
+B, which has a default of B.
+
+=item B
+
+Specify the maximum used disk space in MiB below B. A value of 0 (which
+is the default) doesn't limit the usable disk space. Only valid for
+B.
+
+=item B
+
+When set the backend will delete the oldest file which is currently not
+opened by the guest in case the disk space limit set via B or the
+file limit set via B is being reached. Only valid for
+B.
+
=back
=item B
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index ed983200c3..346532e117 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -2232,6 +2232,20 @@ void parse_config_data(const char *config_source,
replace_string(>tag, value);
} else if (!strcmp(key, "backend")) {
replace_string(>backend_domname, value);
+} else if (!strcmp(key, "type")) {
+if (libxl_p9_type_from_string(value, >type)) {
+fprintf(stderr, "failed to parse 9pfs type: %s\n",
+value);
+exit(1);
+}
+} else if (!strcmp(key, "max-files")) {
+p9->max_files = parse_ulong(value);
+} else if (!strcmp(key, "max-open-files")) {
+p9->max_open_files = parse_ulong(value);
+} else if (!strcmp(key, "max-space")) {
+p9->max_space = parse_ulong(value);
+} else if (!strcmp(key, "auto-delete")) {
+p9->auto_delete = strtoul(value, NULL, 0);
} else {
fprintf(stderr, "Unknown 9pfs parameter '%s'\n", key);
exit(1);
@@ -2242,6 +2256,27 @@ void parse_config_data(const char *config_source,
libxl_string_list_dispose();
+if (p9->type == LIBXL_P9_TYPE_UNKNOWN) {
+p9->type = LIBXL_P9_TYPE_QEMU;
+}
+if (p9->type == LIBXL_P9_TYPE_QEMU &&
+(p9->max_space || p9->auto_delete)) {
+fprintf(stderr, "Illegal 9pfs parameter combination\n");
+exit(1);
+}
+if (p9->type == LIBXL_P9_TYPE_XENLOGD) {
+if (!p9->tag) {
+replace_string(>tag, "Xen");
+}
+if (!p9->path) {
+char *path;
+
+xasprintf(, XEN_LOG_DIR "/guests/%s", c_info->name);
+replace_string(>path, path);
+free(path);
+}
+}
+
if (!p9->path || !p9->security_model || !p9->tag) {
fprintf(stderr, "9pfs spec missing required field!\n");
exit(1);
--
2.35.3