From nobody Fri May 3 08:52:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1522580938730873.3786395855211; Sun, 1 Apr 2018 04:08:58 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3CA975D5E6; Sun, 1 Apr 2018 11:08:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 804F85D6A8; Sun, 1 Apr 2018 11:08:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1862D1800BB5; Sun, 1 Apr 2018 11:08:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w31B8p79019067 for ; Sun, 1 Apr 2018 07:08:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 79006111DCFA; Sun, 1 Apr 2018 11:08:51 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-23.brq.redhat.com [10.40.204.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 09460111DCF5 for ; Sun, 1 Apr 2018 11:08:48 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Sun, 1 Apr 2018 13:08:45 +0200 Message-Id: <797b852f8e3a8ba3a6b2f4026bc065a555d5b544.1522580925.git.mprivozn@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: Randomly deny starting domains X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sun, 01 Apr 2018 11:08:57 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 --- 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" =20 #define VIR_FROM_THIS VIR_FROM_QEMU =20 @@ -7256,7 +7257,7 @@ qemuDomainObjStart(virConnectPtr conn, qemuDomainAsyncJob asyncJob) { int ret =3D -1; - char *managed_save; + char *managed_save =3D NULL; bool start_paused =3D (flags & VIR_DOMAIN_START_PAUSED) !=3D 0; bool autodestroy =3D (flags & VIR_DOMAIN_START_AUTODESTROY) !=3D 0; bool bypass_cache =3D (flags & VIR_DOMAIN_START_BYPASS_CACHE) !=3D 0; @@ -7267,6 +7268,13 @@ qemuDomainObjStart(virConnectPtr conn, start_flags |=3D start_paused ? VIR_QEMU_PROCESS_START_PAUSED : 0; start_flags |=3D autodestroy ? VIR_QEMU_PROCESS_START_AUTODESTROY : 0; =20 + 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. --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list