]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
network: Implement virConnectSupportsFeature()
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 16 Mar 2021 09:32:59 +0000 (10:32 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 25 Mar 2021 09:10:14 +0000 (10:10 +0100)
So far, it was not needed, but shortly a client will want to know
whether virNetworkUpdate() API is fixed or not. See next commits
for more info.

Side note, this driver's implementation is called only when using
sub-driver's connection, i.e. "network:///system". For any other
URI the corresponding hypervisor's driver callback is called.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/network/bridge_driver.c

index 3c7a49b115226fed3a42c291f4b6f0f92db12743..7c9e36c6253c2ac0a72b32e4b53acd7f92114273 100644 (file)
@@ -944,6 +944,35 @@ static int networkConnectIsAlive(virConnectPtr conn G_GNUC_UNUSED)
 }
 
 
+static int
+networkConnectSupportsFeature(virConnectPtr conn, int feature)
+{
+    if (virConnectSupportsFeatureEnsureACL(conn) < 0)
+        return -1;
+
+    switch ((virDrvFeature) feature) {
+    case VIR_DRV_FEATURE_MIGRATION_V2:
+    case VIR_DRV_FEATURE_MIGRATION_V3:
+    case VIR_DRV_FEATURE_MIGRATION_P2P:
+    case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION:
+    case VIR_DRV_FEATURE_FD_PASSING:
+    case VIR_DRV_FEATURE_TYPED_PARAM_STRING:
+    case VIR_DRV_FEATURE_XML_MIGRATABLE:
+    case VIR_DRV_FEATURE_MIGRATION_OFFLINE:
+    case VIR_DRV_FEATURE_MIGRATION_PARAMS:
+    case VIR_DRV_FEATURE_MIGRATION_DIRECT:
+    case VIR_DRV_FEATURE_MIGRATION_V1:
+    case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE:
+    case VIR_DRV_FEATURE_REMOTE:
+    case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK:
+    case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK:
+    default:
+        return 0;
+    }
+}
+
+
+
 static char *
 networkBuildDnsmasqLeaseTime(virNetworkDHCPLeaseTimeDefPtr lease)
 {
@@ -5630,6 +5659,7 @@ static virHypervisorDriver networkHypervisorDriver = {
     .connectIsEncrypted = networkConnectIsEncrypted, /* 4.1.0 */
     .connectIsSecure = networkConnectIsSecure, /* 4.1.0 */
     .connectIsAlive = networkConnectIsAlive, /* 4.1.0 */
+    .connectSupportsFeature = networkConnectSupportsFeature, /* 7.2.0 */
 };