From 7be85163727e17ca61eae20383ec2649e184c370 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Mon, 17 Jan 2011 15:50:03 +0000
Subject: [PATCH] KVM: don't fail removing non-existing nic path

This shouldn't normally happen, but if it does no need to fail.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/hypervisor/hv_kvm.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py
index 8ee23fcf0..3e9e0250b 100644
--- a/lib/hypervisor/hv_kvm.py
+++ b/lib/hypervisor/hv_kvm.py
@@ -381,7 +381,11 @@ class KVMHypervisor(hv_base.BaseHypervisor):
     utils.RemoveFile(uid_file)
     if uid is not None:
       uidpool.ReleaseUid(uid)
-    shutil.rmtree(cls._InstanceNICDir(instance_name))
+    try:
+      shutil.rmtree(cls._InstanceNICDir(instance_name))
+    except OSError, err:
+      if err.errno != errno.ENOENT:
+        raise
     try:
       chroot_dir = cls._InstanceChrootDir(instance_name)
       utils.RemoveDir(chroot_dir)
-- 
GitLab