[libvirt] [PATCH V2 1/2] Fix building domain def in securityselinuxtest

Erik Skultety eskultet at redhat.com
Thu Aug 17 07:55:25 UTC 2017


On Wed, Aug 16, 2017 at 05:54:07PM -0600, Jim Fehlig wrote:
> The virDomainDef created by testBuildDomainDef in securityselinuxtest
> adds a seclabel but does not increment nseclabels. Also, it should
> populate seclabel->model with 'selinux'.
>
> While at it, use the secdef itself to populate values instead of
> the indirection through def->seclabels[0].
>
> Signed-off-by: Jim Fehlig <jfehlig at suse.com>
> ---
>  tests/securityselinuxtest.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/tests/securityselinuxtest.c b/tests/securityselinuxtest.c
> index 767b6cc02..f6143fb06 100644
> --- a/tests/securityselinuxtest.c
> +++ b/tests/securityselinuxtest.c
> @@ -73,24 +73,28 @@ testBuildDomainDef(bool dynamic,
>      if (!(def = virDomainDefNew()))
>          goto error;
>
> +    def->virtType = VIR_DOMAIN_VIRT_KVM;
>      if (VIR_ALLOC_N(def->seclabels, 1) < 0)
>          goto error;
>
> +    def->nseclabels++;

Personally, I'd put the increment after assigning secdef to the domain
definition, but the memory chunk is zeroed out, so it doesn't matter at all.

ACK

Erik




More information about the libvir-list mailing list