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.
This commit is contained in:
Laine Stump 2015-05-27 13:59:57 -04:00
parent 6074f8316c
commit 06a18bc84b
2 changed files with 16 additions and 6 deletions

View File

@ -248,7 +248,9 @@ nodeDeviceLookupByName(virConnectPtr conn, const char *name)
nodeDeviceUnlock(); nodeDeviceUnlock();
if (!obj) { 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; goto cleanup;
} }
@ -597,8 +599,10 @@ nodeDeviceCreateXML(virConnectPtr conn,
* we're returning what we get... */ * we're returning what we get... */
if (dev == NULL) 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: cleanup:
nodeDeviceUnlock(); nodeDeviceUnlock();
virNodeDeviceDefFree(def); virNodeDeviceDefFree(def);
@ -621,7 +625,9 @@ nodeDeviceDestroy(virNodeDevicePtr dev)
nodeDeviceUnlock(); nodeDeviceUnlock();
if (!obj) { 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; goto out;
} }

View File

@ -5673,7 +5673,9 @@ testNodeDeviceLookupByName(virConnectPtr conn, const char *name)
testDriverUnlock(driver); testDriverUnlock(driver);
if (!obj) { 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; goto cleanup;
} }
@ -5893,7 +5895,9 @@ testNodeDeviceDestroy(virNodeDevicePtr dev)
testDriverUnlock(driver); testDriverUnlock(driver);
if (!obj) { 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; goto out;
} }