aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl.c
diff options
context:
space:
mode:
authorRoger Pau Monne <roger.pau@citrix.com>2012-09-14 10:02:48 +0100
committerRoger Pau Monne <roger.pau@citrix.com>2012-09-14 10:02:48 +0100
commit02fcb500405cb90d722d9c7e5d0b06f665812a37 (patch)
treea1ff85b360f39275f932168bb09e2a422d350aa7 /tools/libxl/libxl.c
parent19459d56f493b380e2df30e06822cc7b01183186 (diff)
downloadxen-02fcb500405cb90d722d9c7e5d0b06f665812a37.tar.gz
xen-02fcb500405cb90d722d9c7e5d0b06f665812a37.tar.bz2
xen-02fcb500405cb90d722d9c7e5d0b06f665812a37.zip
libxl: fix usage of backend parameter and run_hotplug_scripts
vif interfaces allows the user to specify the domain that should run the backend (also known as driver domain) using the 'backend' parameter. This is not compatible with run_hotplug_scripts=1, since libxl can only run the hotplug scripts from the Domain 0. Signed-off-by: Roger Pau Monne <roger.pau@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxl/libxl.c')
-rw-r--r--tools/libxl/libxl.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 5d26483073..bc2f1eadf5 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -2476,6 +2476,8 @@ out:
int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic,
uint32_t domid)
{
+ int run_hotplug_scripts;
+
if (!nic->mtu)
nic->mtu = 1492;
if (!nic->model) {
@@ -2505,6 +2507,18 @@ int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic,
libxl__xen_script_dir_path()) < 0 )
return ERROR_FAIL;
+ run_hotplug_scripts = libxl__hotplug_settings(gc, XBT_NULL);
+ if (run_hotplug_scripts < 0) {
+ LOG(ERROR, "unable to get current hotplug scripts execution setting");
+ return run_hotplug_scripts;
+ }
+ if (nic->backend_domid != LIBXL_TOOLSTACK_DOMID && run_hotplug_scripts) {
+ LOG(ERROR, "cannot use a backend domain different than %d if"
+ "hotplug scripts are executed from libxl",
+ LIBXL_TOOLSTACK_DOMID);
+ return ERROR_FAIL;
+ }
+
switch (libxl__domain_type(gc, domid)) {
case LIBXL_DOMAIN_TYPE_HVM:
if (!nic->nictype)