From nobody Fri Nov 1 00:10:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1645034378; cv=none; d=zohomail.com; s=zohoarc; b=esXKv4zeADI5tPATh/WFt5WUTv2zOMdPXaPb0kQ2rXvfQP1sCdEYWe/EDaQuA/mIcSNSW93T6KMX4m9mBKHu7mJu/Ibqh++zUyqcfcUNSyNRkJNQTCKlkb6zbs4CCNHNNaIiNKR3GB+lcrVCr21RZKBNvmKVOEGXiim92+SNnyk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1645034378; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=n31F2QRl/TfobQAXS47fodi2ARkOLryfEr/othcHPoE=; b=Q++vYDD+D3sKAVihkxwNZA9w062iFPapM4h6TDEYy4d18qgsXFHNw/xvlV/zd/99jYuyx78Yp4325+dR5vNuc4OALKAjAJ7yp4LyCpDbrt4UUO2pE8zuUpZlt5HXbJSSLrkFiR5nn+VYbTSwYHhNOkv/l5u4Pe0eOye7NghjuAI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1645034378823889.5006344590345; Wed, 16 Feb 2022 09:59:38 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-160-_10NYzFoPYqQ6ixJDgmQfg-1; Wed, 16 Feb 2022 12:59:36 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C3D8A343C9; Wed, 16 Feb 2022 17:59:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DD4587CD70; Wed, 16 Feb 2022 17:59:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B4E184CA93; Wed, 16 Feb 2022 17:59:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21GHwIcW010512 for ; Wed, 16 Feb 2022 12:58:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id CFFCF8379F; Wed, 16 Feb 2022 17:58:18 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.192.127]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0D577838CE for ; Wed, 16 Feb 2022 17:58:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645034377; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=n31F2QRl/TfobQAXS47fodi2ARkOLryfEr/othcHPoE=; b=TE8nVd5i/hugYF0KO1SvGFs+EcAmyeAFZQ9uzU3KGrdtOST0IQH1EMzQ61cjo8xdJTy/yu x3Ec/1S+8t8du02SumiJmpbX9fxCSUwjx9sm4DdLO7bgVTuyvlpZ9U9/J9WU34XYqb1vXf Cl3OAcR9mGPOgTO7IqLL+1p9JIOCc6k= X-MC-Unique: _10NYzFoPYqQ6ixJDgmQfg-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH] drivers: Group global feature together Date: Wed, 16 Feb 2022 18:58:04 +0100 Message-Id: <20220216175804.30211-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1645034379729100001 Content-Type: text/plain; charset="utf-8" All these features are supposed to be handled by the call to virDriverFeatureIsGlobal() placed right above the switch statement, so group them together and add a comment. If any of these features is actually encountered as part of the switch statements, that means there's a bug in the driver and we should error out. Signed-off-by: Andrea Bolognani --- Applies on top of [PATCH 0/8] driver: Fix handling of driver feature flags https://listman.redhat.com/archives/libvir-list/2022-February/msg00644.ht= ml src/ch/ch_driver.c | 13 +++++++------ src/esx/esx_driver.c | 21 +++++++++++---------- src/libxl/libxl_driver.c | 16 +++++++++------- src/lxc/lxc_driver.c | 11 ++++++----- src/network/bridge_driver.c | 15 ++++++++------- src/openvz/openvz_driver.c | 16 +++++++++------- src/qemu/qemu_driver.c | 16 +++++++++------- 7 files changed, 59 insertions(+), 49 deletions(-) diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index ac9298c0b5..9cbd7b71df 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -928,23 +928,24 @@ chConnectSupportsFeature(virConnectPtr conn, return supported; =20 switch ((virDrvFeature) feature) { + case VIR_DRV_FEATURE_REMOTE: + case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: + case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: case VIR_DRV_FEATURE_TYPED_PARAM_STRING: case VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER: - return 1; + case VIR_DRV_FEATURE_FD_PASSING: + /* Should have already been handled by virDriverFeatureIsGloba= l() */ + return -1; 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_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; } diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 3149f3e963..6e5f9c8cc1 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -1024,7 +1024,17 @@ esxConnectSupportsFeature(virConnectPtr conn, int fe= ature) return supported; =20 switch ((virDrvFeature) feature) { - case VIR_DRV_FEATURE_MIGRATION_V1: + case VIR_DRV_FEATURE_REMOTE: + case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: + case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: + case VIR_DRV_FEATURE_TYPED_PARAM_STRING: + case VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER: + case VIR_DRV_FEATURE_FD_PASSING: + /* Should have already been handled by virDriverFeatureIsGlobal() = */ + return -1; + + case VIR_DRV_FEATURE_MIGRATION_V1: supportsVMotion =3D esxSupportsVMotion(priv); =20 if (supportsVMotion =3D=3D esxVI_Boolean_Undefined) @@ -1034,10 +1044,6 @@ esxConnectSupportsFeature(virConnectPtr conn, int fe= ature) return priv->vCenter && supportsVMotion =3D=3D esxVI_Boolean_True ? 1 : 0; =20 - case VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER: - return 1; - - case VIR_DRV_FEATURE_FD_PASSING: case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION: case VIR_DRV_FEATURE_MIGRATION_DIRECT: case VIR_DRV_FEATURE_MIGRATION_OFFLINE: @@ -1045,11 +1051,6 @@ esxConnectSupportsFeature(virConnectPtr conn, int fe= ature) case VIR_DRV_FEATURE_MIGRATION_PARAMS: case VIR_DRV_FEATURE_MIGRATION_V2: case VIR_DRV_FEATURE_MIGRATION_V3: - 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: - case VIR_DRV_FEATURE_TYPED_PARAM_STRING: case VIR_DRV_FEATURE_XML_MIGRATABLE: default: return 0; diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 478ab3e941..46596978d4 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -5706,22 +5706,24 @@ libxlConnectSupportsFeature(virConnectPtr conn, int= feature) return supported; =20 switch ((virDrvFeature) feature) { - case VIR_DRV_FEATURE_MIGRATION_V3: + case VIR_DRV_FEATURE_REMOTE: + case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: + case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: case VIR_DRV_FEATURE_TYPED_PARAM_STRING: + case VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER: + case VIR_DRV_FEATURE_FD_PASSING: + /* Should have already been handled by virDriverFeatureIsGlobal() = */ + return -1; + case VIR_DRV_FEATURE_MIGRATION_V3: case VIR_DRV_FEATURE_MIGRATION_PARAMS: case VIR_DRV_FEATURE_MIGRATION_P2P: - case VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER: return 1; - case VIR_DRV_FEATURE_FD_PASSING: case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION: case VIR_DRV_FEATURE_MIGRATION_DIRECT: case VIR_DRV_FEATURE_MIGRATION_OFFLINE: case VIR_DRV_FEATURE_MIGRATION_V1: case VIR_DRV_FEATURE_MIGRATION_V2: - 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: case VIR_DRV_FEATURE_XML_MIGRATABLE: default: return 0; diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 020ec257ae..023292a75a 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1627,10 +1627,15 @@ lxcConnectSupportsFeature(virConnectPtr conn, int f= eature) return supported; =20 switch ((virDrvFeature) feature) { + case VIR_DRV_FEATURE_REMOTE: + case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: + case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: case VIR_DRV_FEATURE_TYPED_PARAM_STRING: case VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER: - return 1; case VIR_DRV_FEATURE_FD_PASSING: + /* Should have already been handled by virDriverFeatureIsGlobal() = */ + return -1; case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION: case VIR_DRV_FEATURE_MIGRATION_DIRECT: case VIR_DRV_FEATURE_MIGRATION_OFFLINE: @@ -1639,10 +1644,6 @@ lxcConnectSupportsFeature(virConnectPtr conn, int fe= ature) case VIR_DRV_FEATURE_MIGRATION_V1: case VIR_DRV_FEATURE_MIGRATION_V2: case VIR_DRV_FEATURE_MIGRATION_V3: - 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: case VIR_DRV_FEATURE_XML_MIGRATABLE: default: return 0; diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index d6ae05360b..559600d2af 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -866,23 +866,24 @@ networkConnectSupportsFeature(virConnectPtr conn, int= feature) return supported; =20 switch ((virDrvFeature) feature) { + case VIR_DRV_FEATURE_REMOTE: + case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: + case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: + case VIR_DRV_FEATURE_TYPED_PARAM_STRING: case VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER: - return 1; + case VIR_DRV_FEATURE_FD_PASSING: + /* Should have already been handled by virDriverFeatureIsGlobal() = */ + return -1; 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; } diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index aa1db09540..c034fd5af9 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -1944,22 +1944,24 @@ openvzConnectSupportsFeature(virConnectPtr conn G_G= NUC_UNUSED, int feature) return supported; =20 switch ((virDrvFeature) feature) { + case VIR_DRV_FEATURE_REMOTE: + case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: + case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: + case VIR_DRV_FEATURE_TYPED_PARAM_STRING: + case VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER: + case VIR_DRV_FEATURE_FD_PASSING: + /* Should have already been handled by virDriverFeatureIsGlobal() = */ + return -1; case VIR_DRV_FEATURE_MIGRATION_PARAMS: case VIR_DRV_FEATURE_MIGRATION_V3: - case VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER: return 1; - case VIR_DRV_FEATURE_FD_PASSING: case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION: case VIR_DRV_FEATURE_MIGRATION_DIRECT: case VIR_DRV_FEATURE_MIGRATION_OFFLINE: case VIR_DRV_FEATURE_MIGRATION_P2P: case VIR_DRV_FEATURE_MIGRATION_V1: case VIR_DRV_FEATURE_MIGRATION_V2: - 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: - case VIR_DRV_FEATURE_TYPED_PARAM_STRING: case VIR_DRV_FEATURE_XML_MIGRATABLE: default: return 0; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f1f708e511..433ba09745 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1182,23 +1182,25 @@ qemuConnectSupportsFeature(virConnectPtr conn, int = feature) return supported; =20 switch ((virDrvFeature) feature) { + case VIR_DRV_FEATURE_REMOTE: + case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: + case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: + case VIR_DRV_FEATURE_TYPED_PARAM_STRING: + case VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER: + case VIR_DRV_FEATURE_FD_PASSING: + /* Should have already been handled by virDriverFeatureIsGlobal() = */ + return -1; 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_NETWORK_UPDATE_HAS_CORRECT_ORDER: return 1; 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; } --=20 2.35.1