Re: [PATCH 08/16] conf: Enable cold-plug of a mediated device

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

 



On 06.02.2017 13:19, Erik Skultety wrote:
> This merely introduces virDomainHostdevMatchSubsysMediatedDev method that
> is supposed to check whether device being cold-plugged does not already
> exist in the domain configuration.
> 
> Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 9663350..aa1bd68 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -14192,6 +14192,24 @@ virDomainHostdevMatchSubsysSCSIiSCSI(virDomainHostdevDefPtr first,
>  }
>  
>  static int
> +virDomainHostdevMatchSubsysMediatedDev(virDomainHostdevDefPtr first,
> +                                       virDomainHostdevDefPtr second)
> +{
> +    virDomainHostdevSubsysMediatedDevPtr first_mdevsrc =
> +        &first->source.subsys.u.mdev;
> +    virDomainHostdevSubsysMediatedDevPtr second_mdevsrc =
> +        &second->source.subsys.u.mdev;

Had you gone with a/b, a_src/b_src this would nicely fit onto two lines.

> +
> +    if (STREQ(first_mdevsrc->uuidstr, second_mdevsrc->uuidstr) &&
> +        first_mdevsrc->addr.domain == second_mdevsrc->addr.domain &&
> +        first_mdevsrc->addr.bus == second_mdevsrc->addr.bus &&
> +        first_mdevsrc->addr.slot == second_mdevsrc->addr.slot &&
> +        first_mdevsrc->addr.function == second_mdevsrc->addr.function)

Huh, we don't have virPCIAddrMatch or virPCIAddrCompare. :(

> +        return 1;
> +    return 0;
> +}
> +
> +static int
>  virDomainHostdevMatchSubsys(virDomainHostdevDefPtr a,
>                              virDomainHostdevDefPtr b)
>  {
> @@ -14222,6 +14240,7 @@ virDomainHostdevMatchSubsys(virDomainHostdevDefPtr a,
>          else
>              return 0;
>      case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
> +        return virDomainHostdevMatchSubsysMediatedDev(a, b);
>      case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
>          return 0;
>      }
> 

Michal

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