hotplug: Fix xendomains lock path for RHEL-based systems
PATCH 2/2 tools/xendomains: Create lockfile on start unconditionally
In reply to George DunlapAt 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.
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Olaf Hering <[email protected]>
--- tools/hotplug/Linux/xendomains.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/hotplug/Linux/xendomains.in +3 -3
@@ -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
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH 1/2 hotplug: Fix xendomains lock path for RHEL-based systems
Commit c996572 changed the LOCKFILE path from a check between two hardcoded paths (/var/lock/subsys/ or /var/lock) to using the XEN_LOCK_DIR variable designated at configure time. Since XEN_LOCK_DIR doesn't (and shouldn't) have the 'subsys' postfix, this effectively moves all the lock files by default to /var/lock instead.
Unfortunately, this breaks xendomains on RedHat-based SYSV init systems. 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.
Changing XEN_LOCK_DIR to /var/lock/subsys is not suitable, as only system services like xendomains should create lockfiles there; other locks (such as the console locks) should be created in /var/lock instead.
Instead, re-instate the check for the subsys/ subdirectory of the lock directory in the xendomains script.
---
Release justification: This is a regression in functionality (although it's been there for the entire 4.6 cycle now).
--- tools/hotplug/Linux/xendomains.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/hotplug/Linux/xendomains.in +7 -1
@@ -49,7 +49,13 @@ if [ ! -e /dev/xen/privcmd ] && [ ! -e /proc/xen/privcmd ]; then exit 0 fi -LOCKFILE=${XEN_LOCK_DIR}/xendomains +# RHEL-based systems only shutdown a service if they find a lockfile +# in /var/lock/subsys +if [[ -d ${XEN_LOCK_DIR}/subsys ]] ; then + LOCKFILE=${XEN_LOCK_DIR}/subsys/xendomains +else + LOCKFILE=${XEN_LOCK_DIR}/xendomains +fi XENDOM_CONFIG=@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xendomains
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH for-4.7 2/2] tools/xendomains: Create lockfile on start unconditionally
In reply to George DunlapQuoted 27 lines · George Dunlap
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 ofXENDOMAINS_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_RESTOREset 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_RESTOREwas true regardless of whether there were any domains to be restored. But this would mean that if you started with the xendomains script active butXENDOMAINS_RESTOREset 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.
Quoted 5 lines
Signed-off-by George Dunlap <[email protected]>---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Olaf Hering <[email protected]>
Forgot the release justification.
This is a bug in xendomains under RHEL sysv init systems -- albeit one that's been there from the beginning. Creating the lockfile unconditionally shouldn't cause any problems as far as I can tell.
-George
Quoted 26 lines
--- tools/hotplug/Linux/xendomains.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)tools/hotplug/Linux/xendomains.in +3
-2@@ -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
tools/hotplug/Linux/xendomains.in start() · line 292
Quoted 7 lines
tools/hotplug/Linux/xendomains.in +0
-1@@ -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
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 17 lines · George Dunlap
Commit c996572 changed the LOCKFILE path from a check between two hardcoded paths (
/var/lock/subsys/or/var/lock) to using theXEN_LOCK_DIRvariable designated at configure time. SinceXEN_LOCK_DIRdoesn't (and shouldn't) have the 'subsys' postfix, this effectively moves all the lock files by default to/var/lockinstead.Unfortunately, this breaks xendomains on RedHat-based SYSV init systems. 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.Changing
XEN_LOCK_DIRto/var/lock/subsysis not suitable, as only system services like xendomains should create lockfiles there; other locks (such as the console locks) should be created in/var/lockinstead.
Quoted 4 lines
Instead, re-instate the check for the subsys/ subdirectory of the lock directory in the xendomains script.
Signed-off-by George Dunlap <[email protected]>
Quoted 35 lines
---
Release justification: This is a regression in functionality (although it's been there for the entire 4.6 cycle now).
--- tools/hotplug/Linux/xendomains.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)tools/hotplug/Linux/xendomains.in +7
-1@@ -49,7 +49,13 @@ if [ ! -e /dev/xen/privcmd ] && [ ! -e /proc/xen/privcmd ]; then exit 0 fi -LOCKFILE=${XEN_LOCK_DIR}/xendomains +# RHEL-based systems only shutdown a service if they find a lockfile +# in /var/lock/subsys +if [[ -d ${XEN_LOCK_DIR}/subsys ]] ; then + LOCKFILE=${XEN_LOCK_DIR}/subsys/xendomains +else + LOCKFILE=${XEN_LOCK_DIR}/xendomains +fi XENDOM_CONFIG=@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xendomainsSignature · 1 line
2.1.4
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH for-4.7 2/2] tools/xendomains: Create lockfile on start unconditionally
In reply to George DunlapQuoted 34 lines · George Dunlap
Quoted 27 lines · George Dunlap
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 ofXENDOMAINS_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_RESTOREset 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_RESTOREwas true regardless of whether there were any domains to be restored. But this would mean that if you started with the xendomains script active butXENDOMAINS_RESTOREset 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.Quoted 5 lines
Signed-off-by George Dunlap <[email protected]>---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Olaf Hering <[email protected]>
Quoted 6 lines
Forgot the release justification.
This is a bug in xendomains under RHEL sysv init systems -- albeit one that's been there from the beginning. Creating the lockfile unconditionally shouldn't cause any problems as far as I can tell.
I agree.
I've queued this series.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH for-4.7 2/2] tools/xendomains: Create lockfile on start unconditionally
In reply to George DunlapQuoted 27 lines · George Dunlap
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 ofXENDOMAINS_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_RESTOREset 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_RESTOREwas true regardless of whether there were any domains to be restored. But this would mean that if you started with the xendomains script active butXENDOMAINS_RESTOREset 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.
Quoted 1 line
Signed-off-by George Dunlap <[email protected]>
Quoted 39 lines
---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Olaf Hering <[email protected]>--- tools/hotplug/Linux/xendomains.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)tools/hotplug/Linux/xendomains.in +3
-3@@ -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 elsewhereSignature · 1 line
2.1.4
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 12 lines · George Dunlap
Commit c996572 changed the LOCKFILE path from a check between two hardcoded paths (
/var/lock/subsys/or/var/lock) to using theXEN_LOCK_DIRvariable designated at configure time. SinceXEN_LOCK_DIRdoesn't (and shouldn't) have the 'subsys' postfix, this effectively moves all the lock files by default to/var/lockinstead.Unfortunately, this breaks xendomains on RedHat-based SYSV init systems. 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.
Quoted 7 lines
Changing
XEN_LOCK_DIRto/var/lock/subsysis not suitable, as only system services like xendomains should create lockfiles there; other locks (such as the console locks) should be created in/var/lockinstead.Instead, re-instate the check for the subsys/ subdirectory of the lock directory in the xendomains script.
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH for-4.7 2/2] tools/xendomains: Create lockfile on start unconditionally
In reply to George DunlapQuoted 10 lines · George Dunlap
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 ofXENDOMAINS_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.
Quoted 8 lines
This means that at the moment, on RedHat-based SYSV systems (such as CentOS 6), if you enable xendomains, and have
XENDOMAINS_RESTOREset 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.
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 17 lines · George Dunlap
Commit c996572 changed the LOCKFILE path from a check between two hardcoded paths (
/var/lock/subsys/or/var/lock) to using theXEN_LOCK_DIRvariable designated at configure time. SinceXEN_LOCK_DIRdoesn't (and shouldn't) have the 'subsys' postfix, this effectively moves all the lock files by default to/var/lockinstead.Unfortunately, this breaks xendomains on RedHat-based SYSV init systems. 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.Changing
XEN_LOCK_DIRto/var/lock/subsysis not suitable, as only system services like xendomains should create lockfiles there; other locks (such as the console locks) should be created in/var/lockinstead.
Quoted 4 lines
Instead, re-instate the check for the subsys/ subdirectory of the lock directory in the xendomains script.
Signed-off-by George Dunlap <[email protected]>
This should be backported to 4.6.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH for-4.7 2/2] tools/xendomains: Create lockfile on start unconditionally
In reply to George DunlapQuoted 27 lines · George Dunlap
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 ofXENDOMAINS_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_RESTOREset 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_RESTOREwas true regardless of whether there were any domains to be restored. But this would mean that if you started with the xendomains script active butXENDOMAINS_RESTOREset 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.
Quoted 1 line
Signed-off-by George Dunlap <[email protected]>
And this should probably be backported as far back as we're still doing bugfixes (which I guess would be 4.6 and 4.5?)
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel