Re: [PATCH] qemu: catch failure of drive_add

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 17, 2017 at 05:15 PM +0100, "Daniel P. Berrange" <berrange@xxxxxxxxxx> wrote:
> Previously when QEMU failed "drive_add" due to an error opening
> a file it would report
>
>   "could not open disk image"
>
> These days though, QEMU reports
>
>   "Could not open '/tmp/virtd-test_e3hnhh5/disk1.qcow2': Permission denied"
>
> which we were not detecting as an error condition.
>
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  src/qemu/qemu_monitor_text.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
> index bc83218..76d7497 100644
> --- a/src/qemu/qemu_monitor_text.c
> +++ b/src/qemu/qemu_monitor_text.c
> @@ -1959,6 +1959,16 @@ int qemuMonitorTextAddDrive(qemuMonitorPtr mon,
>          goto cleanup;
>      }
>
> +    if (strstr(reply, "Could not open")) {
> +        size_t len = strlen(reply);
> +        if (reply[len - 1] == '\n') {
> +            reply[len - 1] = '\0';
> +        }
> +        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
> +                       reply);
> +        goto cleanup;
> +    }
> +
>      ret = 0;
>
>   cleanup:
> --
> 2.9.3
>
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list
>

Tested-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxxxxxxx>

--
Beste Grüße / Kind regards
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux