[libvirt PATCH v3 1/5] domain: add interface information to 'virDomainGetGuestInfo'

zhanglei zhanglei at smartx.com
Tue Sep 14 11:47:06 UTC 2021


Signed-off-by: zhanglei <zhanglei at smartx.com>
---
 include/libvirt/libvirt-domain.h |  1 +
 src/libvirt-domain.c             | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 7ef8ac51e5..b088847725 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -5074,6 +5074,7 @@ typedef enum {
     VIR_DOMAIN_GUEST_INFO_HOSTNAME = (1 << 3), /* return hostname information */
     VIR_DOMAIN_GUEST_INFO_FILESYSTEM = (1 << 4), /* return filesystem information */
     VIR_DOMAIN_GUEST_INFO_DISKS = (1 << 5), /* return disks information */
+    VIR_DOMAIN_GUEST_INFO_INTERFACES = (1 << 6), /* return interfaces information */
 } virDomainGuestInfoTypes;
 
 int virDomainGetGuestInfo(virDomainPtr domain,
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 57baef6889..fdc0780ae0 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -12579,6 +12579,18 @@ virDomainSetVcpu(virDomainPtr domain,
  *
  *      "hostname" - the hostname of the domain
  *
+ * VIR_DOMAIN_GUEST_INFO_INTERFACES:
+ *  Returns information about the interfaces within the domain. the typed
+ *  parameter keys are in this format:
+ *
+ *      "if.count" - the number of interfaces defined on this domain
+ *      "if.<num>.name" - name in the guest (e.g. ``eth0``) for interface <num>
+ *      "if.<num>.hwaddr" - hardware address in the guest for interface <num>
+ *      "if.<num>.addr.count - the number of IP addresses of interface <num>
+ *      "if.<num>.addr.<num1>.type" - the IP address type of addr <num1> (e.g. ipv4)
+ *      "if.<num>.addr.<num1>.addr" - the IP address of addr <num1>
+ *      "if.<num>.addr.<num1>.prefix" - the prefix of IP address of addr <num1>
+ *
  * Using 0 for @types returns all information groups supported by the given
  * hypervisor.
  *
-- 
2.31.1




More information about the libvir-list mailing list