[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] tools/xendomains: Create lockfile on start unconditionally
commit 1c7fa3dc039487d18ad0c6fb6b773c831dca5e5d Author: George Dunlap <george.dunlap@xxxxxxxxxx> AuthorDate: Wed May 11 12:14:45 2016 +0100 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Wed May 11 15:40:00 2016 +0100 tools/xendomains: Create lockfile on start unconditionally At the moment, the xendomains init script will only create a lockfile if when started, it actually does something -- either tries to restore a previously saved domain as a result of XENDOMAINS_RESTORE, or tries to create a domain as a result of XENDOMAINS_AUTO. RedHat-based SYSV init systems try to only call "${SERVICE} shutdown" on systems which actually have an actively running component; and they use the existence of /var/lock/subsys/${SERVICE} to determine which systems are running. This means that at the moment, on RedHat-based SYSV systems (such as CentOS 6), if you enable xendomains, and have XENDOMAINS_RESTORE set to "true", but don't happen to start a VM, then your running VMs will not be suspended on shutdown. Since the lockfile doesn't really have any other effect than to prevent duplicate starting, just create it unconditionally every time we start the xendomains script. The other option would have been to touch the lockfile if XENDOMAINS_RESTORE was true regardless of whether there were any domains to be restored. But this would mean that if you started with the xendomains script active but XENDOMAINS_RESTORE set to "false", and then changed it to "true", then xendomains would still not run the next time you shut down. This seems to me to violate the principle of least surprise. Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> Acked-by: Olaf Hering <olaf@xxxxxxxxx> Release-acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/hotplug/Linux/xendomains.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/hotplug/Linux/xendomains.in b/tools/hotplug/Linux/xendomains.in index 727cd42..334d244 100644 --- a/tools/hotplug/Linux/xendomains.in +++ b/tools/hotplug/Linux/xendomains.in @@ -255,12 +255,13 @@ start() return; fi + mkdir -p $(dirname "$LOCKFILE") + touch $LOCKFILE + saved_domains=" " if [ "$XENDOMAINS_RESTORE" = "true" ] && contains_something "$XENDOMAINS_SAVE" then - mkdir -p $(dirname "$LOCKFILE") - touch $LOCKFILE echo -n "Restoring Xen domains:" saved_domains=`ls $XENDOMAINS_SAVE` for dom in $XENDOMAINS_SAVE/*; do @@ -286,7 +287,6 @@ start() if contains_something "$XENDOMAINS_AUTO" then - touch $LOCKFILE echo -n "Starting auto Xen domains:" # We expect config scripts for auto starting domains to be in # XENDOMAINS_AUTO - they could just be symlinks to files elsewhere -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |