[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xl: Introduce vncviewer xm compatibility options


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Fri, 18 May 2012 17:11:09 +0000
  • Delivery-date: Fri, 18 May 2012 17:11:18 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Goncalo Gomes <Goncalo.Gomes@xxxxxxxxxxxxx>
# Date 1337092913 -3600
# Node ID a3186b243e2db2761becfad3452290a1b385cf1c
# Parent  0768e0afdc6b191bd90f22f7e4f2109f968e2103
xl: Introduce vncviewer xm compatibility options

Signed-off-by: Goncalo Gomes <Goncalo.Gomes@xxxxxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r 0768e0afdc6b -r a3186b243e2d docs/man/xl.cfg.pod.5
--- a/docs/man/xl.cfg.pod.5     Tue May 15 15:41:52 2012 +0100
+++ b/docs/man/xl.cfg.pod.5     Tue May 15 15:41:53 2012 +0100
@@ -91,6 +91,10 @@ The following options apply to guests of
 Specifies the UUID of the domain.  If not specified, a fresh unique
 UUID will be generated.
 
+=item B<vncviewer=BOOLEAN>
+
+Automatically spawn a vncviewer when creating/restoring a guest
+
 =item B<pool="CPUPOOLNAME">
 
 Put the guest's vcpus into the named cpu pool.
diff -r 0768e0afdc6b -r a3186b243e2d docs/man/xl.pod.1
--- a/docs/man/xl.pod.1 Tue May 15 15:41:52 2012 +0100
+++ b/docs/man/xl.pod.1 Tue May 15 15:41:53 2012 +0100
@@ -126,6 +126,14 @@ Use the given configuration file.
 
 Leave the domain paused after it is created.
 
+=item B<-V>, B<--vncviewer>
+
+Attach to domain's VNC server, forking a vncviewer process.
+
+=item B<-A>, B<--vncviewer-autopass>
+
+Pass VNC password to vncviewer via stdin.
+
 =item B<-c>
 
 Attach console to the domain as soon as it has started.  This is
@@ -439,6 +447,16 @@ See the corresponding option of the I<cr
 
 Enable debug messages.
 
+=item B<-V>, B<--vncviewer>
+
+Attach to domain's VNC server, forking a vncviewer process.
+
+=item B<-A>, B<--vncviewer-autopass>
+
+Pass VNC password to vncviewer via stdin.
+
+
+
 =back
 
 =item B<save> [I<OPTIONS>] I<domain-id> I<CheckpointFile> [I<ConfigFile>]
diff -r 0768e0afdc6b -r a3186b243e2d tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Tue May 15 15:41:52 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Tue May 15 15:41:53 2012 +0100
@@ -129,6 +129,8 @@ struct domain_create {
     int paused;
     int dryrun;
     int quiet;
+    int vnc;
+    int vncautopass;
     int console_autoconnect;
     const char *config_file;
     const char *extra_config; /* extra config string */
@@ -206,9 +208,8 @@ static void find_domain(const char *p)
     common_domname = was_name ? p : libxl_domid_to_name(ctx, domid);
 }
 
-static int vncviewer(const char *domain_spec, int autopass)
+static int vncviewer(uint32_t domid, int autopass)
 {
-    find_domain(domain_spec);
     libxl_vncviewer_exec(ctx, domid, autopass);
     fprintf(stderr, "Unable to execute vncviewer\n");
     return 1;
@@ -551,7 +552,9 @@ vcpp_out:
 static void parse_config_data(const char *configfile_filename_report,
                               const char *configfile_data,
                               int configfile_len,
-                              libxl_domain_config *d_config)
+                              libxl_domain_config *d_config,
+                              struct domain_create *dom_info)
+
 {
     const char *buf;
     long l;
@@ -773,6 +776,13 @@ static void parse_config_data(const char
     if (!xlu_cfg_get_long(config, "rtc_timeoffset", &l, 0))
         b_info->rtc_timeoffset = l;
 
+    if (dom_info && !xlu_cfg_get_long(config, "vncviewer", &l, 0)) {
+        /* Command line arguments must take precedence over what's
+         * specified in the configuration file. */
+        if (!dom_info->vnc)
+            dom_info->vnc = l;
+    }
+
     xlu_cfg_get_defbool(config, "localtime", &b_info->localtime, 0);
 
     if (!xlu_cfg_get_long (config, "videoram", &l, 0))
@@ -1550,6 +1560,7 @@ static int create_domain(struct domain_c
     int daemonize = dom_info->daemonize;
     int monitor = dom_info->monitor;
     int paused = dom_info->paused;
+    int vncautopass = dom_info->vncautopass;
     const char *config_file = dom_info->config_file;
     const char *extra_config = dom_info->extra_config;
     const char *restore_file = dom_info->restore_file;
@@ -1673,7 +1684,7 @@ static int create_domain(struct domain_c
     if (!dom_info->quiet)
         printf("Parsing config file %s\n", config_file);
 
-    parse_config_data(config_file, config_data, config_len, &d_config);
+    parse_config_data(config_file, config_data, config_len, &d_config, 
dom_info);
 
     if (migrate_fd >= 0) {
         if (d_config.c_info.name) {
@@ -1785,6 +1796,9 @@ start:
     if (!daemonize && !monitor)
         goto out;
 
+    if (dom_info->vnc)
+        vncviewer(domid, vncautopass);
+
     if (need_daemon) {
         char *fullname, *name;
         pid_t child1, got_child;
@@ -1911,7 +1925,7 @@ start:
                 libxl_domain_config_dispose(&d_config);
                 libxl_domain_config_init(&d_config);
                 parse_config_data(config_file, config_data, config_len,
-                                  &d_config);
+                                  &d_config, dom_info);
 
                 /*
                  * XXX FIXME: If this sleep is not there then domain
@@ -2263,7 +2277,9 @@ int main_vncviewer(int argc, char **argv
         return 2;
     }
 
-    if (vncviewer(argv[optind], autopass))
+    find_domain(argv[optind]);
+
+    if (vncviewer(domid, autopass))
         return 1;
     return 0;
 }
@@ -2538,7 +2554,7 @@ static void list_domains_details(const l
             continue;
         CHK_ERRNO(asprintf(&config_file, "<domid %d data>", info[i].domid));
         libxl_domain_config_init(&d_config);
-        parse_config_data(config_file, (char *)data, len, &d_config);
+        parse_config_data(config_file, (char *)data, len, &d_config, NULL);
         printf_info(default_output_format, info[i].domid, &d_config);
         libxl_domain_config_dispose(&d_config);
         free(data);
@@ -3088,13 +3104,26 @@ int main_restore(int argc, char **argv)
     const char *config_file = NULL;
     struct domain_create dom_info;
     int paused = 0, debug = 0, daemonize = 1, monitor = 1,
-        console_autoconnect = 0;
+        console_autoconnect = 0, vnc = 0, vncautopass = 0;
     int opt, rc;
-
-    while ((opt = def_getopt(argc, argv, "Fcpde", "restore", 1)) != -1) {
+    int option_index = 0;
+    static struct option long_options[] = {
+        {"vncviewer", 0, 0, 'V'},
+        {"vncviewer-autopass", 0, 0, 'A'},
+        {0, 0, 0, 0}
+    };
+
+    while (1) {
+        opt = getopt_long(argc, argv, "FhcpdeVA", long_options, &option_index);
+        if (opt == -1)
+            break;
+
         switch (opt) {
         case 0: case 2:
             return opt;
+        case 'h':
+            help("restore");
+            return 2;
         case 'c':
             console_autoconnect = 1;
             break;
@@ -3111,6 +3140,12 @@ int main_restore(int argc, char **argv)
             daemonize = 0;
             monitor = 0;
             break;
+        case 'V':
+            vnc = 1;
+            break;
+        case 'A':
+            vnc = vncautopass = 1;
+            break;
         }
     }
 
@@ -3132,6 +3167,8 @@ int main_restore(int argc, char **argv)
     dom_info.config_file = config_file;
     dom_info.restore_file = checkpoint_file;
     dom_info.migrate_fd = -1;
+    dom_info.vnc = vnc;
+    dom_info.vncautopass = vncautopass;
     dom_info.console_autoconnect = console_autoconnect;
     dom_info.incr_generationid = 1;
 
@@ -3439,7 +3476,7 @@ int main_create(int argc, char **argv)
     char extra_config[1024];
     struct domain_create dom_info;
     int paused = 0, debug = 0, daemonize = 1, console_autoconnect = 0,
-        quiet = 0, monitor = 1;
+        quiet = 0, monitor = 1, vnc = 0, vncautopass = 0;
     int opt, rc;
     int option_index = 0;
     static struct option long_options[] = {
@@ -3447,6 +3484,8 @@ int main_create(int argc, char **argv)
         {"quiet", 0, 0, 'q'},
         {"help", 0, 0, 'h'},
         {"defconfig", 1, 0, 'f'},
+        {"vncviewer", 0, 0, 'V'},
+        {"vncviewer-autopass", 0, 0, 'A'},
         {0, 0, 0, 0}
     };
 
@@ -3456,7 +3495,7 @@ int main_create(int argc, char **argv)
     }
 
     while (1) {
-        opt = getopt_long(argc, argv, "Fhnqf:pcde", long_options, 
&option_index);
+        opt = getopt_long(argc, argv, "Fhnqf:pcdeVA", long_options, 
&option_index);
         if (opt == -1)
             break;
 
@@ -3489,6 +3528,12 @@ int main_create(int argc, char **argv)
         case 'q':
             quiet = 1;
             break;
+        case 'V':
+            vnc = 1;
+            break;
+        case 'A':
+            vnc = vncautopass = 1;
+            break;
         default:
             fprintf(stderr, "option `%c' not supported.\n", optopt);
             break;
@@ -3518,6 +3563,8 @@ int main_create(int argc, char **argv)
     dom_info.config_file = filename;
     dom_info.extra_config = extra_config;
     dom_info.migrate_fd = -1;
+    dom_info.vnc = vnc;
+    dom_info.vncautopass = vncautopass;
     dom_info.console_autoconnect = console_autoconnect;
     dom_info.incr_generationid = 0;
 
@@ -3620,7 +3667,7 @@ int main_config_update(int argc, char **
 
     libxl_domain_config_init(&d_config);
 
-    parse_config_data(filename, config_data, config_len, &d_config);
+    parse_config_data(filename, config_data, config_len, &d_config, NULL);
 
     if (debug || dryrun_only)
         printf_info(default_output_format, -1, &d_config);
diff -r 0768e0afdc6b -r a3186b243e2d tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c Tue May 15 15:41:52 2012 +0100
+++ b/tools/libxl/xl_cmdtable.c Tue May 15 15:41:53 2012 +0100
@@ -30,7 +30,10 @@ struct cmd_spec cmd_table[] = {
       "-n, --dryrun            Dry run - prints the resulting configuration\n"
       "                         (deprecated in favour of global -N option).\n"
       "-d                      Enable debug messages.\n"
-      "-e                      Do not wait in the background for the death of 
the domain."
+      "-e                      Do not wait in the background for the death of 
the domain.\n"
+      "-V, --vncviewer         Connect to the VNC display after the domain is 
created.\n"
+      "-A, --vncviewer-autopass\n"
+      "                        Pass VNC password to viewer via stdin."
     },
     { "config-update",
       &main_config_update, 1, 1,
@@ -144,10 +147,12 @@ struct cmd_spec cmd_table[] = {
       &main_restore, 0, 1,
       "Restore a domain from a saved state",
       "[options] [<ConfigFile>] <CheckpointFile>",
-      "-h  Print this help.\n"
-      "-p  Do not unpause domain after restoring it.\n"
-      "-e  Do not wait in the background for the death of the domain.\n"
-      "-d  Enable debug messages."
+      "-h                       Print this help.\n"
+      "-p                       Do not unpause domain after restoring it.\n"
+      "-e                       Do not wait in the background for the death of 
the domain.\n"
+      "-d                       Enable debug messages.\n"
+      "-V, --vncviewer          Connect to the VNC display after the domain is 
created.\n"
+      "-A, --vncviewer-autopass Pass VNC password to viewer via stdin."
     },
     { "migrate-receive",
       &main_migrate_receive, 0, 1,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.