From nobody Mon Feb 9 13:35:41 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 1534905612115729.9786413297968; Tue, 21 Aug 2018 19:40:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 96E47C05AA51; Wed, 22 Aug 2018 02:40:09 +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 577E8A1F04; Wed, 22 Aug 2018 02:40:09 +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 01A584A463; Wed, 22 Aug 2018 02:40:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7M2e0WZ019326 for ; Tue, 21 Aug 2018 22:40:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id A1D614CC; Wed, 22 Aug 2018 02:40:00 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 98F3E5C8B3 for ; Wed, 22 Aug 2018 02:39:58 +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 1EEE5308FB87 for ; Wed, 22 Aug 2018 02:39:57 +0000 (UTC) Received: by mail-qt0-f195.google.com with SMTP id n6-v6so567886qtl.4 for ; Tue, 21 Aug 2018 19:39:57 -0700 (PDT) Received: from localhost.localdomain ([177.83.107.196]) by smtp.gmail.com with ESMTPSA id x206-v6sm229382qka.89.2018.08.21.19.39.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Aug 2018 19:39:55 -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=ZPGnBZPU/s1ZOPH8eg+BLv4N42XfsqYiT9phfirBZnk=; b=jT646MzJkK2EHshN/Pn6xHTfsoNt1Cws7SDu0lFMyCKu91lMBk3qik2ccvST6AKvu5 v98cWNuq4mfnX3Oz6cEPny/QylPF5PW+rQ7ID/KYzm2381TYal5+xM2oZCXsXhldvuPI fRaA/hvpPkoS/eXEUvPU6sPYSfDY56w8Ne/lguIcJbgcKyNAbweemsrTVemkmcwx2kVT 8PuY/qY4vHhidpv+PvxBF9X2sp8QdJbWVPon5eiYjrJwjlYrjsmVu8l5FmPIPtWe4DqC u0EYNhCrk9l6XQjBbCxIqY1kxuXwSKkKG2tLCgz46Di8+54SPQYq2tJIRRu9/pFTcYh7 1flA== 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=ZPGnBZPU/s1ZOPH8eg+BLv4N42XfsqYiT9phfirBZnk=; b=uVJ+lJ/SU1p+ERld+SGoDHtM+4487JIyRXcpWFO9n8dyq2+HCZ9crLyGgoHrh0eQx0 KfqvlNbReXf/Ty7kboUTTw4QDcp9jivZTQ2QpeEYKKjqsUexmpc1sTsooHfNmrKdegY0 K5DgViQp3ThBP7HclkqT0qD3Fv2Jkh3bTcEbOBr0mls+q6bpxmWnUuD0SahjpIZas7h5 /QkkXVJdUg3iK3hDlfZu5tryjZn6MXnIs7+KHAUxPCIXuaSJDzrL5cdNVzfmz/g/XxAV T7ad2rADtrKtILi4E9VUmaPRU+iK6VDXZytqJbg5g5gdg+KD5s37q70/LnPVa2Awy+y3 9IVA== X-Gm-Message-State: APzg51AKqEgWstY2GAjrrolcyY9wbsX5Whnj5vj/sDz0vtvmChKFNTz9 VDN8F9pIf+yD3pa1aOYpkAE5L7Om X-Google-Smtp-Source: ANB0VdY14/xGaHRs6C435e2Vv3v1WEiVYs/FmPeHf5iXYaqRz9faVJ7lRN13Y5yF1kP8SaGaETRFbw== X-Received: by 2002:ac8:3784:: with SMTP id d4-v6mr1900969qtc.128.1534905595982; Tue, 21 Aug 2018 19:39:55 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Tue, 21 Aug 2018 23:39:42 -0300 Message-Id: <20180822023942.1370-3-jcfaracco@gmail.com> In-Reply-To: <20180822023942.1370-1-jcfaracco@gmail.com> References: <20180822023942.1370-1-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 22 Aug 2018 02:39:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 22 Aug 2018 02:39:57 +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.13 (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.43 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 2/2] 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.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 22 Aug 2018 02:40:10 +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 add the 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 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 21e9e87ddd..5f53cbea15 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19351,6 +19351,45 @@ 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, @@ -21955,6 +21994,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.7.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