[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] libxl: fix vif.ifname when used with stub device model
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1342792265 -3600 # Node ID 79cfa1892a5d55f2c137da6d4f2d5f261b47db26 # Parent 9cdc74869620ed5e9b4f379d83963755f4c45e01 libxl: fix vif.ifname when used with stub device model. Currently the same libxl_device_nic is used to create both the HVM domain and its stub domain's NICs. This means that if a vifname is provided both the HVM domains PV NIC and the stub domains PV NIC will get the same name and the DM's NIC will fail to be attached. Instead launder the libxl_device_nic to add the TAP_DEVICE_SUFFIX ("-emu"). This is a bit of a misnomer, since the device is actually PV, but it is used to "back" the emulated device in the stub domain and this naming scheme is consistent with the non-stub case and is known to work e.g. with our hotplug scripts. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> diff -r 9cdc74869620 -r 79cfa1892a5d tools/libxl/libxl_dm.c --- a/tools/libxl/libxl_dm.c Fri Jul 20 12:03:49 2012 +0100 +++ b/tools/libxl/libxl_dm.c Fri Jul 20 14:51:05 2012 +0100 @@ -616,6 +616,24 @@ static char ** libxl__build_device_model } } +static void libxl__dm_nics_from_hvm_guest_config(libxl__gc *gc, + libxl_domain_config * const guest_config, + libxl_domain_config *dm_config) +{ + int i, nr = guest_config->num_nics; + + GCNEW_ARRAY(dm_config->nics, nr); + + for (i=0; i<nr; i++) { + dm_config->nics[i] = guest_config->nics[i]; + if (dm_config->nics[i].ifname) + dm_config->nics[i].ifname = GCSPRINTF("%s" TAP_DEVICE_SUFFIX, + dm_config->nics[i].ifname); + } + + dm_config->num_nics = nr; +} + static int libxl__vfb_and_vkb_from_hvm_guest_config(libxl__gc *gc, const libxl_domain_config *guest_config, libxl_device_vfb *vfb, @@ -764,8 +782,7 @@ void libxl__spawn_stub_dm(libxl__egc *eg dm_config->disks = guest_config->disks; dm_config->num_disks = guest_config->num_disks; - dm_config->nics = guest_config->nics; - dm_config->num_nics = guest_config->num_nics; + libxl__dm_nics_from_hvm_guest_config(gc, guest_config, dm_config); dm_config->c_info.run_hotplug_scripts = guest_config->c_info.run_hotplug_scripts; _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |