qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 248337: vhost-scsi: Improve error reporting f


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 248337: vhost-scsi: Improve error reporting for invalid vh...
Date: Thu, 26 Feb 2015 01:30:09 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 248337e178fbcf1c20132d4f3d1033cb0dde7638
      
https://github.com/qemu/qemu/commit/248337e178fbcf1c20132d4f3d1033cb0dde7638
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M hw/scsi/vhost-scsi.c

  Log Message:
  -----------
  vhost-scsi: Improve error reporting for invalid vhostfd

We get two error messages: one from monitor_handle_fd_param2(), and
another one from vhost_scsi_realize().  The second one gets suppressed
in QMP context.

That's because monitor_handle_fd_param() calls qerror_report_err().
Calling qerror_report_err() is always inappropriate in realize
methods, because it doesn't return the Error object.  It either
reports the error to stderr or the human monitor, or it stores it in
the QMP monitor, where it makes the QMP command fail even when the
realize method ignores the error and succeeds.  Fortunately,
vhost_scsi_realize() doesn't do that.

Fix by switching to monitor_handle_fd_param2().

Signed-off-by: Markus Armbruster <address@hidden>
Acked-by: Paolo Bonzini <address@hidden>


  Commit: 2ee2f1e41517efa7b5dd604a68ceca9b1377de2c
      
https://github.com/qemu/qemu/commit/2ee2f1e41517efa7b5dd604a68ceca9b1377de2c
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M include/qapi/error.h
    M util/error.c

  Log Message:
  -----------
  error: New convenience function error_report_err()

I've typed error_report("%s", error_get_pretty(ERR)) too many times
already, and I've fixed too many instances of qerror_report_err(ERR)
to error_report("%s", error_get_pretty(ERR)) as well.  Capture the
pattern in a convenience function.

Since it's almost invariably followed by error_free(), stuff that into
the convenience function as well.

The next patch will put it to use.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 565f65d271984a32eed2c324ff6ef8be33f7f3d2
      
https://github.com/qemu/qemu/commit/565f65d271984a32eed2c324ff6ef8be33f7f3d2
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M arch_init.c
    M block/sheepdog.c
    M blockdev.c
    M hw/arm/exynos4210.c
    M hw/arm/highbank.c
    M hw/arm/integratorcp.c
    M hw/arm/realview.c
    M hw/arm/versatilepb.c
    M hw/arm/vexpress.c
    M hw/arm/xilinx_zynq.c
    M hw/block/virtio-blk.c
    M hw/char/serial.c
    M hw/i386/kvm/pci-assign.c
    M hw/i386/pc.c
    M hw/i386/smbios.c
    M hw/ide/qdev.c
    M hw/pci/pci-hotplug-old.c
    M hw/pci/pci.c
    M hw/usb/dev-network.c
    M hw/usb/host-libusb.c
    M hw/usb/redirect.c
    M qemu-char.c
    M qemu-img.c
    M qemu-io.c
    M qemu-nbd.c
    M qom/cpu.c
    M target-i386/cpu.c
    M target-sparc/cpu.c
    M util/error.c
    M util/qemu-config.c
    M vl.c

  Log Message:
  -----------
  error: Use error_report_err() where appropriate

Coccinelle semantic patch:

    @@
    expression E;
    @@
    -    error_report("%s", error_get_pretty(E));
    -    error_free(E);
    +    error_report_err(E);
    @@
    expression E, S;
    @@
    -    error_report("%s", error_get_pretty(E));
    +    error_report_err(E);
    (
   exit(S);
    |
   abort();
    )

Trivial manual touch-ups in block/sheepdog.c.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 1677f4c66cf2228eb14f1b0571d0e3b38d0d6606
      
https://github.com/qemu/qemu/commit/1677f4c66cf2228eb14f1b0571d0e3b38d0d6606
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M hw/i386/kvm/pci-assign.c
    M hw/scsi/vhost-scsi.c
    M include/monitor/monitor.h
    M monitor.c
    M net/socket.c
    M net/tap.c

  Log Message:
  -----------
  monitor: Clean up around monitor_handle_fd_param()

monitor_handle_fd_param() is a wrapper around
monitor_handle_fd_param2() that feeds errors to qerror_report_err()
instead of returning them.  qerror_report_err() is inappropriate in
many contexts.  monitor_handle_fd_param() looks simpler than
monitor_handle_fd_param2(), which tempts use.  Remove the temptation:
drop the wrapper and open-code the (trivial) error handling instead.

Replace the open-coded qerror_report_err() by error_report_err() in
places that already use error_report().  Turns out that's everywhere.

While there, rename monitor_handle_fd_param2() to monitor_fd_param().

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 091e38b7dc3255d780f0603b5b93c25078c39856
      
https://github.com/qemu/qemu/commit/091e38b7dc3255d780f0603b5b93c25078c39856
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M monitor.c

  Log Message:
  -----------
  monitor: Avoid qerror_report_err() outside QMP command handlers

qerror_report_err() is a transitional interface to help with
converting existing monitor commands to QMP.  It should not be used
elsewhere.  Replace by error_report_err() in HMP command handler
hmp_trace_event().

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 12d0cc2db971cc0888b7d465143c68dee381c88b
      
https://github.com/qemu/qemu/commit/12d0cc2db971cc0888b7d465143c68dee381c88b
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M net/net.c

  Log Message:
  -----------
  net: Avoid qerror_report_err() outside QMP command handlers

