diff mbox

[51/52] xl: add new xl command set-parameters

Message ID 20170809070706.13481-52-jgross@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jürgen Groß Aug. 9, 2017, 7:07 a.m. UTC
Add a new xl command "set-parameters" to set hypervisor parameters at
runtime similar to boot time parameters via command line.

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 docs/man/xl.pod.1.in   |  5 +++++
 tools/xl/xl.h          |  1 +
 tools/xl/xl_cmdtable.c |  5 +++++
 tools/xl/xl_misc.c     | 20 ++++++++++++++++++++
 4 files changed, 31 insertions(+)

Comments

Wei Liu Aug. 10, 2017, 4:29 p.m. UTC | #1
On Wed, Aug 09, 2017 at 09:07:05AM +0200, Juergen Gross wrote:
> Add a new xl command "set-parameters" to set hypervisor parameters at
> runtime similar to boot time parameters via command line.
> 
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>
diff mbox

Patch

diff --git a/docs/man/xl.pod.1.in b/docs/man/xl.pod.1.in
index 16c83066fe..3d5f2f7359 100644
--- a/docs/man/xl.pod.1.in
+++ b/docs/man/xl.pod.1.in
@@ -822,6 +822,11 @@  Pass the 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<set-parameters> I<params>
+
+Set hypervisor parameters as specified in I<params>. This allows for some
+boot parameters of the hypervisor to be modified in the running systems.
+
 =item B<dmesg> [I<OPTIONS>]
 
 Reads the Xen message buffer, similar to dmesg on a Linux system.  The
diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index aa95b77146..5d3d2a4835 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -154,6 +154,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_set_parameters(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);
diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 2c71a9f776..ba0159df67 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -309,6 +309,11 @@  struct cmd_spec cmd_table[] = {
       "Send debug keys to Xen",
       "<Keys>",
     },
+    { "set-parameters",
+      &main_set_parameters, 0, 1,
+      "Set hypervisor parameters",
+      "<Params>",
+    },
     { "dmesg",
       &main_dmesg, 0, 0,
       "Read and/or clear dmesg buffer",
diff --git a/tools/xl/xl_misc.c b/tools/xl/xl_misc.c
index 9c6227af23..dcf940a6d4 100644
--- a/tools/xl/xl_misc.c
+++ b/tools/xl/xl_misc.c
@@ -155,6 +155,26 @@  int main_debug_keys(int argc, char **argv)
     return EXIT_SUCCESS;
 }
 
+int main_set_parameters(int argc, char **argv)
+{
+    int opt;
+    char *params;
+
+    SWITCH_FOREACH_OPT(opt, "", NULL, "set-parameters", 1) {
+        /* No options */
+    }
+
+    params = argv[optind];
+
+    if (libxl_set_parameters(ctx, params)) {
+        fprintf(stderr, "cannot set parameters: %s\n", params);
+        fprintf(stderr, "Use \"xl dmesg\" to look for possible reason.\n");
+        return EXIT_FAILURE;
+    }
+
+    return EXIT_SUCCESS;
+}
+
 int main_devd(int argc, char **argv)
 {
     int ret = 0, opt = 0, daemonize = 1;