From 14b3f9695d0b1dc605491c8231fc6cd94dca45a6 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 22 Apr 2010 11:40:58 +0200
Subject: [PATCH] Fix broken commit 9e302a8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Commit 9e302a8 split the StopInstance function in two without properly
duplicating the local variables.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
---
 lib/hypervisor/hv_chroot.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/hypervisor/hv_chroot.py b/lib/hypervisor/hv_chroot.py
index c495c9e4d..178291d4a 100644
--- a/lib/hypervisor/hv_chroot.py
+++ b/lib/hypervisor/hv_chroot.py
@@ -216,6 +216,11 @@ class ChrootManager(hv_base.BaseHypervisor):
     """Cleanup after a stopped instance
 
     """
+    root_dir = self._InstanceDir(instance_name)
+
+    if not os.path.exists(root_dir):
+      return
+
     if self._IsDirLive(root_dir):
       raise HypervisorError("Processes are still using the chroot")
 
@@ -223,7 +228,7 @@ class ChrootManager(hv_base.BaseHypervisor):
       utils.RunCmd(["umount", mpath])
 
     result = utils.RunCmd(["umount", root_dir])
-    if result.failed and force:
+    if result.failed:
       msg = ("Processes still alive in the chroot: %s" %
              utils.RunCmd("fuser -vm %s" % root_dir).output)
       logging.error(msg)
-- 
GitLab