[libvirt] [PATCH] node_device: more informative error log when device isn't found
Martin Kletzander
mkletzan at redhat.com
Thu May 28 09:54:41 UTC 2015
On Wed, May 27, 2015 at 02:03:27PM -0400, Laine Stump wrote:
>In a couple of cases, the node device driver (and the test node device
>driver which likely copied it) was only logging "Node device not
>found" when it couldn't find the requested device. This patch changes
>those cases to log the name (and in the case when it's relevant, the
>wwnn and wwpn) as well.
>---
> src/node_device/node_device_driver.c | 14 ++++++++++----
> src/test/test_driver.c | 8 ++++++--
> 2 files changed, 16 insertions(+), 6 deletions(-)
>
ACK and safe for freeze.
>diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
>index 34ba1fa..768db7f 100644
>--- a/src/node_device/node_device_driver.c
>+++ b/src/node_device/node_device_driver.c
>@@ -248,7 +248,9 @@ nodeDeviceLookupByName(virConnectPtr conn, const char *name)
> nodeDeviceUnlock();
>
> if (!obj) {
>- virReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
>+ virReportError(VIR_ERR_NO_NODE_DEVICE,
>+ _("no node device with matching name '%s'"),
>+ name);
> goto cleanup;
> }
>
>@@ -597,8 +599,10 @@ nodeDeviceCreateXML(virConnectPtr conn,
> * we're returning what we get... */
>
> if (dev == NULL)
>- virReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
>-
>+ virReportError(VIR_ERR_NO_NODE_DEVICE,
>+ _("no node device for '%s' with matching "
>+ "wwnn '%s' and wwpn '%s'"),
>+ def->name, wwnn, wwpn);
> cleanup:
> nodeDeviceUnlock();
> virNodeDeviceDefFree(def);
>@@ -621,7 +625,9 @@ nodeDeviceDestroy(virNodeDevicePtr dev)
> nodeDeviceUnlock();
>
> if (!obj) {
>- virReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
>+ virReportError(VIR_ERR_NO_NODE_DEVICE,
>+ _("no node device with matching name '%s'"),
>+ dev->name);
> goto out;
> }
>
>diff --git a/src/test/test_driver.c b/src/test/test_driver.c
>index 038b2b8..d1f0af3 100644
>--- a/src/test/test_driver.c
>+++ b/src/test/test_driver.c
>@@ -5673,7 +5673,9 @@ testNodeDeviceLookupByName(virConnectPtr conn, const char *name)
> testDriverUnlock(driver);
>
> if (!obj) {
>- virReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
>+ virReportError(VIR_ERR_NO_NODE_DEVICE,
>+ _("no node device with matching name '%s'"),
>+ name);
> goto cleanup;
> }
>
>@@ -5893,7 +5895,9 @@ testNodeDeviceDestroy(virNodeDevicePtr dev)
> testDriverUnlock(driver);
>
> if (!obj) {
>- virReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
>+ virReportError(VIR_ERR_NO_NODE_DEVICE,
>+ _("no node device with matching name '%s'"),
>+ dev->name);
> goto out;
> }
>
>--
>2.1.0
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150528/721af0af/attachment-0001.sig>
More information about the libvir-list
mailing list