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 rename" command, a clone of "

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xl: Add "xl rename" command, a clone of "xm rename".
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 07 May 2010 02:25:29 -0700
Delivery-date: Fri, 07 May 2010 02:28:26 -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 1273221098 -3600
# Node ID bf60f0c6f28a5af6404fd7cde2abd1551355a054
# Parent  9a289224efeacf6c0dadf7a7a2591ebdc68e9415
xl: Add "xl rename" command, a clone of "xm rename".

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

diff -r 9a289224efea -r bf60f0c6f28a tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Fri May 07 09:31:21 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Fri May 07 09:31:38 2010 +0100
@@ -1243,6 +1243,9 @@ void help(char *command)
     } else if (!strcmp(command, "domname")) {
         printf("Usage: xl domname <DomainId>\n\n");
         printf("Convert a domain id to domain name.\n");
+    } else if (!strcmp(command, "rename")) {
+        printf("Usage: xl rename <Domain> <NewDomainName>\n\n");
+        printf("Rename a domain.\n");
     }
 }
 
@@ -3040,3 +3043,45 @@ int main_domname(int argc, char **argv)
 
     exit(0);
 }
+
+int main_rename(int argc, char **argv)
+{
+    int opt;
+    char *dom;
+    char *new_name;
+    xs_transaction_t t;
+
+    while ((opt = getopt(argc, argv, "h")) != -1) {
+        switch (opt) {
+        case 'h':
+            help("rename");
+            exit(0);
+        default:
+            fprintf(stderr, "option `%c' not supported.\n", opt);
+            break;
+        }
+    }
+
+    dom = argv[optind++];
+    if (!dom || !argv[optind]) {
+        fprintf(stderr, "'xl rename' requires 2 arguments.\n\n");
+        help("rename");
+        exit(1);
+    }
+
+    find_domain(dom);
+    new_name = argv[optind];
+
+retry_transaction:
+    t = xs_transaction_start(ctx.xsh);
+    if (libxl_domain_rename(&ctx, domid, common_domname, new_name, t)) {
+        fprintf(stderr, "Can't rename domain '%s'.\n", dom);
+        exit(1);
+    }
+
+    if (!xs_transaction_end(ctx.xsh, t, 0))
+        if (errno == EAGAIN)
+            goto retry_transaction;
+
+    exit(0);
+}
diff -r 9a289224efea -r bf60f0c6f28a tools/libxl/xl_cmdimpl.h
--- a/tools/libxl/xl_cmdimpl.h  Fri May 07 09:31:21 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.h  Fri May 07 09:31:38 2010 +0100
@@ -37,5 +37,6 @@ int main_sched_credit(int argc, char **a
 int main_sched_credit(int argc, char **argv);
 int main_domid(int argc, char **argv);
 int main_domname(int argc, char **argv);
+int main_rename(int argc, char **argv);
 
 void help(char *command);
diff -r 9a289224efea -r bf60f0c6f28a tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c Fri May 07 09:31:21 2010 +0100
+++ b/tools/libxl/xl_cmdtable.c Fri May 07 09:31:38 2010 +0100
@@ -38,6 +38,7 @@ struct cmd_spec cmd_table[] = {
     { "sched-credit", &main_sched_credit, "get/set credit scheduler 
parameters" },
     { "domid", &main_domid, "convert a domain name to domain id"},
     { "domname", &main_domname, "convert a domain id to domain name"},
+    { "rename", &main_rename, "rename a domain"},
 };
 
 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 rename" command, a clone of "xm rename"., Xen patchbot-unstable <=