Libvirt works just too well. Deny starting domains at random so
users value our incredibly low number of bugs more.

Signed-off-by: Michal Privoznik <mpriv...@redhat.com>
---
 src/qemu/qemu_driver.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7bcc4936de..4570c76db7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -107,6 +107,7 @@
 #include "virnuma.h"
 #include "dirname.h"
 #include "netdev_bandwidth_conf.h"
+#include "virrandom.h"
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
@@ -7256,7 +7257,7 @@ qemuDomainObjStart(virConnectPtr conn,
                    qemuDomainAsyncJob asyncJob)
 {
     int ret = -1;
-    char *managed_save;
+    char *managed_save = NULL;
     bool start_paused = (flags & VIR_DOMAIN_START_PAUSED) != 0;
     bool autodestroy = (flags & VIR_DOMAIN_START_AUTODESTROY) != 0;
     bool bypass_cache = (flags & VIR_DOMAIN_START_BYPASS_CACHE) != 0;
@@ -7267,6 +7268,13 @@ qemuDomainObjStart(virConnectPtr conn,
     start_flags |= start_paused ? VIR_QEMU_PROCESS_START_PAUSED : 0;
     start_flags |= autodestroy ? VIR_QEMU_PROCESS_START_AUTODESTROY : 0;
 
+    if (virRandomInt(2)) {
+        virReportError(VIR_ERR_OPERATION_DENIED,
+                       _("Starting domain %s denied. Today is not your day"),
+                       vm->def->name);
+        goto cleanup;
+    }
+
     /*
      * If there is a managed saved state restore it instead of starting
      * from scratch. The old state is removed once the restoring succeeded.
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to