[libvirt] [Fwd: first cut public API for physical host interface configuration]

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

 



(Oops, I originally sent this with the wrong return address, which probably caused it to be silently swallowed...)

To get started integrating libnetcf support into libvirt, the attached libvirt.h diff has a first attempt at the public API that will hook up to libnetcf on the libvirtd side. I started out with the virNetwork* API, and modified/removed as seemed appropriate.

A few points worth mentioning:

virNetwork has "defined" and "active" interfaces, but so far virInterface just has interfaces, as the active/inactive status is really controlled by 1) the "onboot" property in the XML, and 2) whether or not virInterfaceStart() has been called yet.

The _virInterface struct that is referenced here is more or less identical to _virnetwork.

libnetcf works with netcf structs (one per library instance) and netcf_if structs (one per interface, multiple per library instance. As far as I can see right now, the netcf struct will not need to be referenced directly from the client side, but the netcf_if for each interface is needed, and I guess a cookie representing it will be sent to the client side and stored in the _virInterface. Is that what the UUID in _virNetwork is used for? (I know, I know - "read the code!", it's just quicker to (and avoids misreading on my part) to ask)

As before, any and all advice/corrections gratefully accepted!


diff --git a/include/libvirt/libvirt.h b/include/libvirt/libvirt.h
index 779ea72..cac400e 100644
--- a/include/libvirt/libvirt.h
+++ b/include/libvirt/libvirt.h
@@ -854,7 +854,73 @@ int                     virNetworkGetAutostart  (virNetworkPtr network,
 int                     virNetworkSetAutostart  (virNetworkPtr network,
                                                  int autostart);
 
+/*
+ * Physical host interface configuration API
+ */
+
+/**
+ * virInterface:
+ *
+ * a virInterface is a private structure representing a virtual interface.
+ */
+typedef struct _virInterface virInterface;
+
+/**
+ * virInterfacePtr:
+ *
+ * a virInterfacePtr is pointer to a virInterface private structure, this is the
+ * type used to reference a virtual interface in the API.
+ */
+typedef virInterface *virInterfacePtr;
+
+/*
+ * Get connection from interface.
+ */
+virConnectPtr           virInterfaceGetConnect    (virInterfacePtr interface);
+
+/*
+ * List defined interfaces
+ */
+int                     virConnectNumOfInterfaces (virConnectPtr conn);
+int                     virConnectListInterfaces  (virConnectPtr conn,
+                                                   char **const names,
+                                                   int maxnames);
+
+/*
+ * Lookup interface by name
+ */
+virInterfacePtr         virInterfaceLookupByName  (virConnectPtr conn,
+                                                   const char *name);
+                                                   const char *uuid);
+
+/*
+ * Define interface (or modify existing interface configuration)
+ */
+virInterfacePtr         virInterfaceDefineXML     (virConnectPtr conn,
+                                                   const char *xmlDesc);
+
+/*
+ * Delete interface
+ */
+int                     virInterfaceUndefine      (virInterfacePtr interface);
+
+/*
+ * Activate interface (ie call "ifup")
+ */
+int                     virInterfaceStart         (virInterfacePtr interface);
+
+/*
+ * De-activate interface (call "ifdown")
+ */
+int                     virInterfaceStop          (virInterfacePtr interface);
+
+/*
+ * Interface information
+ */
+const char*             virInterfaceGetName       (virInterfacePtr interface);
 
+char *                  virInterfaceGetXMLDesc    (virInterfacePtr interface,
+                                                   int flags);
 /**
  * virStoragePool:
  *

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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]