import: only use swap if swap_uuid is defined
authorGuido Trotter <ultrotter@google.com>
Wed, 18 Feb 2009 17:05:24 +0000 (17:05 +0000)
committerGuido Trotter <ultrotter@google.com>
Wed, 18 Feb 2009 17:05:24 +0000 (17:05 +0000)
As for create sometimes we'll fail in getting a uuid for the swap
disk. In that case we have to ignore that, while in import we're failing
to do so.

Reviewed-by: iustinp

import

diff --git a/import b/import
index d89fb17..cd42430 100755 (executable)
--- a/import
+++ b/import
@@ -65,7 +65,7 @@ rm -f $TMPDIR/etc/udev/rules.d/z*_persistent-net.rules
 # Fix /etc/fstab with the new volumes' UUIDs
 if [ -e $TMPDIR/etc/fstab ]; then
   ROOT_LINE="UUID=$root_uuid  /     ext3  defaults  0  1"
-  if [ -n "$swapdev" ]; then
+  if [ -n "$swapdev" -a -n "$swap_uuid" ]; then
     SWAP_LINE="UUID=$swap_uuid  swap  swap  defaults  0  0"
     cat $TMPDIR/etc/fstab | \
       sed -re "s#^(/dev/sda|UUID=[a-f0-9-]+)\s+/\s+.*\$#$ROOT_LINE#" \