[libvirt] [PATCH] test_driver: implement virConnectGetLibVersion

Ilias Stamatis posted 1 patch 2 weeks ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20190610123815.11076-1-stamatis.iliass@gmail.com
src/test/test_driver.c | 9 +++++++++
1 file changed, 9 insertions(+)

[libvirt] [PATCH] test_driver: implement virConnectGetLibVersion

Posted by Ilias Stamatis 2 weeks ago
Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
---
 src/test/test_driver.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 1aa79ce898..dc267b6ecd 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1453,6 +1453,14 @@ static char *testConnectGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED)
 }


+static int testConnectGetLibVersion(virConnectPtr conn ATTRIBUTE_UNUSED,
+                                    unsigned long *libVer)
+{
+    *libVer = LIBVIR_VERSION_NUMBER;
+    return 0;
+}
+
+
 static int testConnectIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED)
 {
     return 1;
@@ -6988,6 +6996,7 @@ static virHypervisorDriver testHypervisorDriver = {
     .connectClose = testConnectClose, /* 0.1.1 */
     .connectGetVersion = testConnectGetVersion, /* 0.1.1 */
     .connectGetHostname = testConnectGetHostname, /* 0.6.3 */
+    .connectGetLibVersion = testConnectGetLibVersion, /* 5.5.0 */
     .connectGetMaxVcpus = testConnectGetMaxVcpus, /* 0.3.2 */
     .nodeGetInfo = testNodeGetInfo, /* 0.1.1 */
     .nodeGetCPUStats = testNodeGetCPUStats, /* 2.3.0 */
--
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] test_driver: implement virConnectGetLibVersion

Posted by Erik Skultety 2 weeks ago
On Mon, Jun 10, 2019 at 02:38:15PM +0200, Ilias Stamatis wrote:
> Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
> ---
>  src/test/test_driver.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> index 1aa79ce898..dc267b6ecd 100644
> --- a/src/test/test_driver.c
> +++ b/src/test/test_driver.c
> @@ -1453,6 +1453,14 @@ static char *testConnectGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED)
>  }
>
>
> +static int testConnectGetLibVersion(virConnectPtr conn ATTRIBUTE_UNUSED,
> +                                    unsigned long *libVer)
> +{
> +    *libVer = LIBVIR_VERSION_NUMBER;
> +    return 0;
> +}

Test driver is implemented entirely on the client side, so implementing this
API is unnecessary, since the public API returns the value in the client
library if a specific driver doesn't implement it. If test driver was
implemented within the daemon, then it could be different, but in this case it
cannot, so NACK from my POV.

Regards,
Erik

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] test_driver: implement virConnectGetLibVersion

Posted by Peter Krempa 2 weeks ago
On Mon, Jun 10, 2019 at 15:34:57 +0200, Erik Skultety wrote:
> On Mon, Jun 10, 2019 at 02:38:15PM +0200, Ilias Stamatis wrote:
> > Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
> > ---
> >  src/test/test_driver.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> > index 1aa79ce898..dc267b6ecd 100644
> > --- a/src/test/test_driver.c
> > +++ b/src/test/test_driver.c
> > @@ -1453,6 +1453,14 @@ static char *testConnectGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED)
> >  }
> >
> >
> > +static int testConnectGetLibVersion(virConnectPtr conn ATTRIBUTE_UNUSED,
> > +                                    unsigned long *libVer)
> > +{
> > +    *libVer = LIBVIR_VERSION_NUMBER;
> > +    return 0;
> > +}
> 
> Test driver is implemented entirely on the client side, so implementing this
> API is unnecessary, since the public API returns the value in the client
> library if a specific driver doesn't implement it. If test driver was
> implemented within the daemon, then it could be different, but in this case it

Note that you can access the test driver also remotely:

$ virsh -c test+ssh://root@localhost/default 
root@localhost's password: 
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # list --all
 Id   Name   State
----------------------
 1    test   running

virsh # version --daemon
Compiled against library: libvirt 5.1.0
Using library: libvirt 5.1.0
Using API: TEST 5.1.0
Running hypervisor: TEST 0.0.2
Running against daemon: 5.5.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] test_driver: implement virConnectGetLibVersion

Posted by Erik Skultety 2 weeks ago
On Mon, Jun 10, 2019 at 03:57:04PM +0200, Peter Krempa wrote:
> On Mon, Jun 10, 2019 at 15:34:57 +0200, Erik Skultety wrote:
> > On Mon, Jun 10, 2019 at 02:38:15PM +0200, Ilias Stamatis wrote:
> > > Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
> > > ---
> > >  src/test/test_driver.c | 9 +++++++++
> > >  1 file changed, 9 insertions(+)
> > >
> > > diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> > > index 1aa79ce898..dc267b6ecd 100644
> > > --- a/src/test/test_driver.c
> > > +++ b/src/test/test_driver.c
> > > @@ -1453,6 +1453,14 @@ static char *testConnectGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED)
> > >  }
> > >
> > >
> > > +static int testConnectGetLibVersion(virConnectPtr conn ATTRIBUTE_UNUSED,
> > > +                                    unsigned long *libVer)
> > > +{
> > > +    *libVer = LIBVIR_VERSION_NUMBER;
> > > +    return 0;
> > > +}
> >
> > Test driver is implemented entirely on the client side, so implementing this
> > API is unnecessary, since the public API returns the value in the client
> > library if a specific driver doesn't implement it. If test driver was
> > implemented within the daemon, then it could be different, but in this case it
>
> Note that you can access the test driver also remotely:

Right, but it doesn't change anything in that case either, the value will be
filled in on the destination.

Erik

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] test_driver: implement virConnectGetLibVersion

Posted by Ilias Stamatis 2 weeks ago
On Mon, Jun 10, 2019 at 3:35 PM Erik Skultety <eskultet@redhat.com> wrote:
>
> On Mon, Jun 10, 2019 at 02:38:15PM +0200, Ilias Stamatis wrote:
> > Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
> > ---
> >  src/test/test_driver.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> > index 1aa79ce898..dc267b6ecd 100644
> > --- a/src/test/test_driver.c
> > +++ b/src/test/test_driver.c
> > @@ -1453,6 +1453,14 @@ static char *testConnectGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED)
> >  }
> >
> >
> > +static int testConnectGetLibVersion(virConnectPtr conn ATTRIBUTE_UNUSED,
> > +                                    unsigned long *libVer)
> > +{
> > +    *libVer = LIBVIR_VERSION_NUMBER;
> > +    return 0;
> > +}
>
> Test driver is implemented entirely on the client side, so implementing this
> API is unnecessary, since the public API returns the value in the client
> library if a specific driver doesn't implement it. If test driver was
> implemented within the daemon, then it could be different, but in this case it
> cannot, so NACK from my POV.
>
> Regards,
> Erik

That makes sense. So let's not touch this then.

Ilias

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list