mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
nodedev: Introduce virNodeDeviceGetParentName
Create a function which takes a node device "name" entry to lookup and returns a string containing the parent name for the node device.
This commit is contained in:
parent
16416816c1
commit
aa6aa624ad
@ -2288,3 +2288,33 @@ virNodeDeviceObjListExport(virConnectPtr conn,
|
|||||||
VIR_FREE(tmp_devices);
|
VIR_FREE(tmp_devices);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* virNodeDeviceGetParentName
|
||||||
|
* @conn: Connection pointer
|
||||||
|
* @nodedev_name: Node device to lookup
|
||||||
|
*
|
||||||
|
* Lookup the node device by name and return the parent name
|
||||||
|
*
|
||||||
|
* Returns parent name on success, caller is responsible for freeing;
|
||||||
|
* otherwise, returns NULL on failure
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
virNodeDeviceGetParentName(virConnectPtr conn,
|
||||||
|
const char *nodedev_name)
|
||||||
|
{
|
||||||
|
virNodeDevicePtr device = NULL;
|
||||||
|
char *parent;
|
||||||
|
|
||||||
|
if (!(device = virNodeDeviceLookupByName(conn, nodedev_name))) {
|
||||||
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
|
_("Cannot find '%s' in node device database"),
|
||||||
|
nodedev_name);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ignore_value(VIR_STRDUP(parent, virNodeDeviceGetParent(device)));
|
||||||
|
virObjectUnref(device);
|
||||||
|
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
@ -352,4 +352,7 @@ int virNodeDeviceObjListExport(virConnectPtr conn,
|
|||||||
virNodeDeviceObjListFilter filter,
|
virNodeDeviceObjListFilter filter,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
|
char *virNodeDeviceGetParentName(virConnectPtr conn,
|
||||||
|
const char *nodedev_name);
|
||||||
|
|
||||||
#endif /* __VIR_NODE_DEVICE_CONF_H__ */
|
#endif /* __VIR_NODE_DEVICE_CONF_H__ */
|
||||||
|
@ -706,6 +706,7 @@ virNodeDeviceFindVportParentHost;
|
|||||||
virNodeDeviceGetParentHost;
|
virNodeDeviceGetParentHost;
|
||||||
virNodeDeviceGetParentHostByFabricWWN;
|
virNodeDeviceGetParentHostByFabricWWN;
|
||||||
virNodeDeviceGetParentHostByWWNs;
|
virNodeDeviceGetParentHostByWWNs;
|
||||||
|
virNodeDeviceGetParentName;
|
||||||
virNodeDeviceGetWWNs;
|
virNodeDeviceGetWWNs;
|
||||||
virNodeDeviceHasCap;
|
virNodeDeviceHasCap;
|
||||||
virNodeDeviceObjListExport;
|
virNodeDeviceObjListExport;
|
||||||
|
Loading…
Reference in New Issue
Block a user