On 4/2/25 19:27, Roman Bogorodskiy wrote:
> Add support for interface type 'network'. While bridge remains the only
> supported options for networks in bhyve, supporting interface type
> 'network' allows easier configuration and makes domain XMLs more
> compatible with the other drivers.
> 
> While here, update the error message for the unsupported interface type
> to print the requested network type string instead of an integer to make
> it more user-friendly.
> 
> Signed-off-by: Roman Bogorodskiy <bogorods...@gmail.com>
> ---
>  src/bhyve/bhyve_command.c | 44 ++++++++++++++++++++++++++++++++++-----
>  src/bhyve/bhyve_process.c | 30 +++++++++++++++++++-------
>  2 files changed, 62 insertions(+), 12 deletions(-)
> 
> diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
> index bc287307c8..123d81699f 100644
> --- a/src/bhyve/bhyve_command.c
> +++ b/src/bhyve/bhyve_command.c
> @@ -2,6 +2,7 @@
>   * bhyve_command.c: bhyve command generation
>   *
>   * Copyright (C) 2014 Roman Bogorodskiy
> + * Copyright (C) 2025 The FreeBSD Foundation
>   *
>   * This library is free software; you can redistribute it and/or
>   * modify it under the terms of the GNU Lesser General Public
> @@ -26,6 +27,7 @@
>  #include "bhyve_domain.h"
>  #include "bhyve_conf.h"
>  #include "bhyve_driver.h"
> +#include "domain_validate.h"
>  #include "datatypes.h"
>  #include "viralloc.h"
>  #include "virfile.h"
> @@ -40,7 +42,7 @@
>  VIR_LOG_INIT("bhyve.bhyve_command");
>  
>  static int
> -bhyveBuildNetArgStr(const virDomainDef *def,
> +bhyveBuildNetArgStr(virDomainDef *def,

Took me a while to figure out why this is needed. It's simply because
virDomainNetDefActualToNetworkPort() and virDomainNetDefToNetworkPort()
accept virDomainDef* though they never modify the domain config. So they
should accept const pointer instead. I think I have a good candidate to
fix that.

>                      virDomainNetDef *net,
>                      struct _bhyveConn *driver,
>                      virCommand *cmd,

Reviewed-by: Michal Privoznik <mpriv...@redhat.com>

Michal

Reply via email to