[libvirt PATCH 09/16] src: define virDomainGetDeprecations API

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

 



This API allows fetching a list of deprecation messages against the domain.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 include/libvirt/libvirt-domain.h |  4 +++
 src/driver-hypervisor.h          |  6 ++++
 src/libvirt-domain.c             | 47 ++++++++++++++++++++++++++++++++
 src/libvirt_public.syms          |  5 ++++
 4 files changed, 62 insertions(+)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index de2456812c..cef16e6361 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -5119,4 +5119,8 @@ int virDomainAuthorizedSSHKeysSet(virDomainPtr domain,
                                   unsigned int nkeys,
                                   unsigned int flags);
 
+int virDomainGetDeprecations(virDomainPtr domain,
+                             char ***msgs,
+                             unsigned int flags);
+
 #endif /* LIBVIRT_DOMAIN_H */
diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h
index 9e8fe89921..2f804dba1f 100644
--- a/src/driver-hypervisor.h
+++ b/src/driver-hypervisor.h
@@ -1400,6 +1400,11 @@ typedef int
                                     unsigned int nkeys,
                                     unsigned int flags);
 
+typedef int
+(*virDrvDomainGetDeprecations)(virDomainPtr domain,
+                               char ***msgs,
+                               unsigned int flags);
+
 typedef struct _virHypervisorDriver virHypervisorDriver;
 typedef virHypervisorDriver *virHypervisorDriverPtr;
 
@@ -1665,4 +1670,5 @@ struct _virHypervisorDriver {
     virDrvDomainBackupGetXMLDesc domainBackupGetXMLDesc;
     virDrvDomainAuthorizedSSHKeysGet domainAuthorizedSSHKeysGet;
     virDrvDomainAuthorizedSSHKeysSet domainAuthorizedSSHKeysSet;
+    virDrvDomainGetDeprecations domainGetDeprecations;
 };
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index c9f8ffdb56..9e3b118483 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -13102,3 +13102,50 @@ virDomainAuthorizedSSHKeysSet(virDomainPtr domain,
     virDispatchError(conn);
     return -1;
 }
+
+
+/**
+ * virDomainGetDeprecations:
+ * @domain: a domain object
+ * @msgs: pointer to a variable to store deprecation messages
+ * @flags: extra flags; not used yet, so callers should always pass 0
+ *
+ * Fetch a list of all deprecation messages for the VM and
+ * store them into @msgs array which is allocated upon
+ * successful return and is NULL terminated. The caller is
+ * responsible for freeing @msgs when no longer needed.
+ *
+ * Note that some hypervisors may only report deprecation
+ * messages while the VM is in a running state.
+ *
+ * Returns: number of messages stored in @msgs,
+ *          -1 otherwise.
+ */
+int
+virDomainGetDeprecations(virDomainPtr domain,
+                         char ***msgs,
+                         unsigned int flags)
+{
+    virConnectPtr conn;
+
+    VIR_DOMAIN_DEBUG(domain, "msgs=%p, flags=0x%x", msgs, flags);
+
+    virResetLastError();
+
+    virCheckDomainReturn(domain, -1);
+    conn = domain->conn;
+    virCheckNonNullArgGoto(msgs, error);
+
+    if (conn->driver->domainGetDeprecations) {
+        int ret;
+        ret = conn->driver->domainGetDeprecations(domain, msgs, 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 cf31f937d5..345c5685bf 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -879,4 +879,9 @@ LIBVIRT_6.10.0 {
         virDomainAuthorizedSSHKeysSet;
 } LIBVIRT_6.0.0;
 
+LIBVIRT_7.1.0 {
+    global:
+        virDomainGetDeprecations;
+} LIBVIRT_6.10.0;
+
 # .... define new API here using predicted next version number ....
-- 
2.29.2




[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