[libvirt] [PATCH 1/6] bhyve: Add various vir*Flags API

Eric Blake eblake at redhat.com
Tue Jul 9 15:43:05 UTC 2019


On 7/8/19 10:36 PM, Eric Blake wrote:
> Even though we don't accept any flags, it is unfriendly to callers
> that use the modern API to have to fall back to the flag-free API.
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  src/bhyve/bhyve_driver.c | 38 ++++++++++++++++++++++++++++++++------
>  1 file changed, 32 insertions(+), 6 deletions(-)
> 
> diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
> index 061888ab0b..ffda7853b8 100644

> 
> -    if (virDomainUndefineEnsureACL(domain->conn, vm->def) < 0)
> +    if (virDomainUndefineFlagsEnsureACL(domain->conn, vm->def) < 0)

Good,


> 
> -    if (virDomainDestroyEnsureACL(dom->conn, vm->def) < 0)
> +    if (virDomainDestroyFlagsEnsureACL(dom->conn, vm->def) < 0)

Good,


> 
> -    if (virDomainShutdownEnsureACL(dom->conn, vm->def) < 0)
> +    if (virDomainShutdownFlagsEnsureACL(dom->conn, vm->def) < 0)

Broke the build on BSD.  'make syntax-check' was enough to catch on
Linux that I had to rename the functions, but was insufficient to point
out which functions require 2 vs. 3 arguments for security checks based
on flags.  I'm pushing the obvious build-breaker fix:

commit 846fe076ca929bf305fe06380d639433cd2c5b2f
Author: Eric Blake <eblake at redhat.com>
Date:   Tue Jul 9 10:36:31 2019 -0500

    bhyve: Fix build

    Continuous integration caught that although 'make syntax-check' was
    sufficient to let me be aware that I had to change bhyve to use
    s/virDomainShutdownEnsureACL/virDomainShutdownFlagsEnsureACL/, it was
    not sufficient to note which ACL functions require 2 vs. 3 arguments
    for flag validation.

    Fixes: eded8aad
    Signed-off-by: Eric Blake <eblake at redhat.com>

diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index ffda7853b8..4ce9ef0b95 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -1027,7 +1027,7 @@ bhyveDomainShutdownFlags(virDomainPtr dom,
unsigned int flags)
     if (!(vm = bhyveDomObjFromDomain(dom)))
         goto cleanup;

-    if (virDomainShutdownFlagsEnsureACL(dom->conn, vm->def) < 0)
+    if (virDomainShutdownFlagsEnsureACL(dom->conn, vm->def, flags) < 0)
         goto cleanup;

     if (virDomainObjCheckActive(vm) < 0)


-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190709/47c97d6f/attachment-0001.sig>


More information about the libvir-list mailing list