[dbus PATCH 12/14] Implement NodeDeviceLookupSCSIHostByWWN method for Connect Interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
---
 data/org.libvirt.Connect.xml |  8 ++++++++
 src/connect.c                | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/data/org.libvirt.Connect.xml b/data/org.libvirt.Connect.xml
index a030d57..7014a09 100644
--- a/data/org.libvirt.Connect.xml
+++ b/data/org.libvirt.Connect.xml
@@ -221,6 +221,14 @@
       <arg name="name" type="s" direction="in"/>
       <arg name="dev" type="o" direction="out"/>
     </method>
+    <method name="NodeDeviceLookupSCSIHostByWWN">
+      <annotation name="org.gtk.GDBus.DocString"
+        value="See https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceLookupSCSIHostByWWN"/>
+      <arg name="wwnn" type="s" direction="in"/>
+      <arg name="wwpn" type="s" direction="in"/>
+      <arg name="flags" type="u" direction="in"/>
+      <arg name="dev" type="o" direction="out"/>
+    </method>
     <method name="NWFilterDefineXML">
       <annotation name="org.gtk.GDBus.DocString"
         value="See https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterDefineXML"/>
diff --git a/src/connect.c b/src/connect.c
index 6192f47..e1406dd 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -1126,6 +1126,37 @@ virtDBusConnectNodeDeviceLookupByName(GVariant *inArgs,
     *outArgs = g_variant_new("(o)", path);
 }
 
+static void
+virtDBusConnectNodeDeviceLookupSCSIHostByWWN(GVariant *inArgs,
+                                             GUnixFDList *inFDs G_GNUC_UNUSED,
+                                             const gchar *objectPath G_GNUC_UNUSED,
+                                             gpointer userData,
+                                             GVariant **outArgs,
+                                             GUnixFDList **outFDs G_GNUC_UNUSED,
+                                             GError **error)
+{
+    virtDBusConnect *connect = userData;
+    g_autoptr(virNodeDevice) dev = NULL;
+    g_autofree gchar *path = NULL;
+    const gchar *wwnn;
+    const gchar *wwpn;
+    guint flags;
+
+    g_variant_get(inArgs, "(&s&su)", &wwnn, &wwpn, &flags);
+
+    if (!virtDBusConnectOpen(connect, error))
+        return;
+
+    dev = virNodeDeviceLookupSCSIHostByWWN(connect->connection, wwnn, wwpn,
+                                           flags);
+    if (!dev)
+        return virtDBusUtilSetLastVirtError(error);
+
+    path = virtDBusUtilBusPathForVirNodeDevice(dev, connect->devPath);
+
+    *outArgs = g_variant_new("(o)", path);
+}
+
 static void
 virtDBusConnectNWFilterDefineXML(GVariant *inArgs,
                                  GUnixFDList *inFDs G_GNUC_UNUSED,
@@ -1746,6 +1777,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = {
     { "NetworkLookupByUUID", virtDBusConnectNetworkLookupByUUID },
     { "NodeDeviceCreateXML", virtDBusConnectNodeDeviceCreateXML },
     { "NodeDeviceLookupByName", virtDBusConnectNodeDeviceLookupByName },
+    { "NodeDeviceLookupSCSIHostByWWN", virtDBusConnectNodeDeviceLookupSCSIHostByWWN },
     { "NWFilterDefineXML", virtDBusConnectNWFilterDefineXML },
     { "NWFilterLookupByName", virtDBusConnectNWFilterLookupByName },
     { "NWFilterLookupByUUID", virtDBusConnectNWFilterLookupByUUID },
-- 
2.15.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux