WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] xl: Add "xl domid" command, a clone of "x

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xl: Add "xl domid" command, a clone of "xm domid".
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 07 May 2010 02:25:27 -0700
Delivery-date: Fri, 07 May 2010 02:27:27 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1273221056 -3600
# Node ID 311eb39e96496db80f5289450bd7d9ecfc7bfdbb
# Parent  5ac6e33fa3a7fe6645eaeb7de530a29be2865c34
xl: Add "xl domid" command, a clone of "xm domid".

Signed-off-by: Yang Hongyang <yanghy@xxxxxxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c  |   36 ++++++++++++++++++++++++++++++++++++
 tools/libxl/xl_cmdimpl.h  |    1 +
 tools/libxl/xl_cmdtable.c |    3 ++-
 3 files changed, 39 insertions(+), 1 deletion(-)

diff -r 5ac6e33fa3a7 -r 311eb39e9649 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Fri May 07 09:27:40 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Fri May 07 09:30:56 2010 +0100
@@ -1237,6 +1237,9 @@ void help(char *command)
         printf("  -d DOMAIN, --domain=DOMAIN     Domain to modify\n");
         printf("  -w WEIGHT, --weight=WEIGHT     Weight (int)\n");
         printf("  -c CAP, --cap=CAP              Cap (int)\n");
+    } else if (!strcmp(command, "domid")) {
+        printf("Usage: xl domid <DomainName>\n\n");
+        printf("Convert a domain name to domain id.\n");
     }
 }
 
@@ -2961,3 +2964,36 @@ int main_sched_credit(int argc, char **a
 
     exit(0);
 }
+
+int main_domid(int argc, char **argv)
+{
+    int opt;
+    char *domname = NULL;
+
+    while ((opt = getopt(argc, argv, "h")) != -1) {
+        switch (opt) {
+        case 'h':
+            help("domid");
+            exit(0);
+        default:
+            fprintf(stderr, "option `%c' not supported.\n", opt);
+            break;
+        }
+    }
+
+    domname = argv[optind];
+    if (!domname) {
+        fprintf(stderr, "Must specify a domain name.\n\n");
+        help("domid");
+        exit(1);
+    }
+
+    if (libxl_name_to_domid(&ctx, domname, &domid)) {
+        fprintf(stderr, "Can't get domid of domain name '%s', maybe this 
domain does not exist.\n", domname);
+        exit(1);
+    }
+
+    printf("%d\n", domid);
+
+    exit(0);
+}
diff -r 5ac6e33fa3a7 -r 311eb39e9649 tools/libxl/xl_cmdimpl.h
--- a/tools/libxl/xl_cmdimpl.h  Fri May 07 09:27:40 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.h  Fri May 07 09:30:56 2010 +0100
@@ -35,5 +35,6 @@ int main_vcpuset(int argc, char **argv);
 int main_vcpuset(int argc, char **argv);
 int main_memset(int argc, char **argv);
 int main_sched_credit(int argc, char **argv);
+int main_domid(int argc, char **argv);
 
 void help(char *command);
diff -r 5ac6e33fa3a7 -r 311eb39e9649 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c Fri May 07 09:27:40 2010 +0100
+++ b/tools/libxl/xl_cmdtable.c Fri May 07 09:30:56 2010 +0100
@@ -35,7 +35,8 @@ struct cmd_spec cmd_table[] = {
     { "vcpu-set", &main_vcpuset, "set the number of active VCPUs allowed for 
the domain" },
     { "list-vm", &main_list_vm, "list the VMs,without DOM0" },
     { "info", &main_info, "get information about Xen host" },
-    { "sched-credit", &main_sched_credit, "get/set credit scheduler 
parameters" }
+    { "sched-credit", &main_sched_credit, "get/set credit scheduler 
parameters" },
+    { "domid", &main_domid, "convert a domain name to domain id"},
 };
 
 int cmdtable_len = sizeof(cmd_table)/sizeof(struct cmd_spec);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xl: Add "xl domid" command, a clone of "xm domid"., Xen patchbot-unstable <=