From 9e302a8c441433736de977d2d9b59f1c2ba43b77 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 21 Apr 2010 15:49:49 +0200
Subject: [PATCH] hv_chroot: move unmount to CleanupInstance()

This allows cleanup to be done properly if the "instance" wasn't running
at all (based on the CleanupInstance framework, instead of the retry in
hypervisor).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 lib/hypervisor/hv_chroot.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/hypervisor/hv_chroot.py b/lib/hypervisor/hv_chroot.py
index 36b37a8eb..c495c9e4d 100644
--- a/lib/hypervisor/hv_chroot.py
+++ b/lib/hypervisor/hv_chroot.py
@@ -212,6 +212,13 @@ class ChrootManager(hv_base.BaseHypervisor):
         raise HypervisorError("Can't stop the processes using the chroot")
       return
 
+  def CleanupInstance(self, instance_name):
+    """Cleanup after a stopped instance
+
+    """
+    if self._IsDirLive(root_dir):
+      raise HypervisorError("Processes are still using the chroot")
+
     for mpath in self._GetMountSubdirs(root_dir):
       utils.RunCmd(["umount", mpath])
 
-- 
GitLab