Re: [PATCH 3/8] driver: introduce a driver method for probing default URIs

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

 



On Wed, Apr 11, 2018 at 02:08:51PM +0200, Michal Privoznik wrote:
> On 04/09/2018 05:45 PM, Daniel P. Berrangé wrote:
> > Currently the virDrvConnectOpen method is supposed to handle both
> > opening an explicit URI and auto-probing a driver if no URI is
> > given. Introduce a dedicated virDrvConnectURIProbe method to enable the
> > probing functionality to be split from the driver opening functionality.
> > 
> > It is still possible for NULL to be passed to the virDrvConnectOpen
> > method after this change, because the remote driver needs special
> > handling to enable probing of the URI against a remote libvirtd daemon.
> > 
> > Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
> > ---
> >  docs/hvsupport.pl          |  6 +++---
> >  src/bhyve/bhyve_driver.c   | 18 +++++++++++++-----
> >  src/driver-hypervisor.h    |  4 ++++
> >  src/libvirt.c              | 13 +++++++++++++
> >  src/libxl/libxl_driver.c   | 17 ++++++++++++-----
> >  src/lxc/lxc_driver.c       | 17 ++++++++++++-----
> >  src/openvz/openvz_driver.c | 24 ++++++++++++++++--------
> >  src/qemu/qemu_driver.c     | 30 +++++++++++++++++++++---------
> >  src/uml/uml_driver.c       | 20 +++++++++++++-------
> >  src/vbox/vbox_common.c     | 13 ++++++++++---
> >  10 files changed, 117 insertions(+), 45 deletions(-)
> > 
> > diff --git a/docs/hvsupport.pl b/docs/hvsupport.pl
> > index fc6eb1f152..a2b980c502 100755
> > --- a/docs/hvsupport.pl
> > +++ b/docs/hvsupport.pl
> > @@ -184,7 +184,7 @@ foreach my $drivertable (@drivertable) {
> >                  my $api;
> >                  if (exists $apis{"vir$name"}) {
> >                      $api = "vir$name";
> > -                } elsif ($name =~ /\w+(Open|Close)/) {
> > +                } elsif ($name =~ /\w+(Open|Close|URIProbe)/) {
> >                      next;
> >                  } else {
> >                      die "driver $name does not have a public API";
> > @@ -241,12 +241,12 @@ foreach my $src (@srcs) {
> >  
> >                  next if $api eq "no" || $api eq "name";
> >  
> > -                die "Method $meth in $src is missing version" unless defined $vers;
> > +                die "Method $meth in $src is missing version" unless defined $vers || $api eq "connectURIProbe";
> >  
> >                  die "Driver method for $api is NULL in $src" if $meth eq "NULL";
> >  
> >                  if (!exists($groups{$ingrp}->{apis}->{$api})) {
> > -                    next if $api =~ /\w(Open|Close)/;
> > +                    next if $api =~ /\w(Open|Close|URIProbe)/;
> >  
> >                      die "Found unexpected method $api in $ingrp\n";
> >                  }
> > diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
> > index 849d3abcd3..a0bc400480 100644
> > --- a/src/bhyve/bhyve_driver.c
> > +++ b/src/bhyve/bhyve_driver.c
> > @@ -180,6 +180,17 @@ bhyveDomObjFromDomain(virDomainPtr domain)
> >      return vm;
> >  }
> >  
> > +
> > +static int
> > +bhyveConnectURIProbe(char **uri)
> > +{
> > +    if (bhyve_driver == NULL)
> > +        return 0;
> > +
> > +    return VIR_STRDUP(*uri, "bhyve:///system");
> > +}
> 
> make check fails because it thinks this function (and others) is missing
> ACL check.

IMHO, we don't need ACLs on this. This isn't doing anything functional,
and the caller will trigger  the .connectOpen method next which already
has an ACL check. So I think we just whitelist it

diff --git a/src/check-aclrules.pl b/src/check-aclrules.pl
index 5b6c711dc8..8b146d8dba 100755
--- a/src/check-aclrules.pl
+++ b/src/check-aclrules.pl
@@ -59,6 +59,7 @@ my %whitelist = (
     "storageClose" => 1,
     "interfaceOpen" => 1,
     "interfaceClose" => 1,
+    "connectURIProbe" => 1,
     );
 
 # Temp hack - remove it once xen driver is fixed


Heh, and that last comment tells me we've got some stuff that can be
purged now :-)

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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