]> xenbits.xensource.com Git - xen-guest-agent.git/commitdiff
xenstore_schema_rfc: propose using iface number as key
authorYann Dirson <yann.dirson@vates.fr>
Tue, 21 Nov 2023 09:40:51 +0000 (10:40 +0100)
committerYann Dirson <yann.dirson@vates.fr>
Fri, 8 Dec 2023 09:59:46 +0000 (10:59 +0100)
This is more stable than names, and requires less bookkeeping in the
agent.

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
doc/structure.md
src/xenstore_schema_rfc.rs

index 624a0fde5aa89c955d70b36cf5f3203a3072c38f..156d43449e56aee64b19ec225e106e6f587b9de1 100644 (file)
@@ -229,3 +229,21 @@ data = ""
       ipv6 = ""
         1234000000000000000000004578ABCD = "1234::4578:abcd"
 ```
+
+#### Proposal 3
+
+Interface names are not necessarily stable, as they can be renamed,
+and the OS usually has a non-recycled unique identifier for interfaces
+(an index for POSIX systems, [a GUID for Windows
+systems](https://learn.microsoft.com/en-us/windows/win32/network-interfaces)).
+We could thus use them in the "Proposal 2" schema, which will require
+less bookkeeping in the guest agent, and avoid unnecessary xenstore
+churn:
+
+```
+data = ""
+  net = ""
+    42 = "eth0"
+      mac = ""
+...
+```
index e9248d7d1506fbb9f87aacade0d4d345b4e1c3b2..50cbb041599fe4a6658d448c6da31f0aac42ee93 100644 (file)
@@ -41,7 +41,7 @@ impl XenstoreSchema for Schema {
 
     #[allow(clippy::useless_format)]
     fn publish_netevent(&mut self, event: &NetEvent) -> io::Result<()> {
-        let iface_id = &event.iface.name;
+        let iface_id = &event.iface.index;
         let xs_iface_prefix = format!("data/net/{iface_id}");
         match &event.op {
             NetEventOp::AddIp(address) => {