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

[Xen-devel] [PATCH 5 of 6] xl: Add vncviewer options to create and restore



Signed-off-by: Goncalo Gomes <Goncalo.Gomes@xxxxxxxxxxxxx>

diff -r 0663afbb57f5 -r ed41714d9ce9 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Mon May 07 01:10:58 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Mon May 07 01:10:58 2012 +0000
@@ -736,6 +736,7 @@ static void parse_config_data(const char
     if (!xlu_cfg_get_long(config, "rtc_timeoffset", &l, 0))
         b_info->rtc_timeoffset = l;
 
+    xlu_cfg_get_defbool(config, "vncviewer", &b_info->vncviewer, 0);
     xlu_cfg_get_defbool(config, "localtime", &b_info->localtime, 0);
 
     if (!xlu_cfg_get_long (config, "videoram", &l, 0))
@@ -1414,6 +1415,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 */
@@ -1527,6 +1530,8 @@ static int create_domain(struct domain_c
     int daemonize = dom_info->daemonize;
     int monitor = dom_info->monitor;
     int paused = dom_info->paused;
+    int vnc = dom_info->vnc;
+    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;
@@ -1734,6 +1739,14 @@ start:
     if (!daemonize && !monitor)
         goto out;
 
+    if (vnc || (libxl_defbool_val(d_config.b_info.vncviewer) == 1)) {
+        char *domspec = libxl_domid_to_name(ctx, domid);
+        if (domspec) {
+            vncviewer(domspec, vncautopass);
+            free(domsec);
+        }
+    }
+
     if (need_daemon) {
         char *fullname, *name;
         pid_t child1, got_child;
@@ -3033,10 +3046,10 @@ 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) {
+    while ((opt = def_getopt(argc, argv, "FcpdeVA", "restore", 1)) != -1) {
         switch (opt) {
         case 0: case 2:
             return opt;
@@ -3056,6 +3069,12 @@ int main_restore(int argc, char **argv)
             daemonize = 0;
             monitor = 0;
             break;
+        case 'V':
+            vnc = 1;
+            break;
+        case 'A':
+            vnc = vncautopass = 1;
+            break;
         }
     }
 
@@ -3077,6 +3096,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;
 
@@ -3384,7 +3405,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[] = {
@@ -3392,6 +3413,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}
     };
 
@@ -3401,7 +3424,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;
 
@@ -3434,6 +3457,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;
@@ -3463,6 +3492,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;
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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