From: Laine Stump Date: Wed, 27 May 2015 17:59:57 +0000 (-0400) Subject: node_device: more informative error log when device isn't found X-Git-Tag: v1.2.16-rc2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06a18bc84b8f64683e2e2a24dca8dca1a5cbb7fa;p=thirdparty%2Flibvirt.git node_device: more informative error log when device isn't found 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. --- diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c index 34ba1fad27..768db7fbb3 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 038b2b89bd..d1f0af3a95 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; }