[libvirt PATCH v2 1/4] domain: add interface information to 'virDomainGetGuestInfo'

zhanglei zhanglei at smartx.com
Tue Sep 14 07:56:42 UTC 2021


Signed-off-by: zhanglei <zhanglei at smartx.com>
---
 include/libvirt/libvirt-domain.h |  1 +
 src/libvirt-domain.c             | 13 +++++++++++++
 2 files changed, 14 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..b4d88f55d4 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -12579,6 +12579,19 @@ 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
+ *                    as an unsigned int
+ *      "if.<num>.name" - interface name in the guest
+ *      "if.<num>.hwaddr" -  hardware address of interface
+ *      "if.<num>.addr.count - the number of ip addresses of interface
+ *      "if.<num>.addr.<num>.type" - the type of ip address(e.g. ipv4)
+ *      "if.<num>.addr.<num>.addr" - the ip address
+ *      "if.<num>.addr.<num>.prefix" - the number of bits of ip address prefix
+ *
  * Using 0 for @types returns all information groups supported by the given
  * hypervisor.
  *
-- 
2.31.1




More information about the libvir-list mailing list