]> xenbits.xensource.com Git - libvirt.git/commitdiff
virDriverFeatureIsGlobal: Handle VIR_DRV_FEATURE_REMOTE
authorPeter Krempa <pkrempa@redhat.com>
Wed, 16 Feb 2022 12:20:53 +0000 (13:20 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 17 Feb 2022 12:15:46 +0000 (13:15 +0100)
VIR_DRV_FEATURE_REMOTE is a special flag which is asserted only when the
connection is remote. All drivers implementing it must return 0 for it
to work. Handle it in the global handler and add a comment why.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
src/driver.c

index 8c70662ccbd2d805a9578ba860d11722765428c7..b45040008482d5c308ea1d7096a2ba423efccc1f 100644 (file)
@@ -333,10 +333,18 @@ virConnectValidateURIPath(const char *uriPath,
  */
 bool
 virDriverFeatureIsGlobal(virDrvFeature feat,
-                         int *supported G_GNUC_UNUSED)
+                         int *supported)
 
 {
     switch (feat) {
+    /* This is a special case where the generated remote driver dispatcher
+     * function intercepts this specific flag and returns '1'. Thus any local
+     * implementation must return 0, so that the return value properly reflects
+     * whether we are going through the remote driver */
+    case VIR_DRV_FEATURE_REMOTE:
+        *supported = 0;
+        return true;
+
     case VIR_DRV_FEATURE_TYPED_PARAM_STRING:
     case VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER:
     case VIR_DRV_FEATURE_FD_PASSING:
@@ -350,7 +358,6 @@ virDriverFeatureIsGlobal(virDrvFeature feat,
     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: