[Pkg-xen-changes] r1012 - trunk/xen/debian

Bastian Blank waldi at alioth.debian.org
Sun May 6 17:56:50 UTC 2012


Author: waldi
Date: Sun May  6 17:56:50 2012
New Revision: 1012

Log:
* debian/changelog: Update.
* debian/xen-utils-common.xendomains.init
  - Check all variables.
  - Check if directory exists.

Modified:
   trunk/xen/debian/changelog
   trunk/xen/debian/xen-utils-common.xendomains.init

Modified: trunk/xen/debian/changelog
==============================================================================
--- trunk/xen/debian/changelog	Sun May  6 17:45:09 2012	(r1011)
+++ trunk/xen/debian/changelog	Sun May  6 17:56:50 2012	(r1012)
@@ -4,7 +4,7 @@
   * Remove information about loop devices, it is incorrect. (closes: #503044)
   * Create directory for domain images only root readable. (closes: #596048)
   * Update xendomains init script.
-    - Add missing sanity check for save variable. (closes: #671750)
+    - Add missing sanity checks for variables. (closes: #671750)
     - Remove not longer supported config options.
 
  -- Bastian Blank <waldi at debian.org>  Sat, 05 May 2012 21:24:18 +0200

Modified: trunk/xen/debian/xen-utils-common.xendomains.init
==============================================================================
--- trunk/xen/debian/xen-utils-common.xendomains.init	Sun May  6 17:45:09 2012	(r1011)
+++ trunk/xen/debian/xen-utils-common.xendomains.init	Sun May  6 17:56:50 2012	(r1012)
@@ -84,6 +84,10 @@
 
 do_start_restore()
 {
+  [ -n "$XENDOMAINS_SAVE" ] || return
+  [ -d "$XENDOMAINS_SAVE" ] || return
+  [ -n "$XENDOMAINS_RESTORE" ] || return
+
   for file in $XENDOMAINS_SAVE/*; do
     if [ -f $file ] ; then
       name="${file##*/}"
@@ -108,6 +112,9 @@
 
 do_start_auto()
 {
+  [ -n "$XENDOMAINS_AUTO" ] || return
+  [ -d "$XENDOMAINS_AUTO" ] || return
+
   for file in $XENDOMAINS_AUTO/*; do
     name="$(check_config_name $file)"
 
@@ -138,12 +145,14 @@
 {
   declare -A domains
 
-  if test -n "$XENDOMAINS_SAVE"; then do_start_restore; fi
+  do_start_restore
   do_start_auto
 }
 
 do_stop_migrate()
 {
+  [ -n "$XENDOMAINS_MIGRATE" ] || return
+
   while read id name rest; do
     log_action_begin_msg "Migrating Xen domain $name ($id)"
     coproc xen migrate $id $XENDOMAINS_MIGRATE 2>&1 1>/dev/null
@@ -154,9 +163,11 @@
 
 do_stop_save()
 {
+  [ -n "$XENDOMAINS_SAVE" ] || return
+  [ -d "$XENDOMAINS_SAVE" ] || mkdir -m 0700 -p "$XENDOMAINS_SAVE"
+
   while read id name rest; do
     log_action_begin_msg "Saving Xen domain $name ($id)"
-    mkdir -m 0700 -p "$XENDOMAINS_SAVE"
     coproc xen save $id $XENDOMAINS_SAVE/$name 2>&1 1>/dev/null
     timeout_coproc "$XENDOMAINS_STOP_MAXWAIT"
     log_action_end_msg $?
@@ -175,8 +186,8 @@
 
 do_stop()
 {
-  if test -n "$XENDOMAINS_MIGRATE"; then do_stop_migrate; fi
-  if test -n "$XENDOMAINS_SAVE"; then do_stop_save; fi
+  do_stop_migrate
+  do_stop_save
   do_stop_shutdown
 }
 



More information about the Pkg-xen-changes mailing list