]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
add nodeinfo, rename dinfo to dominfo, fix libvirt.h typo
authorKarel Zak <kzak@redhat.com>
Tue, 4 Apr 2006 14:37:32 +0000 (14:37 +0000)
committerKarel Zak <kzak@redhat.com>
Tue, 4 Apr 2006 14:37:32 +0000 (14:37 +0000)
ChangeLog
docs/FAQ.html
docs/libvir.html
include/libvirt.h
include/libvirt.h.in
include/libvirt/libvirt.h
include/libvirt/libvirt.h.in
src/virsh.c

index 0f11bb18c941c755a25b21c2572e02147ace44cb..e35c6aa5859aebba262e37dc196485abe12d82b9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Apr  4 12:41:53 CEST 2006 Karel Zak <kzak@redhat.com>
+
+       * src/virsh.c: add new command "nodeinfo"
+       * include/libvirt.h.in: fix typo (virNodeInfo.memory is in kB)
+       * docs/FAQ.html docs/libvir.html src/virsh.c: rename command 
+         "dinfo" to "dominfo"
+
 Mon Apr  3 14:46:39 EDT 2006 Daniel Veillard <veillard@redhat.com>
 
        * include/libvirt.h[.in] src/driver.h src/libvirt.c 
index f2d26452274597df7707c718864762b1f4a3634c..81323a149c08567531791b94541560c8bd4235c4 100644 (file)
@@ -36,7 +36,7 @@
   <li><em>Failure to use the API for non-root users</em>
     <p>Large parts of the API may only be accessible with root priviledges,
     however the read only access to the xenstore data doesnot have to be
-    forbidden to user, at least for monitoring purposes. If "virsh dinfo"
+    forbidden to user, at least for monitoring purposes. If "virsh dominfo"
     fails to run as an user, change the mode of the xenstore read-only socket
     with:</p>
     <p><code>chmod 666 /var/run/xenstored/socket_ro</code></p>
index 2daa9fae62bd9656ee5a8eaf11ccc962355fb9fa..594b1b1b7fa635eebc934fc1688d3f0559baf3db 100644 (file)
@@ -567,7 +567,7 @@ containing the same field as a virError in C, but cast to Python.</p>
   <li><em>Failure to use the API for non-root users</em>
     <p>Large parts of the API may only be accessible with root priviledges,
     however the read only access to the xenstore data doesnot have to be
-    forbidden to user, at least for monitoring purposes. If "virsh dinfo"
+    forbidden to user, at least for monitoring purposes. If "virsh dominfo"
     fails to run as an user, change the mode of the xenstore read-only socket
     with:</p>
     <p><code>chmod 666 /var/run/xenstored/socket_ro</code></p>
index 02ca8c21972e81894b47843ac88a2aa1af97b2e5..fe1677b5ba36fafc94abfa6af5c2abece993358f 100644 (file)
@@ -158,7 +158,7 @@ typedef struct _virNodeInfo virNodeInfo;
 
 struct _virNodeInfo {
     char model[32];    /* string indicating the CPU model */
-    unsigned long memory;/* memory size in megabytes */
+    unsigned long memory;/* memory size in kilobytes */
     unsigned int cpus; /* the number of active CPUs */
     unsigned int mhz;  /* expected CPU frequency */
     unsigned int nodes;        /* the number of NUMA cell, 1 for uniform mem access */
index a73c46ac93f275b781b383ef595bdaf902858d45..f90292f5ee643790b4a7ae8643c9a238f3083733 100644 (file)
@@ -158,7 +158,7 @@ typedef struct _virNodeInfo virNodeInfo;
 
 struct _virNodeInfo {
     char model[32];    /* string indicating the CPU model */
-    unsigned long memory;/* memory size in megabytes */
+    unsigned long memory;/* memory size in kilobytes */
     unsigned int cpus; /* the number of active CPUs */
     unsigned int mhz;  /* expected CPU frequency */
     unsigned int nodes;        /* the number of NUMA cell, 1 for uniform mem access */
index 02ca8c21972e81894b47843ac88a2aa1af97b2e5..fe1677b5ba36fafc94abfa6af5c2abece993358f 100644 (file)
@@ -158,7 +158,7 @@ typedef struct _virNodeInfo virNodeInfo;
 
 struct _virNodeInfo {
     char model[32];    /* string indicating the CPU model */
-    unsigned long memory;/* memory size in megabytes */
+    unsigned long memory;/* memory size in kilobytes */
     unsigned int cpus; /* the number of active CPUs */
     unsigned int mhz;  /* expected CPU frequency */
     unsigned int nodes;        /* the number of NUMA cell, 1 for uniform mem access */
index a73c46ac93f275b781b383ef595bdaf902858d45..f90292f5ee643790b4a7ae8643c9a238f3083733 100644 (file)
@@ -158,7 +158,7 @@ typedef struct _virNodeInfo virNodeInfo;
 
 struct _virNodeInfo {
     char model[32];    /* string indicating the CPU model */
-    unsigned long memory;/* memory size in megabytes */
+    unsigned long memory;/* memory size in kilobytes */
     unsigned int cpus; /* the number of active CPUs */
     unsigned int mhz;  /* expected CPU frequency */
     unsigned int nodes;        /* the number of NUMA cell, 1 for uniform mem access */
index 39c3665bd3eeba7a56cf7b1204e8092666f17b18..868eb91cd68b7720d62e90804ba1d684ed91fa9b 100644 (file)
@@ -714,22 +714,22 @@ cmdDestroy(vshControl * ctl, vshCmd * cmd)
 }
 
 /*
- * "dinfo" command
+ * "dominfo" command
  */
-static vshCmdInfo info_dinfo[] = {
-    {"syntax", "dinfo <domain>"},
+static vshCmdInfo info_dominfo[] = {
+    {"syntax", "dominfo <domain>"},
     {"help", "domain information"},
     {"desc", "Returns basic information about the domain."},
     {NULL, NULL}
 };
 
-static vshCmdOptDef opts_dinfo[] = {
+static vshCmdOptDef opts_dominfo[] = {
     {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, "domain name or id"},
     {NULL, 0, 0, NULL}
 };
 
 static int
-cmdDinfo(vshControl * ctl, vshCmd * cmd)
+cmdDominfo(vshControl * ctl, vshCmd * cmd)
 {
     virDomainInfo info;
     virDomainPtr dom;
@@ -777,6 +777,40 @@ cmdDinfo(vshControl * ctl, vshCmd * cmd)
     return ret;
 }
 
+/*
+ * "nodeinfo" command
+ */
+static vshCmdInfo info_nodeinfo[] = {
+    {"syntax", "nodeinfo"},
+    {"help", "node information"},
+    {"desc", "Returns basic information about the node."},
+    {NULL, NULL}
+};
+
+static int
+cmdNodeinfo(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
+{
+    virNodeInfo info;
+        
+    if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
+        return FALSE;
+
+    if (virNodeGetInfo(ctl->conn, &info) < 0) {
+        vshError(ctl, FALSE, "failed to get node information");
+        return FALSE;
+    }    
+    vshPrint(ctl, VSH_MESG, "%-20s %s\n", "CPU model:", info.model);
+    vshPrint(ctl, VSH_MESG, "%-20s %d\n", "CPU(s):", info.cpus);
+    vshPrint(ctl, VSH_MESG, "%-20s %d MHz\n", "CPU frequency:", info.mhz);
+    vshPrint(ctl, VSH_MESG, "%-20s %d\n", "CPU socket(s):", info.sockets);
+    vshPrint(ctl, VSH_MESG, "%-20s %d\n", "Core(s) per socket:", info.cores);
+    vshPrint(ctl, VSH_MESG, "%-20s %d\n", "Thread(s) per core:", info.threads);
+    vshPrint(ctl, VSH_MESG, "%-20s %d\n", "NUMA cell(s):", info.nodes);
+    vshPrint(ctl, VSH_MESG, "%-20s %lu kB\n", "Memory size:", info.memory);
+        
+    return TRUE;
+}
+
 /*
  * "dumpxml" command
  */
@@ -992,7 +1026,8 @@ cmdQuit(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
 static vshCmdDef commands[] = {
     {"connect", cmdConnect, opts_connect, info_connect},
     {"create", cmdCreate, opts_create, info_create},
-    {"dinfo", cmdDinfo, opts_dinfo, info_dinfo},
+    {"dominfo", cmdDominfo, opts_dominfo, info_dominfo},
+    {"nodeinfo", cmdNodeinfo, NULL, info_nodeinfo},
     {"dumpxml", cmdDumpXML, opts_dumpxml, info_dumpxml},
     {"dstate", cmdDstate, opts_dstate, info_dstate},
     {"suspend", cmdSuspend, opts_suspend, info_suspend},