[libvirt] [PATCH] test_driver: implement virDomainGetHostname
Ilias Stamatis
stamatis.iliass at gmail.com
Fri May 31 15:38:44 UTC 2019
On Fri, May 31, 2019 at 4:31 PM Ilias Stamatis
<stamatis.iliass at gmail.com> wrote:
>
> Always return "domain_name" + "host".
>
> Signed-off-by: Ilias Stamatis <stamatis.iliass at 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
>
More information about the libvir-list
mailing list