qerror_report_err() is a transitional interface to help with
converting existing monitor commands to QMP.  It should not be used
elsewhere.  Replace by error_report_err() in HMP command handler
hmp_host_net_add() and initial startup helpers net_init_client(),
net_init_netdev().  Keep it in QMP command handler qmp_netdev_add().

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 29b762f5f0efdb6a0cb693be6df2988c195523db
      
https://github.com/qemu/qemu/commit/29b762f5f0efdb6a0cb693be6df2988c195523db
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M numa.c

  Log Message:
  -----------
  numa: Avoid qerror_report_err() outside QMP command handlers

qerror_report_err() is a transitional interface to help with
converting existing monitor commands to QMP.  It should not be used
elsewhere.  Replace by error_report_err() in initial startup helper
numa_init_func() and board setup helper
memory_region_allocate_system_memory().

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: bc09a287d85505eabd1f548eae3a188ece902e49
      
https://github.com/qemu/qemu/commit/bc09a287d85505eabd1f548eae3a188ece902e49
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M tpm.c

  Log Message:
  -----------
  tpm: Avoid qerror_report_err() outside QMP command handlers

qerror_report_err() is a transitional interface to help with
converting existing monitor commands to QMP.  It should not be used
elsewhere.  Replace by error_report_err() in initial startup helper
configure_tpm().

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: a720a390b1b2260d245bcc96923bf17e186b4b7e
      
https://github.com/qemu/qemu/commit/a720a390b1b2260d245bcc96923bf17e186b4b7e
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M vl.c

  Log Message:
  -----------
  vl: Avoid qerror_report_err() outside QMP command handlers

qerror_report_err() is a transitional interface to help with
converting existing monitor commands to QMP.  It should not be used
elsewhere.  Replace by error_report_err() in initial startup helpers
machine_set_property() and object_create().

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 6936f299a47acf84b4d926d0eec4cdf3cf2274ba
      
https://github.com/qemu/qemu/commit/6936f299a47acf84b4d926d0eec4cdf3cf2274ba
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M qemu-img.c

  Log Message:
  -----------
  qemu-img: Avoid qerror_report_err() outside QMP command handlers

qerror_report_err() is a transitional interface to help with
converting existing monitor commands to QMP.  It should not be used
elsewhere.  Replace by error_report_err().

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 33394884060b6501ef39b124eeaa111f61c59f7f
      
https://github.com/qemu/qemu/commit/33394884060b6501ef39b124eeaa111f61c59f7f
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M qemu-char.c

  Log Message:
  -----------
  qemu-char: Avoid qerror_report_err() outside QMP command handlers

qerror_report_err() is a transitional interface to help with
converting existing monitor commands to QMP.  It should not be used
elsewhere.  Replace by error_report_err() in legacy chardev parser
qemu_chr_parse_compat().  Legacy chardev syntax is not to be used in
QMP.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: c5c6d7f81a6950d8e32a3b5a0bafd37bfa5a8e88
      
https://github.com/qemu/qemu/commit/c5c6d7f81a6950d8e32a3b5a0bafd37bfa5a8e88
  Author: Peter Maydell <address@hidden>
  Date:   2015-02-26 (Thu, 26 Feb 2015)

  Changed paths:
    M arch_init.c
    M block/sheepdog.c
    M blockdev.c
    M hw/arm/exynos4210.c
    M hw/arm/highbank.c
    M hw/arm/integratorcp.c
    M hw/arm/realview.c
    M hw/arm/versatilepb.c
    M hw/arm/vexpress.c
    M hw/arm/xilinx_zynq.c
    M hw/block/virtio-blk.c
    M hw/char/serial.c
    M hw/i386/kvm/pci-assign.c
    M hw/i386/pc.c
    M hw/i386/smbios.c
    M hw/ide/qdev.c
    M hw/pci/pci-hotplug-old.c
    M hw/pci/pci.c
    M hw/scsi/vhost-scsi.c
    M hw/usb/dev-network.c
    M hw/usb/host-libusb.c
    M hw/usb/redirect.c
    M include/monitor/monitor.h
    M include/qapi/error.h
    M monitor.c
    M net/net.c
    M net/socket.c
    M net/tap.c
    M numa.c
    M qemu-char.c
    M qemu-img.c
    M qemu-io.c
    M qemu-nbd.c
    M qom/cpu.c
    M target-i386/cpu.c
    M target-sparc/cpu.c
    M tpm.c
    M util/error.c
    M util/qemu-config.c
    M vl.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2015-02-18' into 
staging

Clean up around error_get_pretty(), qerror_report_err()

# gpg: Signature made Wed Feb 18 10:10:07 2015 GMT using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <address@hidden>"
# gpg:                 aka "Markus Armbruster <address@hidden>"

* remotes/armbru/tags/pull-error-2015-02-18:
  qemu-char: Avoid qerror_report_err() outside QMP command handlers
  qemu-img: Avoid qerror_report_err() outside QMP command handlers
  vl: Avoid qerror_report_err() outside QMP command handlers
  tpm: Avoid qerror_report_err() outside QMP command handlers
  numa: Avoid qerror_report_err() outside QMP command handlers
  net: Avoid qerror_report_err() outside QMP command handlers
  monitor: Avoid qerror_report_err() outside QMP command handlers
  monitor: Clean up around monitor_handle_fd_param()
  error: Use error_report_err() where appropriate
  error: New convenience function error_report_err()
  vhost-scsi: Improve error reporting for invalid vhostfd

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/68b459eaa660...c5c6d7f81a69

reply via email to

[Prev in Thread] Current Thread [Next in Thread]