]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
ch_monitor: Use virCHMonitorGet to access cloud-hypervisor API
authorWilliam Douglas <william.douglas@intel.com>
Wed, 8 Sep 2021 18:01:18 +0000 (11:01 -0700)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 9 Sep 2021 13:51:02 +0000 (14:51 +0100)
Now that virCHMonitorGet is capable of handling data returned by the
cloud-hypervisor API, make use of this via virCHMonitorGetInfo to call
into the vm.info endpoint.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: William Douglas <william.douglas@intel.com>
src/ch/ch_monitor.c
src/ch/ch_monitor.h

index e77b5bc2dcd7ac53bd362ab82793165c7484da15..6dece576f3b9dc8f97f9cc76c8b0f302090f31da 100644 (file)
@@ -757,3 +757,18 @@ virCHMonitorResumeVM(virCHMonitor *mon)
 {
     return virCHMonitorPutNoContent(mon, URL_VM_RESUME);
 }
+
+/**
+ * virCHMonitorGetInfo:
+ * @mon: Pointer to the monitor
+ * @info: Get VM info
+ *
+ * Retrive the VM info and store in @info
+ *
+ * Returns 0 on success.
+ */
+int
+virCHMonitorGetInfo(virCHMonitor *mon, virJSONValue **info)
+{
+    return virCHMonitorGet(mon, URL_VM_INFO, info);
+}
index e717e11cbcc7bd12eaac183b864652cca643e6b4..e39b4eb8b26269245b9b52178ea3d0de1432e241 100644 (file)
@@ -23,6 +23,7 @@
 #include <curl/curl.h>
 
 #include "virobject.h"
+#include "virjson.h"
 #include "domain_conf.h"
 
 #define URL_ROOT "http://localhost/api/v1"
@@ -34,6 +35,7 @@
 #define URL_VM_REBOOT "vm.reboot"
 #define URL_VM_Suspend "vm.pause"
 #define URL_VM_RESUME "vm.resume"
+#define URL_VM_INFO "vm.info"
 
 typedef struct _virCHMonitor virCHMonitor;
 
@@ -58,3 +60,4 @@ int virCHMonitorShutdownVM(virCHMonitor *mon);
 int virCHMonitorRebootVM(virCHMonitor *mon);
 int virCHMonitorSuspendVM(virCHMonitor *mon);
 int virCHMonitorResumeVM(virCHMonitor *mon);
+int virCHMonitorGetInfo(virCHMonitor *mon, virJSONValue **info);