Repeatedly add log_filters,log_outputs to libvirtd.conf when restart

Change-Id: I14f07f3164f9201305ed1e94e9277a5a5792e850
Closes-bug: 1273058
diff --git a/lib/nova b/lib/nova
index b85f094..dbaa3f5 100644
--- a/lib/nova
+++ b/lib/nova
@@ -652,8 +652,12 @@
         local log_filters="1:libvirt 1:qemu 1:conf 1:security 3:event 3:json 3:file 1:util"
         local log_outputs="1:file:/var/log/libvirt/libvirtd.log"
         # Enable server side traces for libvirtd
-        echo "log_filters=\"$log_filters\"" | sudo tee -a /etc/libvirt/libvirtd.conf
-        echo "log_outputs=\"$log_outputs\"" | sudo tee -a /etc/libvirt/libvirtd.conf
+        if ! grep -q "log_filters=\"$log_filters\"" /etc/libvirt/libvirtd.conf; then
+            echo "log_filters=\"$log_filters\"" | sudo tee -a /etc/libvirt/libvirtd.conf
+        fi
+        if ! grep -q "log_outputs=\"$log_outputs\"" /etc/libvirt/libvirtd.conf; then
+            echo "log_outputs=\"$log_outputs\"" | sudo tee -a /etc/libvirt/libvirtd.conf
+        fi
 
         # The group **$LIBVIRT_GROUP** is added to the current user in this script.
         # Use 'sg' to execute nova-compute as a member of the **$LIBVIRT_GROUP** group.