From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHfVQ-000104-UG for qemu-devel@nongnu.org; Tue, 30 Oct 2018 21:41:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHfVM-0002do-D2 for qemu-devel@nongnu.org; Tue, 30 Oct 2018 21:41:12 -0400 Received: from mail-qt1-x82f.google.com ([2607:f8b0:4864:20::82f]:38510) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHfVM-0002bC-6Z for qemu-devel@nongnu.org; Tue, 30 Oct 2018 21:41:08 -0400 Received: by mail-qt1-x82f.google.com with SMTP id v1-v6so11758418qtq.5 for ; Tue, 30 Oct 2018 18:41:05 -0700 (PDT) Sender: fluxion From: Michael Roth Date: Tue, 30 Oct 2018 20:38:03 -0500 Message-Id: <20181031013821.24023-7-mdroth@linux.vnet.ibm.com> In-Reply-To: <20181031013821.24023-1-mdroth@linux.vnet.ibm.com> References: <20181031013821.24023-1-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PULL v2 06/24] qga: linux: return disk device in guest-get-fsinfo List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= From: Tomáš Golembiovský Report device node of the disk on Linux (e.g. "/dev/sda2"). Requirs libudev. Signed-off-by: Tomáš Golembiovský Signed-off-by: Michael Roth --- qga/commands-posix.c | 7 ++++++- qga/qapi-schema.json | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 41bd11b2b5..1877976522 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -950,7 +950,12 @@ static void build_guest_fsinfo_for_real_device(char const *syspath, if (udev == NULL || udevice == NULL) { g_debug("failed to query udev"); } else { - const char *serial; + const char *devnode, *serial; + devnode = udev_device_get_devnode(udevice); + if (devnode != NULL) { + disk->dev = g_strdup(devnode); + disk->has_dev = true; + } serial = udev_device_get_property_value(udevice, "ID_SERIAL"); if (serial != NULL && *serial != 0) { disk->serial = g_strdup(serial); diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json index 3bcda6257e..c6725b3ec8 100644 --- a/qga/qapi-schema.json +++ b/qga/qapi-schema.json @@ -835,6 +835,7 @@ # @target: target id # @unit: unit id # @serial: serial number (since: 3.1) +# @dev: device node (POSIX) or device UNC (Windows) (since: 3.1) # # Since: 2.2 ## @@ -842,7 +843,7 @@ 'data': {'pci-controller': 'GuestPCIAddress', 'bus-type': 'GuestDiskBusType', 'bus': 'int', 'target': 'int', 'unit': 'int', - '*serial': 'str'} } + '*serial': 'str', '*dev': 'str'} } ## # @GuestFilesystemInfo: -- 2.17.1