[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] xl: avoid creating domains with duplicate names
Do not create the domain if another domain with the same name is already running. Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> diff -r 829855751e19 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Tue Jan 25 15:05:20 2011 +0000 +++ b/tools/libxl/xl_cmdimpl.c Tue Jan 25 15:12:21 2011 +0000 @@ -569,6 +569,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; @@ -598,6 +599,11 @@ 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 (!xlu_cfg_get_string (config, "uuid", &buf) ) { if ( libxl_uuid_from_string(&c_info->uuid, buf) ) { _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |