Report the object name on lookup error

* src/network_driver.c src/node_device.c src/storage_driver.c:
  many places in the code reported 'No xxx with matching name" after
  a Lookup error without reporting the name used by the failed lookup
This commit is contained in:
Daniel Veillard 2009-07-08 12:01:35 +02:00
parent 2562303a45
commit c6cd55d38e
3 changed files with 35 additions and 24 deletions

View File

@ -971,7 +971,7 @@ static virNetworkPtr networkLookupByName(virConnectPtr conn,
networkDriverUnlock(driver);
if (!network) {
networkReportError(conn, NULL, NULL, VIR_ERR_NO_NETWORK,
"%s", _("no network with matching name"));
_("no network with matching name '%s'"), name);
goto cleanup;
}

View File

@ -279,8 +279,9 @@ static char *nodeDeviceDumpXML(virNodeDevicePtr dev,
nodeDeviceUnlock(driver);
if (!obj) {
virNodeDeviceReportError(dev->conn, VIR_ERR_INVALID_NODE_DEVICE,
"%s", _("no node device with matching name"));
virNodeDeviceReportError(dev->conn, VIR_ERR_NO_NODE_DEVICE,
_("no node device with matching name '%s'"),
dev->name);
goto cleanup;
}
@ -307,8 +308,9 @@ static char *nodeDeviceGetParent(virNodeDevicePtr dev)
nodeDeviceUnlock(driver);
if (!obj) {
virNodeDeviceReportError(dev->conn, VIR_ERR_INVALID_NODE_DEVICE,
"%s", _("no node device with matching name"));
virNodeDeviceReportError(dev->conn, VIR_ERR_NO_NODE_DEVICE,
_("no node device with matching name '%s'"),
dev->name);
goto cleanup;
}
@ -341,8 +343,9 @@ static int nodeDeviceNumOfCaps(virNodeDevicePtr dev)
nodeDeviceUnlock(driver);
if (!obj) {
virNodeDeviceReportError(dev->conn, VIR_ERR_INVALID_NODE_DEVICE,
"%s", _("no node device with matching name"));
virNodeDeviceReportError(dev->conn, VIR_ERR_NO_NODE_DEVICE,
_("no node device with matching name '%s'"),
dev->name);
goto cleanup;
}
@ -371,8 +374,9 @@ nodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int maxnames)
nodeDeviceUnlock(driver);
if (!obj) {
virNodeDeviceReportError(dev->conn, VIR_ERR_INVALID_NODE_DEVICE,
"%s", _("no node device with matching name"));
virNodeDeviceReportError(dev->conn, VIR_ERR_NO_NODE_DEVICE,
_("no node device with matching name '%s'"),
dev->name);
goto cleanup;
}

View File

@ -295,7 +295,7 @@ storagePoolLookupByName(virConnectPtr conn,
if (!pool) {
virStorageReportError(conn, VIR_ERR_NO_STORAGE_POOL,
"%s", _("no pool with matching name"));
_("no pool with matching name '%s'"), name);
goto cleanup;
}
@ -1099,8 +1099,9 @@ storageVolumeLookupByName(virStoragePoolPtr obj,
vol = virStorageVolDefFindByName(pool, name);
if (!vol) {
virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
"%s", _("no storage vol with matching name"));
virStorageReportError(obj->conn, VIR_ERR_NO_STORAGE_VOL,
_("no storage vol with matching name '%s'"),
name);
goto cleanup;
}
@ -1339,8 +1340,9 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
}
if (diffpool && !origpool) {
virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
"%s", _("no storage pool with matching name"));
virStorageReportError(obj->conn, VIR_ERR_NO_STORAGE_POOL,
_("no storage pool with matching name '%s'"),
vobj->pool);
goto cleanup;
}
@ -1361,8 +1363,9 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
origvol = virStorageVolDefFindByName(origpool, vobj->name);
if (!origvol) {
virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
"%s", _("no storage vol with matching name"));
virStorageReportError(obj->conn, VIR_ERR_NO_STORAGE_VOL,
_("no storage vol with matching name '%s'"),
vobj->name);
goto cleanup;
}
@ -1501,8 +1504,9 @@ storageVolumeDelete(virStorageVolPtr obj,
vol = virStorageVolDefFindByName(pool, obj->name);
if (!vol) {
virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
"%s", _("no storage vol with matching name"));
virStorageReportError(obj->conn, VIR_ERR_NO_STORAGE_VOL,
_("no storage vol with matching name '%s'"),
obj->name);
goto cleanup;
}
@ -1576,8 +1580,9 @@ storageVolumeGetInfo(virStorageVolPtr obj,
vol = virStorageVolDefFindByName(pool, obj->name);
if (!vol) {
virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
"%s", _("no storage vol with matching name"));
virStorageReportError(obj->conn, VIR_ERR_NO_STORAGE_VOL,
_("no storage vol with matching name '%s'"),
obj->name);
goto cleanup;
}
@ -1628,8 +1633,9 @@ storageVolumeGetXMLDesc(virStorageVolPtr obj,
vol = virStorageVolDefFindByName(pool, obj->name);
if (!vol) {
virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
"%s", _("no storage vol with matching name"));
virStorageReportError(obj->conn, VIR_ERR_NO_STORAGE_VOL,
_("no storage vol with matching name '%s'"),
obj->name);
goto cleanup;
}
@ -1674,8 +1680,9 @@ storageVolumeGetPath(virStorageVolPtr obj) {
vol = virStorageVolDefFindByName(pool, obj->name);
if (!vol) {
virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
"%s", _("no storage vol with matching name"));
virStorageReportError(obj->conn, VIR_ERR_NO_STORAGE_VOL,
_("no storage vol with matching name '%s'"),
obj->name);
goto cleanup;
}