From nobody Mon Feb 9 01:21:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1536115143613527.1655456986682; Tue, 4 Sep 2018 19:39:03 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 09CB7309179F; Wed, 5 Sep 2018 02:39:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C58D4600C2; Wed, 5 Sep 2018 02:38:59 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 759564BB7F; Wed, 5 Sep 2018 02:38:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w852cm3m017933 for ; Tue, 4 Sep 2018 22:38:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 07044608EA; Wed, 5 Sep 2018 02:38:48 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F15906B8C3 for ; Wed, 5 Sep 2018 02:38:47 +0000 (UTC) Received: from mail-qt0-f195.google.com (mail-qt0-f195.google.com [209.85.216.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8410730833C3 for ; Wed, 5 Sep 2018 02:38:46 +0000 (UTC) Received: by mail-qt0-f195.google.com with SMTP id t39-v6so6453017qtc.8 for ; Tue, 04 Sep 2018 19:38:46 -0700 (PDT) Received: from localhost.localdomain ([2804:431:b704:f07a:754f:6e69:b49d:d0f3]) by smtp.gmail.com with ESMTPSA id v13-v6sm298798qtg.82.2018.09.04.19.38.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 19:38:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=81vNFfEvERFeO/spPm9yI9eT7sMFhrQzlFqpT4KJsSs=; b=K/WQP/XrNR7c77zRrQe/ZLEm4YYd4zBumk9pZR/9+bv3IGSBYjP8QJ5ESFkL8PySd7 JjN1rSwpG0lgD7GUQG9W3xRUMJ7/vpki8pBdh2qsKa1Zb4V/tZcfGplPsTjuA+tWr4f6 pYovPWQqpEvp9eExPwMTYi7twnDvp0ZeDOTpZoTf9ifo8BCUCbWr3DiZMudbAtIy4OgG MHPyYDKZXBCahqA1PnK9YTz5UO+XqQ8nVF7ie7WBGiGMOrEANuRt9REaeHe8FmIzeKkl 0mkM+fVt7DivgdbxzAKz5kATE20Yb0FjjfGr2+bMhHVlSLAiD5fabUALJyY+tzG88K7K v5VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=81vNFfEvERFeO/spPm9yI9eT7sMFhrQzlFqpT4KJsSs=; b=Z6JCBM97EfshDTNDf7Oe/FO47P35g4yooagJ9Swnl+T/yBIMGoD5hf4SoAFAz8jcq9 2ejdxCxIKALgwZFUBLwaDwpKX6wrph3YzT/jh0rbkh4q5Ex/10iXb0kh5TQP8mQINQLM 9keBK8Q8hCEeyllxWYvpNTrpG32m7cVOInmXjRZPcWRY1aLMVOHFQl9m9vk4vOdMd29C BAi9ixrIH0XozUVd72mNLaYs5Ob04oKnWubERE/7JZTo+UBvchmZskT+K76Ho6q9Ucsw Uy1heSwFkyLQjSZIh/l9cKNWmRoODVM3Gh5HhmHFnBzCg8C656R3N+tcZfkjJDiFvu6T wCkQ== X-Gm-Message-State: APzg51BfcmerKVxWuDhV7ufjFtkVlwxQIC10cLuvam+Btgbni37xgDWE zgij27cjJvClKywXRszcMgSTYqKz X-Google-Smtp-Source: ANB0VdZ8+mLotxg9l5wobat3miAFhUR4TeYJnpqlBcJiBfxJx1lZqWmtRV/CtI8B+pWRCRgjLLe8gw== X-Received: by 2002:ad4:414b:: with SMTP id z11-v6mr31703590qvp.77.1536115125407; Tue, 04 Sep 2018 19:38:45 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Tue, 4 Sep 2018 23:38:31 -0300 Message-Id: <20180905023833.4867-3-jcfaracco@gmail.com> In-Reply-To: <20180905023833.4867-1-jcfaracco@gmail.com> References: <20180905023833.4867-1-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 05 Sep 2018 02:38:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 05 Sep 2018 02:38:46 +0000 (UTC) for IP:'209.85.216.195' DOMAIN:'mail-qt0-f195.google.com' HELO:'mail-qt0-f195.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.108 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.216.195 mail-qt0-f195.google.com 209.85.216.195 mail-qt0-f195.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 2/4] qemu: adding domainGetHostname support for QEMU X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 05 Sep 2018 02:39:00 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This commit adds support to use the function qemuAgentGetHostname() for obtain the domain hostname using QEMU-GA command. Signed-off-by: Julio Faracco --- src/qemu/qemu_driver.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 07ea5473b6..2f8d6915e1 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19353,6 +19353,46 @@ qemuConnectGetCPUModelNames(virConnectPtr conn, return virCPUGetModels(arch, models); } =20 + +static char * +qemuDomainGetHostname(virDomainPtr dom, + unsigned int flags) +{ + virQEMUDriverPtr driver =3D dom->conn->privateData; + virDomainObjPtr vm =3D NULL; + qemuAgentPtr agent; + char *hostname =3D NULL; + + virCheckFlags(0, NULL); + + if (!(vm =3D qemuDomObjFromDomain(dom))) + return NULL; + + if (virDomainGetHostnameEnsureACL(dom->conn, vm->def) < 0) + goto cleanup; + + if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_QUERY) < 0) + goto cleanup; + + if (virDomainObjCheckActive(vm) < 0) + goto endjob; + + if (!qemuDomainAgentAvailable(vm, true)) + goto endjob; + + agent =3D qemuDomainObjEnterAgent(vm); + ignore_value(qemuAgentGetHostname(agent, &hostname)); + qemuDomainObjExitAgent(vm, agent); + + endjob: + qemuDomainObjEndAgentJob(vm); + + cleanup: + virDomainObjEndAPI(&vm); + return hostname; +} + + static int qemuDomainGetTime(virDomainPtr dom, long long *seconds, @@ -19399,6 +19439,7 @@ qemuDomainGetTime(virDomainPtr dom, return ret; } =20 + static int qemuDomainSetTime(virDomainPtr dom, long long seconds, @@ -21957,6 +21998,7 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .connectGetCPUModelNames =3D qemuConnectGetCPUModelNames, /* 1.1.3 */ .domainFSFreeze =3D qemuDomainFSFreeze, /* 1.2.5 */ .domainFSThaw =3D qemuDomainFSThaw, /* 1.2.5 */ + .domainGetHostname =3D qemuDomainGetHostname, /* 4.8.0 */ .domainGetTime =3D qemuDomainGetTime, /* 1.2.5 */ .domainSetTime =3D qemuDomainSetTime, /* 1.2.5 */ .nodeGetFreePages =3D qemuNodeGetFreePages, /* 1.2.6 */ --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list