1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

nodedev: Implement virNodeDeviceLookupSCSIHostByWWN

This just simply changes nodeDeviceLookupByWWN to be not static,
and its name into nodeDeviceLookupSCSIHostByWWN. And use that for
udev and HAL backends.
This commit is contained in:
Osier Yang 2013-02-04 21:03:11 +08:00
parent 39758e7567
commit fb2e465362
4 changed files with 14 additions and 5 deletions

View File

@ -224,10 +224,11 @@ cleanup:
} }
static virNodeDevicePtr virNodeDevicePtr
nodeDeviceLookupByWWN(virConnectPtr conn, nodeDeviceLookupSCSIHostByWWN(virConnectPtr conn,
const char *wwnn, const char *wwnn,
const char *wwpn) const char *wwpn,
unsigned int flags)
{ {
unsigned int i; unsigned int i;
virDeviceMonitorStatePtr driver = conn->devMonPrivateData; virDeviceMonitorStatePtr driver = conn->devMonPrivateData;
@ -236,6 +237,8 @@ nodeDeviceLookupByWWN(virConnectPtr conn,
virNodeDeviceObjPtr obj = NULL; virNodeDeviceObjPtr obj = NULL;
virNodeDevicePtr dev = NULL; virNodeDevicePtr dev = NULL;
virCheckFlags(0, NULL);
nodeDeviceLock(driver); nodeDeviceLock(driver);
for (i = 0; i < devs->count; i++) { for (i = 0; i < devs->count; i++) {
@ -546,7 +549,7 @@ find_new_device(virConnectPtr conn, const char *wwnn, const char *wwpn)
virFileWaitForDevices(); virFileWaitForDevices();
dev = nodeDeviceLookupByWWN(conn, wwnn, wwpn); dev = nodeDeviceLookupSCSIHostByWWN(conn, wwnn, wwpn, 0);
if (dev != NULL) { if (dev != NULL) {
break; break;

View File

@ -77,6 +77,10 @@ int nodeListAllNodeDevices(virConnectPtr conn,
virNodeDevicePtr **devices, virNodeDevicePtr **devices,
unsigned int flags); unsigned int flags);
virNodeDevicePtr nodeDeviceLookupByName(virConnectPtr conn, const char *name); virNodeDevicePtr nodeDeviceLookupByName(virConnectPtr conn, const char *name);
virNodeDevicePtr nodeDeviceLookupSCSIHostByWWN(virConnectPtr conn,
const char *wwnn,
const char *wwpn,
unsigned int flags);
char *nodeDeviceGetXMLDesc(virNodeDevicePtr dev, unsigned int flags); char *nodeDeviceGetXMLDesc(virNodeDevicePtr dev, unsigned int flags);
char *nodeDeviceGetParent(virNodeDevicePtr dev); char *nodeDeviceGetParent(virNodeDevicePtr dev);
int nodeDeviceNumOfCaps(virNodeDevicePtr dev); int nodeDeviceNumOfCaps(virNodeDevicePtr dev);

View File

@ -767,6 +767,7 @@ static virDeviceMonitor halDeviceMonitor = {
.listDevices = nodeListDevices, /* 0.5.0 */ .listDevices = nodeListDevices, /* 0.5.0 */
.listAllNodeDevices = nodeListAllNodeDevices, /* 0.10.2 */ .listAllNodeDevices = nodeListAllNodeDevices, /* 0.10.2 */
.deviceLookupByName = nodeDeviceLookupByName, /* 0.5.0 */ .deviceLookupByName = nodeDeviceLookupByName, /* 0.5.0 */
.deviceLookupSCSIHostByWWN = nodeDeviceLookupSCSIHostByWWN, /* 1.0.2 */
.deviceGetXMLDesc = nodeDeviceGetXMLDesc, /* 0.5.0 */ .deviceGetXMLDesc = nodeDeviceGetXMLDesc, /* 0.5.0 */
.deviceGetParent = nodeDeviceGetParent, /* 0.5.0 */ .deviceGetParent = nodeDeviceGetParent, /* 0.5.0 */
.deviceNumOfCaps = nodeDeviceNumOfCaps, /* 0.5.0 */ .deviceNumOfCaps = nodeDeviceNumOfCaps, /* 0.5.0 */

View File

@ -1754,6 +1754,7 @@ static virDeviceMonitor udevDeviceMonitor = {
.listDevices = nodeListDevices, /* 0.7.3 */ .listDevices = nodeListDevices, /* 0.7.3 */
.listAllNodeDevices = nodeListAllNodeDevices, /* 0.10.2 */ .listAllNodeDevices = nodeListAllNodeDevices, /* 0.10.2 */
.deviceLookupByName = nodeDeviceLookupByName, /* 0.7.3 */ .deviceLookupByName = nodeDeviceLookupByName, /* 0.7.3 */
.deviceLookupSCSIHostByWWN = nodeDeviceLookupSCSIHostByWWN, /* 1.0.2 */
.deviceGetXMLDesc = nodeDeviceGetXMLDesc, /* 0.7.3 */ .deviceGetXMLDesc = nodeDeviceGetXMLDesc, /* 0.7.3 */
.deviceGetParent = nodeDeviceGetParent, /* 0.7.3 */ .deviceGetParent = nodeDeviceGetParent, /* 0.7.3 */
.deviceNumOfCaps = nodeDeviceNumOfCaps, /* 0.7.3 */ .deviceNumOfCaps = nodeDeviceNumOfCaps, /* 0.7.3 */