summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Noriega <rnoriega@redhat.com>2018-04-12 18:53:09 +0200
committerTim Rozet <trozet@redhat.com>2018-04-12 17:23:45 -0400
commitbd2595f0b0eea504bfcfadc8a77627957669e9fa (patch)
treeb127ae59abbd969e0854517f17b392d360fefad1
parent814c37ee17c9e797b5a4f1944bd52facf22fb513 (diff)
Avoiding exception if guest refuses to detach a volume
https://review.openstack.org/#/c/551950/ JIRA: APEX-589 Change-Id: I490f1030a32a44316e62c93cf1ed8642aef30527 Signed-off-by: Ricardo Noriega <rnoriega@redhat.com>
-rwxr-xr-xbuild/overcloud-full.sh2
-rw-r--r--build/patches/fix_volume_exception.patch37
2 files changed, 39 insertions, 0 deletions
diff --git a/build/overcloud-full.sh b/build/overcloud-full.sh
index a4006c4a..3739fc3f 100755
--- a/build/overcloud-full.sh
+++ b/build/overcloud-full.sh
@@ -147,6 +147,8 @@ LIBGUESTFS_BACKEND=direct $VIRT_CUSTOMIZE \
--install docker,kubelet,kubeadm,kubectl,kubernetes-cni \
--upload ${BUILD_ROOT}/patches/puppet-ceph.patch:/etc/puppet/modules/ceph/ \
--run-command "cd /etc/puppet/modules/ceph && patch -p1 < puppet-ceph.patch" \
+ --upload ${BUILD_ROOT}/patches/fix_volume_exception.patch:/usr/lib/python2.7/site-packages/ \
+ --run-command "cd /usr/lib/python2.7/site-packages/ && patch -p1 < fix_volume_exception.patch" \
-a overcloud-full_build.qcow2
# upload and install barometer packages
diff --git a/build/patches/fix_volume_exception.patch b/build/patches/fix_volume_exception.patch
new file mode 100644
index 00000000..8fa5d4d4
--- /dev/null
+++ b/build/patches/fix_volume_exception.patch
@@ -0,0 +1,37 @@
+From 804215017f38300ac429e4401ce9c23f0c8ff3c6 Mon Sep 17 00:00:00 2001
+From: Dan Smith <dansmith@redhat.com>
+Date: Tue, 20 Feb 2018 14:41:35 -0800
+Subject: [PATCH] Avoid exploding if guest refuses to detach a volume
+
+When we run detach_volume(), the guest has to respond to the ACPI
+eject request in order for us to proceed. It may not do this at all
+if the volume is mounted or in-use, or may not by the time we time out
+if lots of dirty data needs flushing. Right now, we let the failure
+exception bubble up to our caller and we log a nasty stack trace, which
+doesn't really convey the reason (and that it's an expected and
+reasonable thing to happen).
+
+Thus, this patch catches that, logs the situation at warning level and
+avoids the trace.
+
+Change-Id: I3800b466a50b1e5f5d1e8c8a963d9a6258af67ee
+Closes-Bug: #1750680
+(cherry picked from commit b16c0f10539a6c6b547a70a41c75ef723fc618ce)
+(cherry picked from commit 81992142f657a3d71600182935f06efe5f8e8e86)
+---
+
+diff --git a/nova/virt/block_device.py b/nova/virt/block_device.py
+index 74c26ce..aa1a3ee 100644
+--- a/nova/virt/block_device.py
++++ b/nova/virt/block_device.py
+@@ -281,6 +281,10 @@
+ '%(mp)s : %(err)s',
+ {'volume_id': volume_id, 'mp': mp,
+ 'err': err}, instance=instance)
++ except exception.DeviceDetachFailed as err:
++ with excutils.save_and_reraise_exception():
++ LOG.warning('Guest refused to detach volume %(vol)s',
++ {'vol': volume_id}, instance=instance)
+ except Exception:
+ with excutils.save_and_reraise_exception():
+ LOG.exception('Failed to detach volume '