All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2]xl: Add "xl domid" command
@ 2010-05-07  5:00 Yang Hongyang
  2010-05-07 15:43 ` Stefano Stabellini
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Hongyang @ 2010-05-07  5:00 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com

Add "xl domid" command, a clone of "xm domid".

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>

diff -r ccae861f52f7 -r 1d00cee69621 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu May 06 11:59:55 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Fri May 07 19:35:40 2010 +0800
@@ -1221,6 +1221,9 @@
         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");
     }
 }
 
@@ -2945,3 +2948,36 @@
 
     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 ccae861f52f7 -r 1d00cee69621 tools/libxl/xl_cmdimpl.h
--- a/tools/libxl/xl_cmdimpl.h	Thu May 06 11:59:55 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.h	Fri May 07 19:35:40 2010 +0800
@@ -35,5 +35,6 @@
 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 ccae861f52f7 -r 1d00cee69621 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Thu May 06 11:59:55 2010 +0100
+++ b/tools/libxl/xl_cmdtable.c	Fri May 07 19:35:40 2010 +0800
@@ -35,7 +35,8 @@
     { "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);

-- 
Regards
Yang Hongyang

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2]xl: Add "xl domid" command
  2010-05-07  5:00 [PATCH 1/2]xl: Add "xl domid" command Yang Hongyang
@ 2010-05-07 15:43 ` Stefano Stabellini
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Stabellini @ 2010-05-07 15:43 UTC (permalink / raw)
  To: Yang Hongyang; +Cc: xen-devel@lists.xensource.com

On Fri, 7 May 2010, Yang Hongyang wrote:
> Add "xl domid" command, a clone of "xm domid".
> 
> Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
> 


Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-07 15:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-07  5:00 [PATCH 1/2]xl: Add "xl domid" command Yang Hongyang
2010-05-07 15:43 ` Stefano Stabellini

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.