]> xenbits.xensource.com Git - libvirt.git/commitdiff
nodedev: Implement virNodeDeviceLookupSCSIHostByWWN
authorOsier Yang <jyang@redhat.com>
Mon, 4 Feb 2013 13:03:11 +0000 (21:03 +0800)
committerOsier Yang <jyang@redhat.com>
Mon, 11 Feb 2013 16:23:57 +0000 (00:23 +0800)
This just simply changes nodeDeviceLookupByWWN to be not static,
and its name into nodeDeviceLookupSCSIHostByWWN. And use that for
udev and HAL backends.

src/node_device/node_device_driver.c
src/node_device/node_device_driver.h
src/node_device/node_device_hal.c
src/node_device/node_device_udev.c

index 2b460417e1b6b0768562e164f5d55fb4cacec483..64fd8316e3ac6b59be2b6fe0e7bf30f36fd7a09c 100644 (file)
@@ -224,10 +224,11 @@ cleanup:
 }
 
 
-static virNodeDevicePtr
-nodeDeviceLookupByWWN(virConnectPtr conn,
-                      const char *wwnn,
-                      const char *wwpn)
+virNodeDevicePtr
+nodeDeviceLookupSCSIHostByWWN(virConnectPtr conn,
+                              const char *wwnn,
+                              const char *wwpn,
+                              unsigned int flags)
 {
     unsigned int i;
     virDeviceMonitorStatePtr driver = conn->devMonPrivateData;
@@ -236,6 +237,8 @@ nodeDeviceLookupByWWN(virConnectPtr conn,
     virNodeDeviceObjPtr obj = NULL;
     virNodeDevicePtr dev = NULL;
 
+    virCheckFlags(0, NULL);
+
     nodeDeviceLock(driver);
 
     for (i = 0; i < devs->count; i++) {
@@ -546,7 +549,7 @@ find_new_device(virConnectPtr conn, const char *wwnn, const char *wwpn)
 
         virFileWaitForDevices();
 
-        dev = nodeDeviceLookupByWWN(conn, wwnn, wwpn);
+        dev = nodeDeviceLookupSCSIHostByWWN(conn, wwnn, wwpn, 0);
 
         if (dev != NULL) {
             break;
index 5520740dcd000230a5195f97575126b1523e8756..510ae73df8f8cd20f660bbec6e64a6e4b03b6074 100644 (file)
@@ -77,6 +77,10 @@ int nodeListAllNodeDevices(virConnectPtr conn,
                            virNodeDevicePtr **devices,
                            unsigned int flags);
 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 *nodeDeviceGetParent(virNodeDevicePtr dev);
 int nodeDeviceNumOfCaps(virNodeDevicePtr dev);
index 2ecb1de052489f2594296cdefb6fa49943b98217..0ce1d0e05e4ef90289b72c3436853b5b723e6044 100644 (file)
@@ -767,6 +767,7 @@ static virDeviceMonitor halDeviceMonitor = {
     .listDevices = nodeListDevices, /* 0.5.0 */
     .listAllNodeDevices = nodeListAllNodeDevices, /* 0.10.2 */
     .deviceLookupByName = nodeDeviceLookupByName, /* 0.5.0 */
+    .deviceLookupSCSIHostByWWN = nodeDeviceLookupSCSIHostByWWN, /* 1.0.2 */
     .deviceGetXMLDesc = nodeDeviceGetXMLDesc, /* 0.5.0 */
     .deviceGetParent = nodeDeviceGetParent, /* 0.5.0 */
     .deviceNumOfCaps = nodeDeviceNumOfCaps, /* 0.5.0 */
index 566e7ab00c1fb2c00411e5ba6208189b4a6ecfb3..7f312522316a9afa3c30555a06ed3b5a6ab01566 100644 (file)
@@ -1754,6 +1754,7 @@ static virDeviceMonitor udevDeviceMonitor = {
     .listDevices = nodeListDevices, /* 0.7.3 */
     .listAllNodeDevices = nodeListAllNodeDevices, /* 0.10.2 */
     .deviceLookupByName = nodeDeviceLookupByName, /* 0.7.3 */
+    .deviceLookupSCSIHostByWWN = nodeDeviceLookupSCSIHostByWWN, /* 1.0.2 */
     .deviceGetXMLDesc = nodeDeviceGetXMLDesc, /* 0.7.3 */
     .deviceGetParent = nodeDeviceGetParent, /* 0.7.3 */
     .deviceNumOfCaps = nodeDeviceNumOfCaps, /* 0.7.3 */