tools/xl: support new 9pfs backend xen_9pfsd

Add support for the new 9pfs backend "xen_9pfsd". For this backend type
the tag defaults to "Xen" and the host side path to
"/var/log/xen/guests/<dom-name>".

Do most of the default settings in libxl. Unfortunately the default
path can't easily be set in libxl, as the domain name isn't available
in the related 9pfs specific function.

Settings the defaults in libxl requires to move the sanity checking
of 9pfs parameters from xl to libxl, too.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
This commit is contained in:
Juergen Gross authored and Andrew Cooper committed 2024-02-23 17:43:06 +00:00
1 parent ab5a6b5986
commit 4287a71f9b
3 files changed
+72 -5

No files matched your search

+20 -3
View File
@@ -2233,6 +2233,20 @@ void parse_config_data(const char *config_source,
replace_string(&p9->tag, value);
} else if (!strcmp(key, "backend")) {
replace_string(&p9->backend_domname, value);
} else if (!strcmp(key, "type")) {
if (libxl_p9_type_from_string(value, &p9->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);
@@ -2243,9 +2257,12 @@ void parse_config_data(const char *config_source,
libxl_string_list_dispose(&pairs);
if (!p9->path || !p9->security_model || !p9->tag) {
fprintf(stderr, "9pfs spec missing required field!\n");
exit(1);
if (p9->type == LIBXL_P9_TYPE_XEN_9PFSD && !p9->path) {
char *path;
xasprintf(&path, XEN_LOG_DIR "/guests/%s", c_info->name);
replace_string(&p9->path, path);
free(path);
}
}
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.