[RFC REPOST 4/7] src: introduce virDomainSetFibreChannelAppid API

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

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 include/libvirt/libvirt-domain.h |  4 +++
 src/driver-hypervisor.h          |  6 +++++
 src/libvirt-domain.c             | 44 ++++++++++++++++++++++++++++++++
 src/libvirt_public.syms          |  1 +
 4 files changed, 55 insertions(+)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 7ef8ac51e5..4f7b88ef61 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -5153,4 +5153,8 @@ int virDomainStartDirtyRateCalc(virDomainPtr domain,
                                 int seconds,
                                 unsigned int flags);
 
+int virDomainSetFibreChannelAppid(virDomainPtr domain,
+                                  const char *appid,
+                                  unsigned int flags);
+
 #endif /* LIBVIRT_DOMAIN_H */
diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h
index d642af8a37..e6b1ceb3ce 100644
--- a/src/driver-hypervisor.h
+++ b/src/driver-hypervisor.h
@@ -1412,6 +1412,11 @@ typedef int
 
 typedef struct _virHypervisorDriver virHypervisorDriver;
 
+typedef int
+(*virDrvDomainSetFibreChannelAppid)(virDomainPtr domain,
+                                    const char *appid,
+                                    unsigned int flags);
+
 /**
  * _virHypervisorDriver:
  *
@@ -1676,4 +1681,5 @@ struct _virHypervisorDriver {
     virDrvDomainAuthorizedSSHKeysSet domainAuthorizedSSHKeysSet;
     virDrvDomainGetMessages domainGetMessages;
     virDrvDomainStartDirtyRateCalc domainStartDirtyRateCalc;
+    virDrvDomainSetFibreChannelAppid domainSetFibreChannelAppid;
 };
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index a8a386e839..f3e6854a39 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -13229,3 +13229,47 @@ virDomainStartDirtyRateCalc(virDomainPtr domain,
     virDispatchError(conn);
     return -1;
 }
+
+
+/**
+ * virDomainSetFibreChannelAppid:
+ * @domain: a domain object
+ * @appid: user provided appid string
+ * @flags: extra flags
+ *
+ * Set the Fibre Channel APPID. Accepts only printable characters
+ * and maximal length is 128 characters. To remove the APPID use
+ * NULL as @appid value.
+ *
+ * Returns 0 in case of success, -1 otherwise.
+ */
+int
+virDomainSetFibreChannelAppid(virDomainPtr domain,
+                              const char *appid,
+                              unsigned int flags)
+{
+    virConnectPtr conn;
+
+    VIR_DOMAIN_DEBUG(domain, "appid=%s, flags=0x%x", appid, flags);
+
+    virResetLastError();
+
+    virCheckDomainReturn(domain, -1);
+    conn = domain->conn;
+
+    virCheckReadOnlyGoto(conn->flags, error);
+
+    if (conn->driver->domainSetFibreChannelAppid) {
+        int ret;
+        ret = conn->driver->domainSetFibreChannelAppid(domain, appid, flags);
+        if (ret < 0)
+            goto error;
+        return ret;
+    }
+
+    virReportUnsupportedError();
+
+ error:
+    virDispatchError(conn);
+    return -1;
+}
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index 3a5fa7cb09..912b421632 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -900,6 +900,7 @@ LIBVIRT_7.7.0 {
     global:
         virNWFilterDefineXMLFlags;
         virNetworkDefineXMLFlags;
+        virDomainSetFibreChannelAppid;
 } LIBVIRT_7.3.0;
 
 # .... define new API here using predicted next version number ....
-- 
2.31.1




[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