[libvirt] [PATCH] test_driver: implement virDomainGetHostname

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

[libvirt] [PATCH] test_driver: implement virDomainGetHostname

Posted by Ilias Stamatis 15 weeks ago
Always return "domain_name" + "host".

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

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 2f58a1da95..aad7bb6036 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1910,6 +1910,27 @@ static int testDomainReboot(virDomainPtr domain,
     return ret;
 }

+static char *
+testDomainGetHostname(virDomainPtr domain,
+                      unsigned int flags)
+{
+    char *ret = NULL;
+    virDomainObjPtr vm = NULL;
+
+    virCheckFlags(0, NULL);
+
+    if (!(vm = testDomObjFromDomain(domain)))
+        goto cleanup;
+
+    if (virDomainObjCheckActive(vm) < 0)
+        goto cleanup;
+
+    ignore_value(virAsprintf(&ret, "%shost", domain->name));
+
+ cleanup:
+    return ret;
+}
+
 static int testDomainGetInfo(virDomainPtr domain,
                              virDomainInfoPtr info)
 {
@@ -6950,6 +6971,7 @@ static virHypervisorDriver testHypervisorDriver = {
     .domainGetMaxMemory = testDomainGetMaxMemory, /* 0.1.4 */
     .domainSetMaxMemory = testDomainSetMaxMemory, /* 0.1.1 */
     .domainSetMemory = testDomainSetMemory, /* 0.1.4 */
+    .domainGetHostname = testDomainGetHostname, /* 5.5.0 */
     .domainGetInfo = testDomainGetInfo, /* 0.1.1 */
     .domainGetState = testDomainGetState, /* 0.9.2 */
     .domainGetTime = testDomainGetTime, /* 5.4.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 virDomainGetHostname

Posted by Ilias Stamatis 15 weeks ago
On Fri, May 31, 2019 at 4:31 PM Ilias Stamatis
<stamatis.iliass@gmail.com> wrote:
>
> Always return "domain_name" + "host".
>
> Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
> ---
>  src/test/test_driver.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>
> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> index 2f58a1da95..aad7bb6036 100644
> --- a/src/test/test_driver.c
> +++ b/src/test/test_driver.c
> @@ -1910,6 +1910,27 @@ static int testDomainReboot(virDomainPtr domain,
>      return ret;
>  }
>
> +static char *
> +testDomainGetHostname(virDomainPtr domain,
> +                      unsigned int flags)
> +{
> +    char *ret = NULL;
> +    virDomainObjPtr vm = NULL;
> +
> +    virCheckFlags(0, NULL);
> +
> +    if (!(vm = testDomObjFromDomain(domain)))
> +        goto cleanup;
> +
> +    if (virDomainObjCheckActive(vm) < 0)
> +        goto cleanup;
> +
> +    ignore_value(virAsprintf(&ret, "%shost", domain->name));
> +
> + cleanup:

Oops, missing "virDomainObjEndAPI(&vm);" here.

> +    return ret;
> +}
> +
>  static int testDomainGetInfo(virDomainPtr domain,
>                               virDomainInfoPtr info)
>  {
> @@ -6950,6 +6971,7 @@ static virHypervisorDriver testHypervisorDriver = {
>      .domainGetMaxMemory = testDomainGetMaxMemory, /* 0.1.4 */
>      .domainSetMaxMemory = testDomainSetMaxMemory, /* 0.1.1 */
>      .domainSetMemory = testDomainSetMemory, /* 0.1.4 */
> +    .domainGetHostname = testDomainGetHostname, /* 5.5.0 */
>      .domainGetInfo = testDomainGetInfo, /* 0.1.1 */
>      .domainGetState = testDomainGetState, /* 0.9.2 */
>      .domainGetTime = testDomainGetTime, /* 5.4.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 virDomainGetHostname

Posted by Erik Skultety 14 weeks ago
On Fri, May 31, 2019 at 05:38:44PM +0200, Ilias Stamatis wrote:
> On Fri, May 31, 2019 at 4:31 PM Ilias Stamatis
> <stamatis.iliass@gmail.com> wrote:
> >
> > Always return "domain_name" + "host".
> >
> > Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
> > ---
> >  src/test/test_driver.c | 22 ++++++++++++++++++++++
> >  1 file changed, 22 insertions(+)
> >
> > diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> > index 2f58a1da95..aad7bb6036 100644
> > --- a/src/test/test_driver.c
> > +++ b/src/test/test_driver.c
> > @@ -1910,6 +1910,27 @@ static int testDomainReboot(virDomainPtr domain,
> >      return ret;
> >  }
> >
> > +static char *
> > +testDomainGetHostname(virDomainPtr domain,
> > +                      unsigned int flags)
> > +{
> > +    char *ret = NULL;
> > +    virDomainObjPtr vm = NULL;
> > +
> > +    virCheckFlags(0, NULL);
> > +
> > +    if (!(vm = testDomObjFromDomain(domain)))
> > +        goto cleanup;
> > +
> > +    if (virDomainObjCheckActive(vm) < 0)
> > +        goto cleanup;
> > +
> > +    ignore_value(virAsprintf(&ret, "%shost", domain->name));
> > +
> > + cleanup:
>
> Oops, missing "virDomainObjEndAPI(&vm);" here.

I'll squash that in before merging (after the 5.4.0 release).

Reviewed-by: Erik Skultety <eskultet@redhat.com>

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