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: avoid creating domains with duplicate

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xl: avoid creating domains with duplicate names
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Sat, 29 Jan 2011 15:05:35 -0800
Delivery-date: Sat, 29 Jan 2011 15:10:27 -0800
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 Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
# Date 1296057909 0
# Node ID 310cc33bfc810824c9f818ca7f320e6e88f26705
# Parent  67d5b80049473d4b00ad8c198b9d11e6488b1c0e
xl: avoid creating domains with duplicate names

Do not create the domain if another domain with the same name is already
running.

This is another error-checking function at rather too high a level:
this should be moved into libxl_domain_rename in 4.2.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c |   10 ++++++++++
 1 files changed, 10 insertions(+)

diff -r 67d5b8004947 -r 310cc33bfc81 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Wed Jan 26 11:58:45 2011 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Wed Jan 26 16:05:09 2011 +0000
@@ -583,6 +583,7 @@ static void parse_config_data(const char
     XLU_ConfigList *vbds, *nics, *pcis, *cvfbs, *net2s, *cpuids;
     int pci_power_mgmt = 0;
     int pci_msitranslate = 1;
+    uint32_t domid_e;
     int e;
 
     libxl_domain_create_info *c_info = &d_config->c_info;
@@ -612,6 +613,15 @@ static void parse_config_data(const char
 
     if (xlu_cfg_replace_string (config, "name", &c_info->name))
         c_info->name = strdup("test");
+    e = libxl_name_to_domid(&ctx, c_info->name, &domid_e);
+    if (!e) {
+        fprintf(stderr, "A domain with name \"%s\" already exists.\n", 
c_info->name);
+        exit(1);
+    }
+    if (e != ERROR_INVAL) {
+        fprintf(stderr, "Unexpected error checking for existing domain"
+                " (error=%d)", e);
+    }
 
     if (!xlu_cfg_get_string (config, "uuid", &buf) ) {
         if ( libxl_uuid_from_string(&c_info->uuid, buf) ) {

_______________________________________________
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: avoid creating domains with duplicate names, Xen patchbot-unstable <=