From ad9a93e675b1e9bb3a08857247db03c9fb6f6863 Mon Sep 17 00:00:00 2001
From: Federico Ressi <fressi@redhat.com>
Date: Fri, 19 Nov 2021 13:26:51 +0100
Subject: [PATCH] Fix configure_libguestfs_tools

Change-Id: Ib67347441942ce910c87581afe5e8aa81a8b0630
---
 devstack/plugin.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/devstack/plugin.sh b/devstack/plugin.sh
index 65ae602..0b73b2f 100644
--- a/devstack/plugin.sh
+++ b/devstack/plugin.sh
@@ -11,9 +11,13 @@ function install_tobiko_deps {
 
 
 function configure_libguestfs_tools {
+    local target_path
     if is_ubuntu; then
-        sudo dpkg-statoverride --update --add root root 0644 \
-            /boot/vmlinuz-`uname -r`
+        target_path=/boot/vmlinuz-`uname -r`
+        if ! dpkg-statoverride --list "${target_path}"; then
+            sudo dpkg-statoverride --update --add root root 0644 \
+                "${target_path}"
+        fi
     fi
 }