From: Andre Przywara <andre.przywara@amd.com>
To: Keir Fraser <keir.fraser@eu.citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Ian.Jackson@eu.citrix.com
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH 4/4] xl: add "xl info" command
Date: Sun, 18 Apr 2010 23:28:03 +0200 [thread overview]
Message-ID: <4BCB7963.6020707@amd.com> (raw)
In-Reply-To: <4BCB76FD.1020103@amd.com>
[-- Attachment #1: Type: text/plain, Size: 376 bytes --]
The info subcommand was missing from the xl tool. Use the new libxl
wrapper functions to create a clone of "xm info". The splitting into
several smaller functions is enspired by the implementation in XendNode.py.
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
--
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 488-3567-12
[-- Attachment #2: xlinfo.patch --]
[-- Type: text/plain, Size: 4405 bytes --]
diff -r 7ee8bb40200a tools/libxl/xl.c
--- a/tools/libxl/xl.c Thu Apr 15 19:11:16 2010 +0100
+++ b/tools/libxl/xl.c Sun Apr 18 14:44:46 2010 +0200
@@ -30,6 +30,7 @@
#include <sys/socket.h>
#include <sys/select.h>
#include <arpa/inet.h>
+#include <sys/utsname.h> /* for utsname in xl info */
#include <xenctrl.h>
#include <ctype.h>
#include <inttypes.h>
@@ -2636,6 +2637,122 @@
exit(0);
}
+static void output_xeninfo(void)
+{
+ libxl_version_info info;
+ int sched_id;
+
+ if (libxl_get_version_info(&ctx, &info, LIBXL_VERSION_ALL_MASK) != 0) {
+ fprintf(stderr, "version_info sysctl failed.\n");
+ return;
+ }
+ if ((sched_id = libxl_get_sched_id(&ctx)) < 0) {
+ fprintf(stderr, "get_sched_id sysctl failed.\n");
+ return;
+ }
+
+ printf("xen_major : %d\n", info.xen_version_major);
+ printf("xen_minor : %d\n", info.xen_version_minor);
+ printf("xen_extra : %s\n", info.xen_version_extra);
+ printf("xen_caps : %s\n", info.capabilities);
+ printf("xen_scheduler : %s\n",
+ sched_id == XEN_SCHEDULER_SEDF ? "sedf" :
+ sched_id == XEN_SCHEDULER_CREDIT ? "credit" :
+ sched_id == XEN_SCHEDULER_CREDIT2 ? "credit2" : "unknown");
+ printf("xen_pagesize : %lu\n", info.pagesize);
+ printf("platform_params : virt_start=0x%lx\n", info.virt_start);
+ printf("xen_changeset : %s\n", info.changeset);
+ printf("xen_commandline : %s\n", info.commandline);
+ printf("cc_compiler : %s\n", info.compiler);
+ printf("cc_compile_by : %s\n", info.compile_by);
+ printf("cc_compile_domain : %s\n", info.compile_domain);
+ printf("cc_compile_date : %s\n", info.compile_date);
+
+ libxl_free_version_info(&info);
+ return;
+}
+
+static void output_nodeinfo(void)
+{
+ struct utsname utsbuf;
+
+ uname(&utsbuf);
+
+ printf("host : %s\n", utsbuf.nodename);
+ printf("release : %s\n", utsbuf.release);
+ printf("version : %s\n", utsbuf.version);
+ printf("machine : %s\n", utsbuf.machine);
+
+ return;
+}
+
+static void output_physinfo(void)
+{
+ struct libxl_physinfo info;
+ libxl_version_info vinfo;
+ unsigned int i;
+
+ if (libxl_get_physinfo(&ctx, &info) != 0) {
+ fprintf(stderr, "libxl_physinfo failed.\n");
+ return;
+ }
+
+ printf("nr_cpus : %d\n", info.nr_cpus);
+ printf("nr_nodes : %d\n", info.nr_nodes);
+ printf("cores_per_socket : %d\n", info.cores_per_socket);
+ printf("threads_per_core : %d\n", info.threads_per_core);
+ printf("cpu_mhz : %d\n", info.cpu_khz / 1000);
+ printf("hw_caps : ");
+ for (i = 0; i < 8; i++)
+ printf("%08x%c", info.hw_cap[i], i < 7 ? ':' : '\n');
+ printf("virt_caps :");
+ if (info.phys_cap & PHYS_CAP_HVM)
+ printf(" hvm");
+ if (info.phys_cap & PHYS_CAP_HVM_DIRECTIO)
+ printf(" hvm_directio");
+ printf("\n");
+ libxl_get_version_info(&ctx, &vinfo, LIBXL_VERSION_PAGESIZE_MASK);
+ i = (1 << 20) / vinfo.pagesize;
+ libxl_free_version_info(&vinfo);
+ printf("total_memory : %lu\n", info.total_pages / i);
+ printf("free_memory : %lu\n", info.free_pages / i);
+
+ return;
+}
+
+void info(int verbose)
+{
+ output_nodeinfo();
+
+ output_physinfo();
+
+ output_xeninfo();
+
+ printf("xend_config_format : 4\n");
+
+ return;
+}
+
+void main_info(int argc, char **argv)
+{
+ int opt, verbose;
+
+ verbose = 0;
+ while ((opt = getopt(argc, argv, "h")) != -1) {
+ switch (opt) {
+ case 'h':
+ help("vcpu-list");
+ exit(0);
+ default:
+ fprintf(stderr, "option `%c' not supported.\n", opt);
+ break;
+ }
+ }
+
+ info(verbose);
+ exit(0);
+}
+
int main(int argc, char **argv)
{
if (argc < 2) {
@@ -2696,6 +2813,8 @@
main_vcpupin(argc - 1, argv + 1);
} else if (!strcmp(argv[1], "vcpu-set")) {
main_vcpuset(argc - 1, argv + 1);
+ } else if (!strcmp(argv[1], "info")) {
+ main_info(argc - 1, argv + 1);
} else if (!strcmp(argv[1], "help")) {
if (argc > 2)
help(argv[2]);
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2010-04-18 21:28 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-18 21:17 [PATCH 0/4] Add "xl info" command Andre Przywara
2010-04-18 21:23 ` [PATCH 1/4] libxl: extend physinfo structure Andre Przywara
2010-04-19 7:50 ` Vincent Hanquez
2010-04-19 15:27 ` [PATCH 1/4] libxl: extend physinfo structure [and 1 more messages] Ian Jackson
2010-04-18 21:25 ` [PATCH 2/4] libxl: add sched_get_id function Andre Przywara
2010-04-19 7:50 ` Vincent Hanquez
2010-04-19 15:29 ` [PATCH 2/4] libxl: add sched_get_id function [and 1 more messages] Ian Jackson
2010-04-18 21:26 ` [PATCH 3/4] libxl: add version_info function Andre Przywara
2010-04-19 8:08 ` Vincent Hanquez
2010-04-19 15:36 ` [PATCH 3/4] libxl: add version_info function [and 1 more messages] Ian Jackson
2010-04-19 16:07 ` Vincent Hanquez
2010-04-19 16:21 ` Ian Jackson
2010-04-19 16:41 ` Vincent Hanquez
2010-04-19 20:43 ` Andre Przywara
2010-04-20 8:36 ` Vincent Hanquez
2010-04-21 12:10 ` Andre Przywara
2010-04-21 12:53 ` Vincent Hanquez
2010-04-18 21:28 ` Andre Przywara [this message]
2010-04-19 15:38 ` [PATCH 4/4] xl: add "xl info" command Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BCB7963.6020707@amd.com \
--to=andre.przywara@amd.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=keir.fraser@eu.citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.