Re: [PATCH 04/20] test: Implement virConnectSupportsFeature

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

 




On 03/08/2018 07:20 AM, Marc Hartmayer wrote:
> Implement virConnectSupportsFeature for the test driver as this API is
> used by various API functions (the functions usually use the macro
> VIR_DRV_SUPPORTS_FEATURE for calling virConnectSupportsFeature).
> 
> Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxxxxxxx>
> Reviewed-by: Bjoern Walk <bwalk@xxxxxxxxxxxxxxxxxx>
> Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxxxxxxx>
> ---
>  src/test/test_driver.c | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> index 043caa976274..203358c7017f 100644
> --- a/src/test/test_driver.c
> +++ b/src/test/test_driver.c
> @@ -6829,6 +6829,32 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
>  }
>  
>  
> +static int
> +testConnectSupportsFeature(virConnectPtr conn ATTRIBUTE_UNUSED,
> +                           int feature)
> +{
> +    switch ((virDrvFeature) feature) {
> +    case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK:
> +        return 1;

Not that it makes a difference, but since
src/remote/remote_daemon_dispatch.c returns 1 for
VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK always like
VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK used to before patch 2, then does
returning 1 here really matter?

Perhaps why Nikolay added to remoteDispatchConnectSupportsFeature since
commit id '03722957' was the last to add some new feature bit...

[yes, I'm still a bit mystified about how all this works - so I'm
learning a bit as I go... Still not clear why the same API returns 1 for
VIR_DRV_FEATURE_FD_PASSING always].


So while it seems reasonable, if you return 0, then what happens? Mostly
curious, what's here looks fine to me otherwise.

A weak,

Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx>

John

> +    case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK:
> +    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_PARAMS:
> +    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_TYPED_PARAM_STRING:
> +    case VIR_DRV_FEATURE_XML_MIGRATABLE:
> +    default:
> +        return 0;
> +    }
> +}
> +
>  
>  static virHypervisorDriver testHypervisorDriver = {
>      .name = "Test",
> @@ -6837,6 +6863,7 @@ static virHypervisorDriver testHypervisorDriver = {
>      .connectGetVersion = testConnectGetVersion, /* 0.1.1 */
>      .connectGetHostname = testConnectGetHostname, /* 0.6.3 */
>      .connectGetMaxVcpus = testConnectGetMaxVcpus, /* 0.3.2 */
> +    .connectSupportsFeature = testConnectSupportsFeature, /* 4.2.0 */
>      .nodeGetInfo = testNodeGetInfo, /* 0.1.1 */
>      .nodeGetCPUStats = testNodeGetCPUStats, /* 2.3.0 */
>      .nodeGetFreeMemory = testNodeGetFreeMemory, /* 2.3.0 */
> 

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

  Powered by Linux