aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_utils.c
diff options
context:
space:
mode:
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>2013-04-15 10:33:25 -0400
committerIan Campbell <ian.campbell@citrix.com>2013-04-17 14:55:36 +0100
commitef496b81f0336f09968a318e7f81151dd4f5a0cc (patch)
tree6125e22ae11b66884d086ebc24c85a6b0daee490 /tools/libxl/libxl_utils.c
parent0b0ec476bb9dca589674745ebffb0f6799774d6e (diff)
downloadxen-ef496b81f0336f09968a318e7f81151dd4f5a0cc.tar.gz
xen-ef496b81f0336f09968a318e7f81151dd4f5a0cc.tar.bz2
xen-ef496b81f0336f09968a318e7f81151dd4f5a0cc.zip
libxl: postpone backend name resolution
This adds a backend_domname field in libxl devices that contain a backend_domid field, allowing either a domid or a domain name to be specified in the configuration structures. The domain name is resolved into a domain ID in the _setdefault function when adding the device. This change allows the backend of the block devices to be specified (which previously required passing the libxl_ctx down into the block device parser), and will simplify specification of backend domains in other users of libxl. The check on run_hotplug_scripts in parse_config_data is removed because it is a duplicate of the one in libxl__device_nic_setdefault, and is removed here because it no longer has the resolved domain ID to check. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> [ ijc -- reran flex ]
Diffstat (limited to 'tools/libxl/libxl_utils.c')
-rw-r--r--tools/libxl/libxl_utils.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
index 8f7879060f..35da71c482 100644
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -90,6 +90,25 @@ int libxl_name_to_domid(libxl_ctx *ctx, const char *name,
return ret;
}
+int libxl_domain_qualifier_to_domid(libxl_ctx *ctx, const char *name,
+ uint32_t *domid)
+{
+ int i, rv;
+ for (i=0; name[i]; i++) {
+ if (!isdigit(name[i])) {
+ goto nondigit_found;
+ }
+ }
+ *domid = strtoul(name, NULL, 10);
+ return 0;
+
+ nondigit_found:
+ /* this could also check for uuids */
+ rv = libxl_name_to_domid(ctx, name, domid);
+ return rv;
+}
+
+
char *libxl_cpupoolid_to_name(libxl_ctx *ctx, uint32_t poolid)
{
unsigned int len;