Print a warning and exit xl if xend is running. It is not recommened to use libxenlight in conjunction with legacy xend toolstack. xl could be useful even when xend is running, e.g. to debug xend itself, so add a '-f' option to override the exit. Index: xen-4.1.1-testing/tools/libxl/xl.c =================================================================== --- xen-4.1.1-testing.orig/tools/libxl/xl.c +++ xen-4.1.1-testing/tools/libxl/xl.c @@ -88,12 +88,16 @@ int main(int argc, char **argv) char *config_file; void *config_data = 0; int config_len = 0; + int force = 0; - while ((opt = getopt(argc, argv, "+v")) >= 0) { + while ((opt = getopt(argc, argv, "+vf")) >= 0) { switch (opt) { case 'v': if (minmsglevel > 0) minmsglevel--; break; + case 'f': + force = 1; + break; default: fprintf(stderr, "unknown global option\n"); exit(2); @@ -107,6 +111,22 @@ int main(int argc, char **argv) exit(1); } opterr = 0; + /* + * On SUSE, if xend is running (and user isn't asking for help), + * print a warning and exit unless forced. + */ + if ((system("/usr/sbin/xend status") == 0) && strcmp(cmd, "help")) { + if (force == 0) { + fprintf(stderr, "WARNING: xend is running! It is not recommended " + "using libxenlight in\nconjunction with the legacy xend " + "toolstack. Use -f (force) to override\n"); + exit(1); + } else { + fprintf(stderr, "WARNING: xend is running! It is not recommended " + "using libxenlight in\nconjunction with the legacy xend " + "toolstack.\n\n"); + } + } logger = xtl_createlogger_stdiostream(stderr, minmsglevel, 0); if (!logger) exit(1); Index: xen-4.1.1-testing/tools/libxl/xl_cmdimpl.c =================================================================== --- xen-4.1.1-testing.orig/tools/libxl/xl_cmdimpl.c +++ xen-4.1.1-testing/tools/libxl/xl_cmdimpl.c @@ -1725,7 +1725,7 @@ void help(const char *command) struct cmd_spec *cmd; if (!command || !strcmp(command, "help")) { - printf("Usage xl [-v] [args]\n\n"); + printf("Usage xl [-v] [-f] [args]\n\n"); printf("xl full list of subcommands:\n\n"); for (i = 0; i < cmdtable_len; i++) printf(" %-20s%s\n", @@ -1733,7 +1733,7 @@ void help(const char *command) } else { cmd = cmdtable_lookup(command); if (cmd) { - printf("Usage: xl [-v] %s %s\n\n%s.\n\n", + printf("Usage: xl [-v] [-f] %s %s\n\n%s.\n\n", cmd->cmd_name, cmd->cmd_usage, cmd->cmd_desc);