aboutsummaryrefslogtreecommitdiffstats
path: root/tools/hotplug
Commit message (Collapse)AuthorAgeFilesLines
* tools: disable xend build by defaultIan Campbell2013-09-171-0/+4
| | | | | | | | | | Add big warnings to configure, xend initscript and xm. The big xm warning is displayed once (per boot, or per tmpreaper clean), afterwards a single line warning is displayed. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools/hotplug: set mtu from bridge for tap interfaceCharles Arnold2013-09-172-5/+12
| | | | | | | | | | | | | With changeset 22885 support was added for setting the MTU in the vif-bridge script for when a vif interface was set to 'online'. The was not done for the 'add' operation. The 'add' operation was added to the script for when tap devices were specified (c/s 21944). With the setting of the MTU for the 'online' case was there a reason for omitting the 'add'? This patch sets the MTU for both 'online' and 'add' in the vif-bridge script. Signed-off-by: Charles Arnold <carnold@suse.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* Revert "libxl, hotplug/Linux: default to phy backend for raw format file"Ian Campbell2013-09-161-9/+7
| | | | | This reverts commit 11a63a1660453269ddd1893c15d0a98133b33ca7. The change causes issues with live migration.
* libxl, hotplug/Linux: default to phy backend for raw format fileWei Liu2013-09-131-7/+9
| | | | | | | | | | | | | | | | | Modify libxl to allow raw format file to use phy backend. For the hotplug script part, learn from NetBSD's block hotplug script -- test the path and determine the actual type of file (block device or regular file) then use the actual type to determine which branch to run. With these changes, plus the current ordering of backend preference (phy > qdisk > tap), we will use phy backend for raw format file by default. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Roger Pau Monné <roger.pau@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* hotplug/Linux: add sysconfig tags to xencommonsOlaf Hering2013-09-091-0/+16
| | | | | | | | | YaST2 sysconfig can logically group the various sysconfig settings if the files are tagged. Add the missing (YaST specific) tags to xencommons. See for a description http://old-en.opensuse.org/Packaging/SUSE_Package_Conventions/Sysconfig Signed-off-by: Olaf Hering <olaf@aepfle.de>
* tools: disable blktap1 build by defaultIan Campbell2013-08-201-1/+3
| | | | | | | | | | | I don't think there are any dom0's around whose kernels support only blktap1 and not something newer like blktap2 or qdisk. Certainly not that you would want to run Xen 4.4 on. libxl will never use blktap1. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools: make building xend configurable.Ian Campbell2013-08-202-2/+6
| | | | | | | | | | | | | xend has been deprecated for 2 releases now. Lets make it possible to not even build it. For now I'm leaving the default of on but I would like to change that before the 4.4 release. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Matt Wilson <msw@amazon.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* vif-bridge: fix cut behavior changeBob Proulx2013-08-201-2/+1
| | | | | | | | A recent change in GNU cut disallows use of a newline as a field delimiter. Avoid the problematic use of cut in vif-bridge. Signed-off-by: Bob Proulx <bob@proulx.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* Xendomains was not correctly suspending domains when a STOP was issued.Ian Murray2013-06-271-5/+5
| | | | | | | | | | | | | | | | | The regex was not selecting the { when parsing JSON output of xl list -l. It was also not selecting (domain when parsing xl list -l when SXP selected. Pefixed { with 4 spaces, and removed an extra ( before domain in the regex string Added quotes around the grep strings so the spaces inserted into the string didn't not break the grepping. This has now been tested against 4.3RC5 Signed-off-by: Ian Murray <murrayie@yahoo.co.uk> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
* also override library path for hotplug scriptsJan Beulich2013-06-261-0/+1
| | | | | | | | | Overriding PATH but not LD_LIBRARY_PATH is bogus, as it may result in the use of mismatched binaries and libraries. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
* hotplug/Linux: xendomains compatibility with xlIan Murray2013-05-231-1/+3
| | | | | | | | | The xl save file uses a different header string to the xm one. Teach the xendomains script about it. Signed-off-by: Ian MURRAY <murrayie@yahoo.co.uk> Acked-by: Ian Campbell <ian.campbell@citrix.com> [ ijc -- rewrote commit message ]
* hotplug/Linux: add iscsi block hotplug scriptRoger Pau Monne2013-05-082-0/+155
| | | | | | | | | | This hotplug script has been tested with IET and NetBSD iSCSI targets, without authentication. This hotplug script will only work with PV guests not using pygrub. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* hotplug: add openvswitch scriptIan Campbell2013-04-242-0/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | Based on Waldi's RFC at http://lists.xen.org/archives/html/xen-devel/2012-09/msg00943.html To use it set vif.default.script="vif-openvswitch" in /etc/xen/xl.conf or use script=vif-openvswitch in the vif configuration. Appears to do the right thing for PV and HVM guests (including tap devices) and with stubdomains. In order to support VLAN tagging and trunking the "bridge" specified in the configuration can have a special syntax, that is: BRIDGE_NAME[.VLAN][:TRUNK:TRUNK] e.g. - xenbr0.99 add the VIF to VLAN99 on xenbr0 - xenbr0:99:100:101 add the VIF to xenbr0 as a trunk port receiving VLANs 99, 100 & 101 Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Bastian Blank <waldi@debian.org> Acked-by: Roger Pau Monné <roger.pau@citrix.com> Cc: dev@openvswitch.org
* hotplug/Linux: Remove hardcoded pathsIan Campbell2013-04-114-22/+28
| | | | | | | Use xen-hotplugpath.sh (as NetBSD does) which allows PREFIX etc to change. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Roger Pau Monne <roger.pau@citrix.com>
* xencommons: redirect serial and parallel to /dev/nullStefano Stabellini2013-02-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Upstream QEMU doesn't support -nographic with -daemonize unless monitor, serial and parallel outputs are all redirected: /* According to documentation and historically, -nographic redirects * serial port, parallel port and monitor to stdio, which does not work * with -daemonize. We can redirect these to null instead, but since * -nographic is legacy, let's just error out. * We disallow -nographic only if all other ports are not redirected * explicitly, to not break existing legacy setups which uses * -nographic _and_ redirects all ports explicitly - this is valid * usage, -nographic is just a no-op in this case. */ Considering that we do want to redirect them to /dev/null anyway, do so. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Tested-by: Sander Eikelenboom <linux@eikelenboom.it> Acked-by: Ian Campbell <ian.campbell@citrix.com> [ ijc -- handled reject vs 26352:9a1610c1e564 "xencommons: Stop QEMU in do_stop()" and rewrapped the resulting long line ] Committed-by: Ian Campbell <ian.campbell@citrix.com>
* xencommons: Stop QEMU in do_stop()Wei Liu2013-01-111-1/+9
| | | | | | | | | do_stop() is invoked by "restart" action. We can get multiple QEMUs started up for Dom0 if we don't kill previous ones. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* hotplug/Linux: Fix locking in tools/hotplug/Linux/locking.shJacek Konieczny2012-11-141-1/+1
| | | | | | | | | | | | | | The claim_lock() function would fail in the perl code with: Invalid argument at -e line 2. because the Perl snippet opens for reading the file descriptor, which was earlier opened for write (append). Signed-off-by: Jacek Konieczny <jajcus@jajcus.net> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* tools: Remove the vtpm process modelMatthew Fioravante2012-11-138-754/+1
| | | | | | | | | Remove the old vtpm process model. It doesn't work very well and is no longer supported. Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* hotplug/Linux: install sysconfig files as data filesOlaf Hering2012-10-181-2/+2
| | | | | | | | | | | | | | | rpmlint complains about wrong permissions of config files: [ 455s] xen-tools.i586: W: script-without-shebang /var/adm/fillup-templates/sysconfig.xendomains [ 455s] xen-tools.i586: W: script-without-shebang /var/adm/fillup-templates/sysconfig.xencommons [ 455s] This text file has executable bits set or is located in a path dedicated for [ 455s] executables, but lacks a shebang and cannot thus be executed. If the file is [ 455s] meant to be an executable script, add the shebang, otherwise remove the [ 455s] executable bits or move the file elsewhere. Signed-off-by: Olaf Hering <olaf@aepfle.de> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* hotplug/Linux: correct sysconfig tag in xendomainsOlaf Hering2012-10-181-1/+1
| | | | | | Signed-off-by: Olaf Hering <olaf@aepfle.de> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* hotplug: install hotplugpath.sh as data fileOlaf Hering2012-10-181-2/+2
| | | | | | | | | | | | | | rpmlint complains a script helper which is only sourced: [ 1875s] xen-tools.i586: W: script-without-shebang /etc/xen/scripts/hotplugpath.sh [ 1875s] This text file has executable bits set or is located in a path dedicated for [ 1875s] executables, but lacks a shebang and cannot thus be executed. If the file is [ 1875s] meant to be an executable script, add the shebang, otherwise remove the [ 1875s] executable bits or move the file elsewhere. Signed-off-by: Olaf Hering <olaf@aepfle.de> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* hotplug/Linux: close lockfd after lock attemptOlaf Hering2012-10-181-0/+3
| | | | | | | | | | | | | | | | | When a HVM guest is shutdown some of the 'remove' events can not claim the lock for some reason. Instead they try to grab the lock in a busy loop, until udev reaps the xen-hotplug-cleanup helper. After analyzing the resulting logfile its not obvious what the cause is. The only explanation is that bash (?) gets confused if the same lockfd is opened again and again. Closing it in each iteration seem to fix the issue. This was observed with sles11sp2 (bash 3.2) and 4.2 xend. Signed-off-by: Olaf Hering <olaf@aepfle.de> Acked-by: Ian Campbell <Ian.campbell@citrix.com> [ ijc -- added the comment ] Committed-by: Ian Campbell <ian.campbell@citrix.com>
* hotplug/Linux: remove hotplug support, rely on udev insteadOlaf Hering2012-10-182-72/+1
| | | | | | | | | | | | | | | | | | Hotplug has been replaced by udev since several years. Remove the hotplug related files and install udev unconditionally. This makes it possible to remove udev from rpm BuildRequires which reduces the buildtime dependency chain. For openSuSE:Factory it was done just now: http://lists.opensuse.org/opensuse-buildservice/2012-10/msg00085.html The patch by itself will have no practical impact unless someone attempts to build and run a Xen dom0 on a really old base system. e.g. circa SLES9/2007 or earlier Signed-off-by: Olaf Hering <olaf@aepfle.de> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* init/sysconfig scripts: Remove --halt/-H option for shutdown command.Sander Eikelenboom2012-10-113-9/+9
| | | | | | | | | | | The --halt/-H option for the shutdown command is now pointless, since linux in a guest treats "halt" and "poweroff" identically. The option is not implemented in xl / libxl and if supplied causes the command to fail , so remove it from the init and sysconfig scripts. Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* init scripts: xendomains correct order of options for shutdown commandSander Eikelenboom2012-10-111-1/+1
| | | | | | | | | | Options for the shutdown command that are supplied behind the domain id are ignored. In case of the default xendomains init script this means that it will not wait for the domains to be actually shutdown. Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* hotplug/Linux: Remove tracing (bash -x) from network-nat scriptOlaf Hering2012-10-081-1/+1
| | | | | | Signed-off-by: Olaf Hering <olaf@aepfle.de> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* xencommons: Attempt to load blktap2 driverIan Campbell2012-08-311-0/+1
| | | | | | | | | | | | | | | | | | | | | Older kernels, such as those found in Debian Squeeze: * Have bugs in handling of AIO into foreign pages * Have blktap modules, which will cause qemu not to use AIO, but which are not loaded on boot. Attempt to load blktap in xencommons, to make sure modern qemu's which use AIO will work properly on those kernels. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Prefer to load blktap2 if it exists. This is the name of the driver in classic-Xen ports, while in mainline kernels the driver is called just blktap. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Jan Beulich <JBeulich@suse.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* hotplug/NetBSD: check type of file to attach from paramsRoger Pau Monne2012-08-311-1/+10
| | | | | | | | | | | | xend used to set the xenbus backend entry "type" to either "phy" or "file", but now libxl sets it to "phy" for both file and block device. We have to manually check for the type of the "param" field in order to detect if we are trying to attach a file or a block device. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Signed-off-by: Roger Pau Monne <roger.pau@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* hotplug/NetBSD: write error message to hotplug-errorRoger Pau Monne2012-08-311-1/+2
| | | | | | | | | As recommended by Ian Campbell, write the hotplug error to hotplug-error, just as the Linux hotplug script does. Signed-off-by: Roger Pau Monne <roger.pau@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* hotplug/NetBSD: fix xenstore_write usage in errorRoger Pau Monne2012-08-311-1/+1
| | | | | | | | | | xenstore_write doesn't exist, use xenstore-write instead. The error function is currently broken without this change. Signed-off-by: Roger Pau Monne <roger.pau@citrix.com> Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* tools: init.d/Linux/xencommons: load all known backend driversOlaf Hering2012-08-131-0/+6
| | | | | | | | | | | Load all known backend drivers fron xenlinux and pvops based dom0 kernels. There is currently no code in xend or libxl to load these drivers on demand. Currently libxl has also no helpful error message if a backend driver is missing. Signed-off-by: Olaf Hering <olaf@aepfle.de> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: support custom block hotplug scriptsIan Campbell2012-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are provided using the "script=" syntax described in docs/misc/xl-disk-configuration.txt. The existing hotplug scripts currently conflate two different concepts, namely that of making a datapath available in the backend domain (logging into iSCSI LUNs and the like) and that of actually connecting that datapath to a Xen backend path (e.g. writing "physical-device" node in xenstore to bring up blkback). For this reason the script support implemented here is only supported in conjunction with backendtype=phy. Eventually we hope to rework the hotplug scripts to separate the to concepts, but that is not 4.2 material. In addition there are some other subtleties: - Previously in the blktap case we would add "script = .../blktap" to the backend flex array, but then jumped to the PHY case which added "script = .../block" too. The block one takes precendence since it comes second. This was, accidentally, correct. The blktap script is for blktap1 devices and not blktap2 devices. libxl completely manages the blktap2 side of things without resorting to hotplug scripts and creates a blkback device directly. Therefore the "block" script is always the correct one to call. Custom script are not supported in this context. - libxl should not write the "physical-device" node. This is the responsibility of the block script. Writing the "physical-device" node in libxl basically completely short-cuts the standard block hotplug script which uses "physical-device" to know if it has run already or not. In the case of more complex scripts libxl cannot know the right value to write here anyway, in particular the device may not exist until after the script is called. This change has the side effect of re-enabling the checks for device sharing aspect of the default block script, which I have tested and which now cause libxl to properly abort now that libxl properly checks for hotplug script errors. There is no sharing check for blktap2 since even if you reuse the same vhd the resulting tap device is different. I would have preferred to simply write the "physical-device" node for the blktap2 case but the hotplug script infrastructure is not currently setup to handle LIBXL__DEVICE_KIND_VBD devices without a hotplug script (backendtype phy and tap both end up as KIND_VBD). Changing this was more surgery than I was happy doing for 4.2 and therefore I have simply hardcoded to the block script for the LIBXL_DISK_BACKEND_TAP case. - libxl__device_disk_set_backend running against a phy device with a script cannot stat the device to check its properties since it may not exist until the script is run. Therefore I have special cased this in disk_try_backend to simply assume that backend == phy is always ok if a script was configured. Similarly the other backend types are always rejected if a script was configured. Note that the reason for implementing the default script behaviour in device_disk_add instead of libxl__device_disk_setdefault is because we need to be able to tell when the script was user-supplied rather than defaulted by libxl in order to correctly implement the above. The setdefault function must be idempotent so we cannot simply update disk->script. I suspect that for 4.3 a script member should be added to libxl__device, this would also help in the case above of handling devices with no script in a consistent manner. This is not 4.2 material. - When the block script falls through and shells out to a block-$type script it used to pass "$node" however the only place this was assigned was in the remove+phy case (in which case it contains the file:// derived /dev/loopN device), and in that case the script exits without falling through to the block-$type case. Since libxl never creates a type other than phy this never happens in practice anyway and we now call the correct block-$type script directly. But fix it up anyway since it is confusing. - The block-nbd and block-enbd scripts which we supply appear to be broken WRT the hotplug calling convention, in that they seem to expect a command line parameter (perhaps the $node described above) rather than reading the appropriate node from xenstore. I rather suspect this was broken by 7774:e2e7f47e6f79 in November 2005. I think it is safe to say no one is using these scripts! I haven't fixed this here. It would be good to track down some working scripts and either incorproate them or defer to them in their existing home (e.g. if they live somewhere useful like the nbd tools package). - Added a few block script related entries to check-xl-disk-parse from http://backdrift.org/xen-block-iscsi-script-with-multipath-support and http://lists.linbit.com/pipermail/drbd-user/2008-September/010221.html / http://www.drbd.org/users-guide-emb/s-xen-configure-domu.html (and snuck in another interesting empty CDROM case) This highlighted two bugs in the libxlu disk parser handling of the deprecated "<script>:" prefix: - It was failing to prefix with "block-" to construct the actual script name - The regex for matching iscsi or drdb or e?nbd was incorrect - Use libxl__abs_path for the nic script too. Just because the existing code nearly tricked me into repeating the mistake I have tested with a custom block script which uses "lvchange -a" to dynamically add remove the referenced device (simulates iSCSI login/logout without requiring me to faff around setting up an iSCSI target). I also tested on a blktap2 system. I haven't directly tested anything more complex like iscsi: or nbd: other than what check-xl-disk-parse exercises. [ Recommit of correct version of 25727:a8d708fcb347, which was mangled during commit. Sorry. -iwj ] Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* Merge backout of 25727:a8d708fcb347Ian Jackson2012-08-061-1/+1
|\
| * Backed out changeset a8d708fcb347Ian Jackson2012-08-061-1/+1
| | | | | | | | | | | | | | 25727:a8d708fcb347 was mangled during commit. Back it out so that we can commit it properly. Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* | tools/hotplug/Linux/init.d/: load other xen kernel modules on xencommons startFabio Fantoni2012-08-031-0/+3
|/ | | | | Signed-off-by: Fabio Fantoni <fabio.fantoni@heliman.it> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxl: support custom block hotplug scriptsIan Campbell2012-08-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are provided using the "script=" syntax described in docs/misc/xl-disk-configuration.txt. The existing hotplug scripts currently conflate two different concepts, namely that of making a datapath available in the backend domain (logging into iSCSI LUNs and the like) and that of actually connecting that datapath to a Xen backend path (e.g. writing "physical-device" node in xenstore to bring up blkback). For this reason the script support implemented here is only supported in conjunction with backendtype=phy. Eventually we hope to rework the hotplug scripts to separate the to concepts, but that is not 4.2 material. In addition there are some other subtleties: - Previously in the blktap case we would add "script = .../blktap" to the backend flex array, but then jumped to the PHY case which added "script = .../block" too. The block one takes precendence since it comes second. This was, accidentally, correct. The blktap script is for blktap1 devices and not blktap2 devices. libxl completely manages the blktap2 side of things without resorting to hotplug scripts and creates a blkback device directly. Therefore the "block" script is always the correct one to call. Custom script are not supported in this context. - libxl should not write the "physical-device" node. This is the responsibility of the block script. Writing the "physical-device" node in libxl basically completely short-cuts the standard block hotplug script which uses "physical-device" to know if it has run already or not. In the case of more complex scripts libxl cannot know the right value to write here anyway, in particular the device may not exist until after the script is called. This change has the side effect of re-enabling the checks for device sharing aspect of the default block script, which I have tested and which now cause libxl to properly abort now that libxl properly checks for hotplug script errors. There is no sharing check for blktap2 since even if you reuse the same vhd the resulting tap device is different. I would have preferred to simply write the "physical-device" node for the blktap2 case but the hotplug script infrastructure is not currently setup to handle LIBXL__DEVICE_KIND_VBD devices without a hotplug script (backendtype phy and tap both end up as KIND_VBD). Changing this was more surgery than I was happy doing for 4.2 and therefore I have simply hardcoded to the block script for the LIBXL_DISK_BACKEND_TAP case. - libxl__device_disk_set_backend running against a phy device with a script cannot stat the device to check its properties since it may not exist until the script is run. Therefore I have special cased this in disk_try_backend to simply assume that backend == phy is always ok if a script was configured. Similarly the other backend types are always rejected if a script was configured. Note that the reason for implementing the default script behaviour in device_disk_add instead of libxl__device_disk_setdefault is because we need to be able to tell when the script was user-supplied rather than defaulted by libxl in order to correctly implement the above. The setdefault function must be idempotent so we cannot simply update disk->script. I suspect that for 4.3 a script member should be added to libxl__device, this would also help in the case above of handling devices with no script in a consistent manner. This is not 4.2 material. - When the block script falls through and shells out to a block-$type script it used to pass "$node" however the only place this was assigned was in the remove+phy case (in which case it contains the file:// derived /dev/loopN device), and in that case the script exits without falling through to the block-$type case. Since libxl never creates a type other than phy this never happens in practice anyway and we now call the correct block-$type script directly. But fix it up anyway since it is confusing. - The block-nbd and block-enbd scripts which we supply appear to be broken WRT the hotplug calling convention, in that they seem to expect a command line parameter (perhaps the $node described above) rather than reading the appropriate node from xenstore. I rather suspect this was broken by 7774:e2e7f47e6f79 in November 2005. I think it is safe to say no one is using these scripts! I haven't fixed this here. It would be good to track down some working scripts and either incorproate them or defer to them in their existing home (e.g. if they live somewhere useful like the nbd tools package). - Added a few block script related entries to check-xl-disk-parse from http://backdrift.org/xen-block-iscsi-script-with-multipath-support and http://lists.linbit.com/pipermail/drbd-user/2008-September/010221.html / http://www.drbd.org/users-guide-emb/s-xen-configure-domu.html (and snuck in another interesting empty CDROM case) This highlighted two bugs in the libxlu disk parser handling of the deprecated "<script>:" prefix: - It was failing to prefix with "block-" to construct the actual script name - The regex for matching iscsi or drdb or e?nbd was incorrect - Use libxl__abs_path for the nic script too. Just because the existing code nearly tricked me into repeating the mistake I have tested with a custom block script which uses "lvchange -a" to dynamically add remove the referenced device (simulates iSCSI login/logout without requiring me to faff around setting up an iSCSI target). I also tested on a blktap2 system. I haven't directly tested anything more complex like iscsi: or nbd: other than what check-xl-disk-parse exercises. [ reran flex/bison -iwj ] Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* init/NetBSD: move xenbackendd to xend init scriptRoger Pau Monne2012-08-012-29/+55
| | | | | | | | | | | | | | xenbackendd is not needed by the xl toolstack, so move it's launch to the xend script. We have to iterate until we are sure there are no xend processes left, since doing a single pkill usually leaves xend processes running. Signed-off-by: Roger Pau Monne <roger.pau@citrix.com> Acked-by: Christoph Egger <Christoph.Egger@amd.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Tested-by: Christoph Egger <Christoph.Egger@amd.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: call hotplug scripts for nic devices from libxlRoger Pau Monne2012-07-261-3/+3
| | | | | | | | | | | | | | | Since most of the needed work is already done in previous patches, this patch only contains the necessary code to call hotplug scripts for nic devices, that should be called when the device is added or removed from a guest. Added another parameter to libxl__get_hotplug_script_info, that is used to know the number of times hotplug scripts have been called for that device. This is currently used by IOEMU nics on Linux. Signed-off-by: Roger Pau Monne <roger.pau@citrix.com> Acked-by: Ian Jackson<ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl: call hotplug scripts for disk devices from libxlRoger Pau Monne2012-07-262-3/+9
| | | | | | | | | | | | | | | | Since most of the needed work is already done in previous patches, this patch only contains the necessary code to call hotplug scripts for disk devices, that should be called when the device is added or removed from a guest. We will chain the launch of the disk hotplug scripts after the device_backend_callback callback, or directly from libxl__initiate_device_{add,remove} if the device is already in the desired state. Signed-off-by: Roger Pau Monne <roger.pau@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* hotplug: network-bridge: fix for interfaces with no gatewayIan Campbell2012-07-251-1/+3
| | | | | | | | | | | | | | | | This comes from an old Debian bug report http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=588477 which refers to http://lists.xen.org/archives/html/xen-users/2010-06/msg00420.html. Although we no longer have a trap in _claim_lock as described (this was removed in 25590:bb250383a4f5 "hotplug/Linux: use flock based locking") and the use of network-* scripts is discouraged (in favour of using distro provided mechanisms) the general principal that relying on the semantics of /bin/sh's && is unwise seems sound. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* hotplug: fix ip_of for systems using a peer-to-peer linkIan Campbell2012-07-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This is from an old Debian bug at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=437127 I'm slightly inferring what the configuration which trigger this issue is, the bug report says: This code however fails if no slash is present in the address, which is the case in my configuration: $ ip addr show dev eth0 2: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:16:17:90:b4:35 brd ff:ff:ff:ff:ff:ff inet 88.198.12.XXX peer 88.198.12.XXX/32 brd 88.255.255.255 scope global eth0 I hope either Marc or Stefan can correct me if I have surmised wrongly what this configuration represents. This function is used in the vif-route configuration. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* hotplug: vif: fail if a duplicate vifname is used.Ian Campbell2012-07-231-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is based on a patch from Hans van Kranenburg in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=658305. Quoting that bug report: When configurating a duplicate custom vifname for interfaces in the Xen dom0 that are added to a bridge (which is obviously a configuration error), the hotplug scripts fail silently to rename the new vifX.0 to the custom vifname, if it's already existing. The result of this, is that the domU will start normally, but no network traffic between domU and the dom0 bridge is possible, because the vifX.0 never gets added to the bridge. Worse... when doing xm shutdown on the newly created domU, while investigating the issue, the interface of another running domU gets shut down, and remains hanging around in a DOWN state, because it cannot be removed (the other unrelated domU is still running, but succesfully made unavailable on the network!). When starting the new domU again, the interface of the other domU will be added to the bridge again, and while looking at the output of brctl show, tcpdump and ping, which make no sense, because everything will seem to be right, nagios will notify you of another host being down. :| Note that libxl doesn't actually check the hotplug status yet, this changes with Rogers hotplug script changes. xend correctly picks the failure up. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* hotplug/Linux: do not leak lockfilesIan Jackson2012-07-051-3/+83
| | | | | | | | | | | | | 25590:bb250383a4f5 introduced a new locking scheme. Unfortunately it leaves behind files in /var/run/xen-hotplug. These are spotted as regressions by the autotester. Fix this. This involves changing the locking protocol to allow lockfiles to be deleted (as removing lockfiles is unsafe with a naive flock-based algorithm). Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* hotplug/Linux: use flock based lockingZhigang Wang2012-07-041-77/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | In the normal case of a single domain booting with one disk, the disk hotplug script will fire once. In this case taking out the lock will never cause a sleep because there's no other concurrent invocations. If a domain has 4 disks configured, then the hotplug script will fire 4 times, all 4 invocations at pretty much the same time. If there is even a little load on the system, the locking function in the shell script will sleep for a few seconds - as many as 5 seconds, or potentially even time out & fail completely. If say 4 or even more domains each with 4 disks start up at once, that's 16 invocations of the hotplug script running at once. There will be a lot of sleep's done & because of the very coarse 1 second granularity the delay can add up significantly. The change to using flock() removes the arbitrary 1 second sleep, so the very instant once hotplug script finishes, another can start & there is no repeated attempts & failures to lock which would add more delay. In addition the current locking implementation would allow two processes get the lock simultaneously if one decided the other had timed out. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* xl/libxl: implement QDISK libxl_device_disk_local_attachStefano Stabellini2012-05-292-0/+6
| | | | | | | | | | | | | | - Spawn a QEMU instance at boot time to handle disk local attach requests. - Implement libxl__device_disk_local_attach for QDISKs in terms of a regular disk attach with the frontend and backend running in the same domain. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* libxl/xend: name tap devices vifX.Y-emuIan Campbell2012-04-252-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This prevents the udev scripts from operating on other tap devices (e.g. openvpn etc) Correct the documentation for the "vifname" option which suggested it applied to HVM tap devices only, which is not the case. Reported by Michael Young. Also fix the use of vifname with emulated devices. This is slightly complex. The current hotplug scripts rely on being able to parse the "tapX.Y" (now "vifX.Y-emu") name in order to locate the xenstore backend dir relating to the corresponding vif. This is because we cannot inject our own environment vars into the tap hotplug events. However this means that if the tap is initially named with a user specified name (which will not match the expected scheme) we fail to do anything useful with the device. So now we create the initial tap device with the standard "vifX.Y-emu" name and the hotplug script will handle the rename to the desired name. This is also how PV vif devices work -- they are always created by netback with the name vifX.Y and renamed in the script. Lastly also move libxl__device_* to a better place in the header, otherwise the comment about evgen stuff isn't next to the associated functions (noticed jsut because I was going to add nic_devname near to the setdefault functions) Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* tools/hotplug: remove 4 from default runlevel in init scriptsOlaf Hering2012-05-043-3/+3
| | | | | | | | | | | | | | | | | | | Remove 4 from default runlevel in xen-watchdog, xend and xendomains. Similar to what changeset 24847:0900b1c905f1 does in xencommons, remove runlevel 4 from the other runlevel scripts. LSB defines runlevel 4 as reserved for local use, the local sysadmin is responsible for symlink creation in rc4.d. Runlevel 4 was specified in Default-Start since a very long time. Then it was copied also to the new xen-watchdog in 21861:fb3649141e19. Until now this was not an issue since only xencommons is automatically enabled during package install, and a custom xend and xendomains script is included in the SuSE packages. Since some time a rpmlint check complains about the wrong Default-Start entry in xen-watchdog. Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Ian Jackson <ian.jackson.citrix.com>
* linux-xencommons: Load xen-acpi-processorKonrad Rzeszutek Wilk2012-03-231-0/+1
| | | | | | | | | | | | | | | | | | | | Upstream the "xen/acpi-processor: C and P-state driver that uploads said data to hypervisor." takes care of uploading power information information that normally a cpu frequency scaling driver would using in the initial domain. We want the hypervisor to take that data and make good usage of it. Fortunatly for us we do not have to worry about the native cpu frequency scaling drivers being loaded first, as the upstream commit: "xen/cpufreq: Disable the cpu frequency scaling drivers from loading." takes care of that. Meaning we can load the xen-acpi-processor at any time. By default that driver is built as a module - and since we are the only user of it - we should load it. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Committed-by: Ian Jackson <ian.jackson.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools/hotplug/Linux/init.d/: create /var/run/xen if not existsFabio Fantoni2012-03-131-0/+1
| | | | | | Signed-off-by: Fabio Fantoni <fabio.fantoni@heliman.it> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools: xencommons: revert accidental hunk in 24905:2b5cf6bde62dIan Jackson2012-02-291-1/+0
| | | | | | | | 24905:2b5cf6bde62d accidentally contained a change to tools/hotplug/Linux/init.d/xencommons. That change is probably OK but should not be in 24905 so remove it. Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>