From nobody Mon May 6 06:24:53 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 1536115132312981.2887003212753; Tue, 4 Sep 2018 19:38:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4771930024F1; Wed, 5 Sep 2018 02:38:50 +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 0E5252008259; Wed, 5 Sep 2018 02:38:50 +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 58CDD181A12D; Wed, 5 Sep 2018 02:38:49 +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 w852cmef017934 for ; Tue, 4 Sep 2018 22:38:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 09876608EE; Wed, 5 Sep 2018 02:38:48 +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 000366B8DE for ; Wed, 5 Sep 2018 02:38:46 +0000 (UTC) Received: from mail-qt0-f170.google.com (mail-qt0-f170.google.com [209.85.216.170]) (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 F1E26308A95D for ; Wed, 5 Sep 2018 02:38:44 +0000 (UTC) Received: by mail-qt0-f170.google.com with SMTP id r37-v6so6481703qtc.0 for ; Tue, 04 Sep 2018 19:38:44 -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.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 19:38:43 -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=TO1/hn6MDrC7iakkaIef1CU9R7u+Hndw+fWNhF7qMlsxL8LomvGSlVaT+a/P1dRuvO iDNffYlbeCF84oQTdpCMu3USm3G4UsammD4f/yBxM/D1WOokQmnjr21QjjKBnZyB4o8N QPNoc9huf7IHqwFzW+82VEFlIIDsr6vsCgjWhrMDd3U2XUfUdubUfWxwM+evKIJyDeLU 8a6j4GApHZiyq2lCML+PT3JFyHI2kpJTNRg8zdAalJBdUxGr4f5+BEX+Eu74fctCbo0t zyBtkcWqP7IQr+y5SqxxBHnpgaC9/1sI8AVM2pP0MDUI0BHsBNrq+gC/jFxvm9zSr+Kx sefw== 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=OAz+odIxRN4xrPyr/GjFObCQM7k1phn/sKTzs3kyo7PLEklQimVr1bo6jUWCE5PeCM EJ6VRvpfrEjAuyyQCupSQAPdOv3+fgeujyexgCy9YOTh0vTvohIuQwjb/9ZdFVyGjIRa 1h1cSJT35jNs/0Ta2uWI1vw04di27jLddE5EnXJzlDjAnE9DdtoDbX9W9jbZZxo0fPsx zTXpWJkJylN3Y2PbfT/EHvRYLjLSqdLDEWyX1Ns3A4JxF7miONjEMQEXFUKdFlFAGHmi y4HfawILCi1rud+ZN5Y1Ncx6Rm/Lw92PqPzxivs1njKkkX42MH7ZTebvEYpblVCWKni6 INqQ== X-Gm-Message-State: APzg51Dk55eFycj7tZsCr6nExWy2e/Pm0yQpNDqtPdvn7EZR7S0iTSXV 79xxHEfUpy7YHo21AU3vLDaiiOC4 X-Google-Smtp-Source: ANB0Vdagi8BWiakyEadY1bZ3+5xAFTaBoXZkkzco5T9N2bvIExaPMBgHOHKiPWcx6gIGYMz3Yc2gYg== X-Received: by 2002:ac8:7254:: with SMTP id l20-v6mr32608235qtp.108.1536115124010; Tue, 04 Sep 2018 19:38:44 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Tue, 4 Sep 2018 23:38:30 -0300 Message-Id: <20180905023833.4867-2-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.41]); Wed, 05 Sep 2018 02:38:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 05 Sep 2018 02:38:45 +0000 (UTC) for IP:'209.85.216.170' DOMAIN:'mail-qt0-f170.google.com' HELO:'mail-qt0-f170.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.11 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS) 209.85.216.170 mail-qt0-f170.google.com 209.85.216.170 mail-qt0-f170.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.41 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 05 Sep 2018 02:38:50 +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 --- 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 Mon May 6 06:24:53 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 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 From nobody Mon May 6 06:24:53 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 1536115133897559.7648149637001; Tue, 4 Sep 2018 19:38:53 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5AD09308ED55; Wed, 5 Sep 2018 02:38:52 +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 2601816BFF; Wed, 5 Sep 2018 02:38:52 +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 C548E181A139; Wed, 5 Sep 2018 02:38:51 +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 w852coMN017953 for ; Tue, 4 Sep 2018 22:38:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8DAEA308BDAC; Wed, 5 Sep 2018 02:38:50 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 85104308BDAB for ; Wed, 5 Sep 2018 02:38:48 +0000 (UTC) Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) (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 D849F356D5 for ; Wed, 5 Sep 2018 02:38:47 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id z78-v6so3935022qka.0 for ; Tue, 04 Sep 2018 19:38:47 -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.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 19:38:46 -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=JdrEgrKpOrnF1nqbp04/qy3mRjV11otVmc+Zsxn22RU=; b=nk7PiQoDtWcDcvfXCwKMLPeyGCAX3BQPYX3RedLewHtzZWBtGJ6UkPt4COKMPS43EV 68dPa70InRM9lBcUk6Sd6TLPaVyKOFW6OHZycr5YITmapixbxk7HBzr5z0j5hyyrAIGL Nig6Cbt0YtaVSa3FrkzVjvX1eb7KGWQJhFe2potOYfXdgzL8vWSLBhwHUaSDgrV4NYzZ b8/fEDtOrwEfcsGqa+Py9nzfgnCQhdOrNG+Z1ibZoZJDvCzNuMZeCNop/n7ce6gRrJe0 mNrgtPz392mmSn6VGOYeVvioSNnV8d/2ahG0RX8RBmaHYwKuZ0/fOPpfjyvl4yqxb/M5 T0Iw== 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=JdrEgrKpOrnF1nqbp04/qy3mRjV11otVmc+Zsxn22RU=; b=bDeew1cgz4BaTyhvOa3pWbaAhH7lnClmWoMsrI/exU7htSM2noHERjQL7I6DLBj7hi X9fxSGR+RgwDRfHdOCDsUG2s5QCPT1sHE4b+1YXXX/vxe7ngBjAg3puJ1lN1AwQeF9z+ Ksk4DNwMGUJkfJrorc8T492AL5tWHrhHyRElhymjG+zaDEJFHTkiwbE+wAhw5GQqDbR+ LjrES6lhw1eFZCPJIlntWzUuORVJHnCN9a6VCKRGkI6IqSi9kzsOgvXUi8lgO6z7YhnY mUKscrXl5qDQBD+K/zWJEwdDFMefM6Tgu4TxsKcNBnob0EoVnbzzEAr3kWrVhlUxAmQs G3oQ== X-Gm-Message-State: APzg51BnrYMxXzzizGTGkFHR49Q2V/TGIQ7z8gNVredPjA4vLiusgG7D CfSCXE4QmaJz0hlQNNPeuxuvpzoS X-Google-Smtp-Source: ANB0Vdba0NEfr1Oq5B19R73L2X1WuGI5eLJnMuFJvDiKEgMDDGT2HrQYZtL6A37El591Z0QBDaT4Ew== X-Received: by 2002:a37:7ac5:: with SMTP id v188-v6mr31371954qkc.262.1536115126799; Tue, 04 Sep 2018 19:38:46 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Tue, 4 Sep 2018 23:38:32 -0300 Message-Id: <20180905023833.4867-4-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.30]); Wed, 05 Sep 2018 02:38:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 05 Sep 2018 02:38:47 +0000 (UTC) for IP:'209.85.222.194' DOMAIN:'mail-qk1-f194.google.com' HELO:'mail-qk1-f194.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.111 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.222.194 mail-qk1-f194.google.com 209.85.222.194 mail-qk1-f194.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 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.84 on 10.5.11.23 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:52 +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 --- docs/news.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 9a17b2f612..5ea1bd285d 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -35,6 +35,15 @@
+ + + 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'. + +
--=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 06:24:53 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 1536115142210521.2600525327329; Tue, 4 Sep 2018 19:39:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B4E9307D84F; Wed, 5 Sep 2018 02:39:00 +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 AB6B116BFF; 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 5BF44181A369; Wed, 5 Sep 2018 02:38:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w852cqbT017964 for ; Tue, 4 Sep 2018 22:38:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 240221758E; Wed, 5 Sep 2018 02:38:52 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 193991758C for ; Wed, 5 Sep 2018 02:38:50 +0000 (UTC) Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) (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 2EC9C356C9 for ; Wed, 5 Sep 2018 02:38:49 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id b19-v6so3923602qkc.6 for ; Tue, 04 Sep 2018 19:38:49 -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.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 19:38:47 -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=p1Rm1qOuqvFFxdZ7e85k4cnF02blTSCa5mcxPGaSckA=; b=lU5/NRfHM42s+bKvb937gZlG8szDe+5N5y7Dwf5VtlgOwPckxYWWwZRV7cVm8E0nAK uJ7odTtXmKFCnzTvRVWrudlZZmAJIJbAZTnmyy3w1g8IxjnwPvzxf5NI84IaJTe1gY7q ElYA+AVUuGcPnYQ4EQYH+XgRJbHfYjppPgGkqoBsS3r1WJf+XtAJ/TIwsXn0i01ml11E sEh61y+rfw9cZUZsuEXX93sh/z1acSfxWvS6NRGM3sTb3EHE/dGRye4y9UVu4h+MvrIH bW+2V3Ny8igPnK1vuhN8RMvO0bRbA8Y2xXGX4vtWicWUGsT+km+BLFhgHtK1We6+1jk+ rMrg== 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=p1Rm1qOuqvFFxdZ7e85k4cnF02blTSCa5mcxPGaSckA=; b=OJccJ/2Fp5tlxGOL/DFmlVrB/FQ8O4BpEbAOOmZ9eb7qpuQJXzfcsYkA5F89cTO/6k NZFAtNLbv6jM6HenbAN9w07LJwLXLgZVQfdpIgUgM2Qg/F0lwvp5kAiO1nMYa8czwpdr i3JDQCP/pRcjSAKNF45tRNutkDNssFgmxKeAbbeznTHwFGYHyAYahN7he5qcNgd84KQ1 HJqYRaKQ4mzMVsDLaK+MX8HOQviNi7Jpo63ap37wO1cbAzabFsifZhd18EkirgWzdE5v +vLfywra3KJhIhiUn5CwdwwDt0KmTF9Wxd4xcIQqO8gkfj/OrxAZYIZZaMJ7lha3aIp7 nMkg== X-Gm-Message-State: APzg51BES4JM7IXVlLypmhqocusbYG+N5wZkWGKkVdWJ83gB2oiTrrg7 d/5I5lOxwTn1QY4x/o8NGUBES5HM X-Google-Smtp-Source: ANB0VdalBYniyIBL2jBNLXpXJomf7GvALzUxQT9CA17rr6u7BdeDJ0N0uasVo0GyINFIvHXbiT9czg== X-Received: by 2002:a37:2990:: with SMTP id p16-v6mr29635105qkp.331.1536115128218; Tue, 04 Sep 2018 19:38:48 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Tue, 4 Sep 2018 23:38:33 -0300 Message-Id: <20180905023833.4867-5-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.30]); Wed, 05 Sep 2018 02:38:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 05 Sep 2018 02:38:49 +0000 (UTC) for IP:'209.85.222.194' DOMAIN:'mail-qk1-f194.google.com' HELO:'mail-qk1-f194.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.111 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.222.194 mail-qk1-f194.google.com 209.85.222.194 mail-qk1-f194.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 05 Sep 2018 02:39:01 +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 --- 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..cf27f53437 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