From nobody Fri May 3 13:23:03 2024 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 1536121303403755.7549842743275; Tue, 4 Sep 2018 21:21:43 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 742D8C049D65; Wed, 5 Sep 2018 04:21:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 37A4760BE5; Wed, 5 Sep 2018 04:21:41 +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 B71B918005DF; Wed, 5 Sep 2018 04:21:40 +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 w854LBeq028610 for ; Wed, 5 Sep 2018 00:21:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id C711660922; Wed, 5 Sep 2018 04:21:11 +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 BEC98608EA for ; Wed, 5 Sep 2018 04:21:09 +0000 (UTC) Received: from mail-qt0-f169.google.com (mail-qt0-f169.google.com [209.85.216.169]) (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 65173308FBA1 for ; Wed, 5 Sep 2018 04:21:08 +0000 (UTC) Received: by mail-qt0-f169.google.com with SMTP id g53-v6so6611781qtg.10 for ; Tue, 04 Sep 2018 21:21:08 -0700 (PDT) Received: from localhost.localdomain ([2804:431:b704:f07a:754f:6e69:b49d:d0f3]) by smtp.gmail.com with ESMTPSA id a66-v6sm362192qkf.96.2018.09.04.21.21.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 21:21:06 -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=6va0i7y3IcjpRqmMSwh0SeADXfrHc/pfRGSvUP0/WNs=; b=qzTEYA9dZ3lpqTpizp2k2lAsbyX1kKId2P1Df90tAXy+3xBDGi5b2YIlPZ8qIhNsAo Bs3QFpMbr4xbT5E894Sbtw+KpHAvyuhFaV+P26Sst6od/NuATPf3smRhV46nL0P7/RoC gRrE+stEeYQyuhckbS+PkerhFeMIxCIJ/2FHibfd05VZ30WEmUq0LY8FlgjRZcL4q20X ZN484qjLEa9lHwrGzjmaJbqmUU2U5/lAYJ6BHGLTWxLEkMsyhWijEi37+rUacsDhBlod e/eYa/bbUxke88ePfvs9w9LvPSjV9XY6Got5nl3Op/hro6cNFszfpXM98VPpyUfUgPW6 /2bA== 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=6va0i7y3IcjpRqmMSwh0SeADXfrHc/pfRGSvUP0/WNs=; b=d2BYgxbyUj0lwmpdSDFjdbKjAfqbsDUGW1r8GYahkHSRudiM5eTiuqegbb8CXcnycY CESROZ1PouAMv97K95Muter5JfmyBS+a4un/mJGBrMsbgFg8SdyVmZXgJiupS7hc3Jeh WQFdJr96XV61Cru2nCXkfiE4sVtM6vOD/NOnIBHWJFTVK3bsanfnZycv9+jQaTVerLcV 2tecuGkbOAv8Le2kepZGBV8mxASEk1imymmIt3OFJpRvbtCz4BBSQDkA5OVoYgIW77cL BGDc3AZPAiBSYwAr/yPRORG3PqJkhe9QTWaEi4YVEGwOmhwOc+UmB3gc11GIRyD+N5I4 ftug== X-Gm-Message-State: APzg51BoOsTkukoWo9e/OLvetyAiVqHqP2yF7nvgN2UbLYBt65Bxkdfp XwfCRcQcgJBVrc/peHuouMD0yGkx X-Google-Smtp-Source: ANB0VdYFqXiZsjonQnKP4fxTyvMn1cO4wN13DfVu1pva+20e52HPKKx/d0DIi9Oh6kBilem18kYYag== X-Received: by 2002:ac8:2617:: with SMTP id u23-v6mr33941075qtu.100.1536121267407; Tue, 04 Sep 2018 21:21:07 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Wed, 5 Sep 2018 01:20:53 -0300 Message-Id: <20180905042056.21029-2-jcfaracco@gmail.com> In-Reply-To: <20180905042056.21029-1-jcfaracco@gmail.com> References: <20180905042056.21029-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, 05 Sep 2018 04:21:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 05 Sep 2018 04:21:08 +0000 (UTC) for IP:'209.85.216.169' DOMAIN:'mail-qt0-f169.google.com' HELO:'mail-qt0-f169.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.169 mail-qt0-f169.google.com 209.85.216.169 mail-qt0-f169.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 1/4] qemu: implementing qemuAgentGetHostname() function. 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 05 Sep 2018 04:21:42 +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 implements the function qemuAgentGetHostname() that uses the QEMU guest agent command 'guest-get-host-name' to retrieve the guest hostname of virtual machine running the QEMU-GA. Signed-off-by: Julio Faracco Reviewed-by: John Ferlan --- src/qemu/qemu_agent.c | 47 +++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_agent.h | 4 ++++ 2 files changed, 51 insertions(+) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index bf08871f18..ac728becef 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -1683,6 +1683,53 @@ qemuAgentUpdateCPUInfo(unsigned int nvcpus, } =20 =20 +int +qemuAgentGetHostname(qemuAgentPtr mon, + char **hostname) +{ + int ret =3D -1; + virJSONValuePtr cmd; + virJSONValuePtr reply =3D NULL; + virJSONValuePtr data =3D NULL; + const char *result =3D NULL; + + cmd =3D qemuAgentMakeCommand("guest-get-host-name", + NULL); + + if (!cmd) + return ret; + + if (qemuAgentCommand(mon, cmd, &reply, true, + VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK) < 0) + goto cleanup; + + if (qemuAgentCheckError(cmd, reply) < 0) + goto cleanup; + + if (!(data =3D virJSONValueObjectGet(reply, "return"))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("malformed return value")); + goto cleanup; + } + + if (!(result =3D virJSONValueObjectGetString(data, "host-name"))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("'host-name' missing in guest-get-host-name reply= ")); + goto cleanup; + } + + if (VIR_STRDUP(*hostname, result) < 0) + goto cleanup; + + ret =3D 0; + + cleanup: + virJSONValueFree(cmd); + virJSONValueFree(reply); + return ret; +} + + int qemuAgentGetTime(qemuAgentPtr mon, long long *seconds, diff --git a/src/qemu/qemu_agent.h b/src/qemu/qemu_agent.h index 6dd9c702dd..4354b7e0cf 100644 --- a/src/qemu/qemu_agent.h +++ b/src/qemu/qemu_agent.h @@ -105,6 +105,10 @@ int qemuAgentUpdateCPUInfo(unsigned int nvcpus, qemuAgentCPUInfoPtr cpuinfo, int ncpuinfo); =20 +int +qemuAgentGetHostname(qemuAgentPtr mon, + char **hostname); + int qemuAgentGetTime(qemuAgentPtr mon, long long *seconds, unsigned int *nseconds); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 13:23:03 2024 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 1536121280564393.4698660923723; Tue, 4 Sep 2018 21:21:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 808685F726; Wed, 5 Sep 2018 04:21:18 +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 09AB830912F5; Wed, 5 Sep 2018 04:21:18 +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 AAA884BB74; Wed, 5 Sep 2018 04:21:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w854LDJI028616 for ; Wed, 5 Sep 2018 00:21:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 31B66308BDAD; Wed, 5 Sep 2018 04:21:13 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2817A308BDAB for ; Wed, 5 Sep 2018 04:21:11 +0000 (UTC) Received: from mail-qt0-f193.google.com (mail-qt0-f193.google.com [209.85.216.193]) (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 0D25BC049D5C for ; Wed, 5 Sep 2018 04:21:10 +0000 (UTC) Received: by mail-qt0-f193.google.com with SMTP id h4-v6so6649035qtj.7 for ; Tue, 04 Sep 2018 21:21:10 -0700 (PDT) Received: from localhost.localdomain ([2804:431:b704:f07a:754f:6e69:b49d:d0f3]) by smtp.gmail.com with ESMTPSA id a66-v6sm362192qkf.96.2018.09.04.21.21.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 21:21:08 -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=VBRH72cIqZYb4w5F7Pxnpf5ZX0SfNv7MWOhR+5CXyYcKW1RT2RfEondaN6tE+JIJzD gjHEAXXv5ystc1YyPkVBnVCnW14BaXS80MRUIn4OmaCwo9AtNG+eYXDCdZGRARrfrOaW dAqWKSkw57QrAevli0EOQaWW63WVtL8a1YP+PfJP1/T1opCl/WBSQyWuQBr+fpQ6CWr5 wf20I20+SoCjhu+v/yMKeVHyXwIetXZQf8dgwtFuv3xO/5AnL5Y6imlC/xcWuLLb3c52 6P4lqSDXBHymK6w5/nxKOhJekHFD9DZ7DD7HqMFftXsoaxZ+aTGx4KzZVaO0g+Ij2OGj +tZA== 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=lGfy4JFA+uEEndJYf2S05NfzVilEkI5AzzMgaGzrOeKmHg4bl+r3dRqIiWpdsaV8mH mdbvkNEBHAU6HxALdFDKEopOAd7TCqIN83mU1CJjSWLonIJmJgGIt9eFyyF7j+IwMlyc WlkAjJnyKjDl3OjImPCoIMIkFPLDB61LqIr62GcojYKCU6bANYe0w1bGG0qPVrRjVBXZ UbODFsU01VLCm0EN5ZjAw1BB4XT19xusCTYK6b+AnjKRyem2GYRH+O4rYxfSgQdj0/PS uTsdfYeE/WpAgh0b6AIGbVyzaiiAx8SGqnGUQ+5O3suICbkynBDnjt/H3Yb5+flVg1+D NVaA== X-Gm-Message-State: APzg51ASc1whpLmUs+s0DqCMSGtyLsEG4CC3e5CQvvaY/tVMvO0TKkzO 6txt10mPVWg/aFW0PaHaUkHcHqRn X-Google-Smtp-Source: ANB0VdYNwk7EI845oZmfEhGN2vHKq1KKwiSe+d+LXSt8fPQzhQKHn5JIWhEOGFydAQHga197rN5erA== X-Received: by 2002:aed:2e64:: with SMTP id j91-v6mr24337404qtd.318.1536121269058; Tue, 04 Sep 2018 21:21:09 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Wed, 5 Sep 2018 01:20:54 -0300 Message-Id: <20180905042056.21029-3-jcfaracco@gmail.com> In-Reply-To: <20180905042056.21029-1-jcfaracco@gmail.com> References: <20180905042056.21029-1-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 05 Sep 2018 04:21:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 05 Sep 2018 04:21:10 +0000 (UTC) for IP:'209.85.216.193' DOMAIN:'mail-qt0-f193.google.com' HELO:'mail-qt0-f193.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.193 mail-qt0-f193.google.com 209.85.216.193 mail-qt0-f193.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 05 Sep 2018 04:21:19 +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 Reviewed-by: John Ferlan --- 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 From nobody Fri May 3 13:23:03 2024 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 1536121308662834.2763011948996; Tue, 4 Sep 2018 21:21:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 03DCE88310; Wed, 5 Sep 2018 04:21:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C0A5C5C73D; Wed, 5 Sep 2018 04:21:46 +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 50A78181A130; Wed, 5 Sep 2018 04:21:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w854LEXI028636 for ; Wed, 5 Sep 2018 00:21:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id A0F9D103BAB4; Wed, 5 Sep 2018 04:21:14 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9837E10021B1 for ; Wed, 5 Sep 2018 04:21:12 +0000 (UTC) Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) (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 8E9585F726 for ; Wed, 5 Sep 2018 04:21:11 +0000 (UTC) Received: by mail-qt0-f196.google.com with SMTP id k38-v6so6614523qtk.11 for ; Tue, 04 Sep 2018 21:21:11 -0700 (PDT) Received: from localhost.localdomain ([2804:431:b704:f07a:754f:6e69:b49d:d0f3]) by smtp.gmail.com with ESMTPSA id a66-v6sm362192qkf.96.2018.09.04.21.21.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 21:21:10 -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=ZPdiC0riE1dWDM14qT1arKPSxU5311dy6j85l6ca5sU=; b=AGXY3s5Ue4uSFhBLhjQAdaB9adAGUCqRJ8fcovM6Fsdsa//2XfuEIGiAslnAfjboOc pAJFis2rSY2wRcGLp611IHh/NZkKSWlUDxdtGVbU6pbG5EkHmoQQTF2VvwaD02yzhEIb 3eUXuqYTfU66w2usOOK9l4HL5+Ic1v2gF+pa677NP02ovpDmcFiNWsmUkWLURqNQqOC5 97Qtn8k2S7XgvYvO/XsowCcb4EVyvdj9NYIJ8o9R1hYFqEdnI6+IJzBOiOvFgsFBI++T ixmZud2wwbROAEboHM8eA7igI6HdejJgnxKDGT6kBt7dtGhGsdtpxt2OFxsm2Na2D0QR nm4Q== 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=ZPdiC0riE1dWDM14qT1arKPSxU5311dy6j85l6ca5sU=; b=TptlVxX+TZ/hhncx6RcqAKi5wuoZbLdC1bHrmm7ZmrC/IwDBiCJLTkf5GePe8uf32K FbYyaX/rzl/JsdswBkJVTr40MKr6aaw7qm5lRTP/8xhC29YjkVKZmrQay2yRt+/sE/wy cGXIBwXZzowf+wH8AoDERijYLdTQh4amv2vnVytwyWtjyZifb1hw23BkVdDMhapps8g3 j1uvL4tBicPIh9bzFiBL+i8tfhGacvJEe6qn0xlw5HjSI7Ijz110v1YF8MmXyS9PGwo3 zRG9mOKK+odxn0RaKmZD2ZL2RIX1BHRhRx6LMKiGLz58f07XY0PevyI8m4ymcKlzTqqn SViQ== X-Gm-Message-State: APzg51D1Dyn6AYd2C557LGdL5349EHWkRBoq/oUZZx8+OxpR7zpz3Kbt 8rJJT+HfwUm1X8sEJG6v4Ma7se8f X-Google-Smtp-Source: ANB0VdbeFspqu4pwh1Y4TXhNPEiyyiAVd1syQ4v2b+WbDI70C2vmmQqzLdXl0BU7CHLDUg6xxbWCTQ== X-Received: by 2002:aed:24c3:: with SMTP id u3-v6mr32821078qtc.50.1536121270615; Tue, 04 Sep 2018 21:21:10 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Wed, 5 Sep 2018 01:20:55 -0300 Message-Id: <20180905042056.21029-4-jcfaracco@gmail.com> In-Reply-To: <20180905042056.21029-1-jcfaracco@gmail.com> References: <20180905042056.21029-1-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 05 Sep 2018 04:21:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 05 Sep 2018 04:21:11 +0000 (UTC) for IP:'209.85.216.196' DOMAIN:'mail-qt0-f196.google.com' HELO:'mail-qt0-f196.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.196 mail-qt0-f196.google.com 209.85.216.196 mail-qt0-f196.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 3/4] docs: Add QEMU-GA get hostname feature into news.xml 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 05 Sep 2018 04:21:47 +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" QEMU-GA supports get geust hostname command. This commit includes a specific entry to inform this new feature for QEMU driver to 4.8.0 release. Signed-off-by: Julio Faracco Reviewed-by: John Ferlan --- docs/news.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 9a17b2f612..d67327699d 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -37,6 +37,16 @@
+ + + qemu: Retrieve guest hostname through QEMU Guest Agent command + + + QEMU is now able to retrieve the guest hostname using a new QEMU= -GA + command called 'guest-get-host-name'. Virsh users can execute + 'domhostname' for QEMU driver. + +
--=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 13:23:03 2024 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 153612128056477.1678901605153; Tue, 4 Sep 2018 21:21:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 780F081F09; Wed, 5 Sep 2018 04:21:18 +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 197835C72F; Wed, 5 Sep 2018 04:21:18 +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 02B754A460; Wed, 5 Sep 2018 04:21:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w854LEO8028631 for ; Wed, 5 Sep 2018 00:21:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 83287308BDAD; Wed, 5 Sep 2018 04:21:14 +0000 (UTC) Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 77E06308BDAB for ; Wed, 5 Sep 2018 04:21:14 +0000 (UTC) Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) (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 72007308A94D for ; Wed, 5 Sep 2018 04:21:13 +0000 (UTC) Received: by mail-qt0-f196.google.com with SMTP id n6-v6so6646050qtl.4 for ; Tue, 04 Sep 2018 21:21:13 -0700 (PDT) Received: from localhost.localdomain ([2804:431:b704:f07a:754f:6e69:b49d:d0f3]) by smtp.gmail.com with ESMTPSA id a66-v6sm362192qkf.96.2018.09.04.21.21.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 21:21:11 -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=44dLtGr/66/ENzvT1KbaYSz5JMIELF93R94f3yWInSM=; b=NEXAE0r+nc0h22naYP/0VNs6qP0KKDYmmZvvBgxTHRr75o2fkjpUcdR0JmNxuS2Sv0 ma4IG4atlLmExKCYN2B79366Yq2N9xZlINQ0Z4GsgEYAzuoUJHjmE3cXsziadLaHSonj HkLwNy9asfcO3gJEOqaraYGa0Yh0/k1zdaY/HolZm3TIYSg9DSFAOi2b1ShVduxishjW nzQOd34PnHk45zVZOdrqBUKzLvqlzXflyDLQBENAjLaLyIdcn8+jnGiqbao/S+qOBd54 MagBHFSX6I02x0fwzu4UZJpc149M99TvnzlEsu2s10pEQXYZgJLYh5FYdRzqVYkSoFiD Iyiw== 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=44dLtGr/66/ENzvT1KbaYSz5JMIELF93R94f3yWInSM=; b=JDh8gJF9kHWkFtaP0q8FjkP0GWs/QhGULajD5z/ic8QOv9wCUX+hpiu2d/L8okaBjM bLXV2pfMii8T5y6TnOfzA0THFQBX/2PKs7Oy6hlDxmPiX9tFH793W5lA/3u/ulgYmwQF rEOdWF1/6r01Y9wDMpu6SWur+EJvluFZKF8CwTzKu2hkCpz5PS8OglqsRaoufbQttrJt muiwxTRy3T2uARnxQnGDAlLhhNL3lvpCb/wgD2IUNIhgOUpTSENhow3pop9sQQqVdDq0 u5a3pI/Bhm4rqarmI4VBVT0SoXO8HZqNn0lJzIPKjfP6B9q6lhaewMXdNuVoWOwdLSQg OuNw== X-Gm-Message-State: APzg51C/4VZrFfdiABUrwLUFKLXE+DpIOKCRvRX9QIAR7ABQmmyR3ksg V/wDJXh31h+jwYQTuVN+hne3NUvp X-Google-Smtp-Source: ANB0VdY3npFKKCWkaIJvo77UMDixDfoh7pOmrvGs3+/G+rD5/3jrWGI6nuTNdVzEOBkLqeccFJxCaA== X-Received: by 2002:ac8:70c5:: with SMTP id g5-v6mr32082580qtp.271.1536121272441; Tue, 04 Sep 2018 21:21:12 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Wed, 5 Sep 2018 01:20:56 -0300 Message-Id: <20180905042056.21029-5-jcfaracco@gmail.com> In-Reply-To: <20180905042056.21029-1-jcfaracco@gmail.com> References: <20180905042056.21029-1-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 05 Sep 2018 04:21:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 05 Sep 2018 04:21:13 +0000 (UTC) for IP:'209.85.216.196' DOMAIN:'mail-qt0-f196.google.com' HELO:'mail-qt0-f196.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.196 mail-qt0-f196.google.com 209.85.216.196 mail-qt0-f196.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.41 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 4/4] qemu: unlink the error report from VIR_STRDUP. 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 05 Sep 2018 04:21:19 +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" The function to retrieve the file system info using QEMU-GA is using some conditionals to retrieve the info. This is wrong because the error of some conditionals will be raised if VIR_STRDUP return errors and not if some problem occurred with JSON. Signed-off-by: Julio Faracco Reviewed-by: John Ferlan Reviewed-by: J=EF=BF=BDn Tomko --- src/qemu/qemu_agent.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index ac728becef..36dc18d72f 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -1836,6 +1836,7 @@ qemuAgentGetFSInfo(qemuAgentPtr mon, virDomainFSInfoP= tr **info, virJSONValuePtr data; virDomainFSInfoPtr *info_ret =3D NULL; virPCIDeviceAddress pci_address; + const char *result =3D NULL; =20 cmd =3D qemuAgentMakeCommand("guest-get-fsinfo", NULL); if (!cmd) @@ -1881,28 +1882,34 @@ qemuAgentGetFSInfo(qemuAgentPtr mon, virDomainFSInf= oPtr **info, if (VIR_ALLOC(info_ret[i]) < 0) goto cleanup; =20 - if (VIR_STRDUP(info_ret[i]->mountpoint, - virJSONValueObjectGetString(entry, "mountpoint")) <= 0) { + if (!(result =3D virJSONValueObjectGetString(entry, "mountpoint"))= ) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("'mountpoint' missing in reply of " "guest-get-fsinfo")); goto cleanup; } =20 - if (VIR_STRDUP(info_ret[i]->name, - virJSONValueObjectGetString(entry, "name")) < 0) { + if (VIR_STRDUP(info_ret[i]->mountpoint, result) < 0) + goto cleanup; + + if (!(result =3D virJSONValueObjectGetString(entry, "name"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("'name' missing in reply of guest-get-fsinfo"= )); goto cleanup; } =20 - if (VIR_STRDUP(info_ret[i]->fstype, - virJSONValueObjectGetString(entry, "type")) < 0) { + if (VIR_STRDUP(info_ret[i]->name, result) < 0) + goto cleanup; + + if (!(result =3D virJSONValueObjectGetString(entry, "type"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("'type' missing in reply of guest-get-fsinfo"= )); goto cleanup; } =20 + if (VIR_STRDUP(info_ret[i]->fstype, result) < 0) + goto cleanup; + if (!(entry =3D virJSONValueObjectGet(entry, "disk"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("'disk' missing in reply of guest-get-fsinfo"= )); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list