@@ -810,6 +810,28 @@ Pass VNC password to vncviewer via stdin.
Send debug I<keys> to Xen. It is the same as pressing the Xen
"conswitch" (Ctrl-A by default) three times and then pressing "keys".
+=item B<loglvl> [B<-g>] [B<-s [lower_threshold][/upper_threshold]>]
+
+Get and set the log level thresholds.
+
+B<OPTIONS>
+
+=over 4
+
+=item B<-g>, B<--guest>
+
+Select guest log levels instead of host wide log levels.
+
+=item B<-s [lower_threshold][/upper_threshold]> B<--set=[lower_threshold][/upper_threshold]>
+
+Set the lower threshold to B<lower_threshold> and optionally set upper
+threshold to B<upper_threshold>.
+
+If this option is not specified, the command prints the current lower
+threshold and upper threshold.
+
+=back
+
=item B<dmesg> [B<-c>]
Reads the Xen message buffer, similar to dmesg on a Linux system. The
@@ -80,6 +80,7 @@ int main_rename(int argc, char **argv);
int main_trigger(int argc, char **argv);
int main_sysrq(int argc, char **argv);
int main_debug_keys(int argc, char **argv);
+int main_loglvl(int argc, char **argv);
int main_dmesg(int argc, char **argv);
int main_top(int argc, char **argv);
int main_networkattach(int argc, char **argv);
@@ -7160,6 +7160,55 @@ int main_debug_keys(int argc, char **argv)
return EXIT_SUCCESS;
}
+int main_loglvl(int argc, char **argv)
+{
+ int opt;
+ bool guest = false, set = false;
+ char *lower_thresh = NULL, *upper_thresh = NULL, *delim = NULL;
+ char lower_thresh_out[16], upper_thresh_out[16];
+ unsigned int llen, ulen;
+ int rc;
+ static const struct option opts[] = {
+ {"guest", 0, 0, 'g'},
+ {"set", 0, 0, 's'},
+ COMMON_LONG_OPTS
+ };
+
+ SWITCH_FOREACH_OPT(opt, "gs:", opts, "loglvl", 0) {
+ case 'g':
+ guest = true;
+ break;
+ case 's':
+ delim = strstr(optarg, "/");
+
+ if (delim) {
+ if (delim != optarg)
+ lower_thresh = optarg;
+ *delim = 0;
+ upper_thresh = ++delim;
+ } else {
+ lower_thresh = optarg;
+ }
+
+ set = true;
+ break;
+ }
+
+ if (set)
+ rc = libxl_set_log_level(ctx, guest, lower_thresh, upper_thresh);
+ else {
+ llen = sizeof(lower_thresh_out);
+ ulen = sizeof(upper_thresh_out);
+ rc = libxl_get_log_level(ctx, guest, lower_thresh_out, &llen,
+ upper_thresh_out, &ulen);
+ if (!rc)
+ printf("%s log levels: %s/%s\n", guest ? "guest" : "host",
+ lower_thresh_out, upper_thresh_out);
+ }
+
+ return rc == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+
int main_dmesg(int argc, char **argv)
{
unsigned int clear = 0;
@@ -583,6 +583,12 @@ struct cmd_spec cmd_table[] = {
"List information about all USB controllers and devices for a domain",
"<Domain>",
},
+ { "loglvl",
+ &main_loglvl, 0, 1,
+ "[-g] [-s=[LOWER]/[UPPER]]",
+ "-g, --guest act on guest log level\n"
+ "-s [LOWER][/UPPER], --set=[LOWER][/UPPER] set new log level\n"
+ },
};
int cmdtable_len = sizeof(cmd_table)/sizeof(struct cmd_spec);