Blame SOURCES/kvm-qga-linux-return-disk-device-in-guest-get-fsinfo.patch

ae23c9
From 5f01e33acc56e6b82bee691470d5cb19d59bec5c Mon Sep 17 00:00:00 2001
ae23c9
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
ae23c9
Date: Sun, 4 Nov 2018 15:45:28 +0000
ae23c9
Subject: [PATCH 03/35] qga: linux: return disk device in guest-get-fsinfo
ae23c9
MIME-Version: 1.0
ae23c9
Content-Type: text/plain; charset=UTF-8
ae23c9
Content-Transfer-Encoding: 8bit
ae23c9
ae23c9
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
ae23c9
Message-id: <20181104154528.19241-4-marcandre.lureau@redhat.com>
ae23c9
Patchwork-id: 82926
ae23c9
O-Subject: [RHEL8/rhel qemu-kvm PATCH 3/3] qga: linux: return disk device in guest-get-fsinfo
ae23c9
Bugzilla: 1636185
ae23c9
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
ae23c9
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
ae23c9
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
ae23c9
ae23c9
From: Tomáš Golembiovský <tgolembi@redhat.com>
ae23c9
ae23c9
Report device node of the disk on Linux (e.g. "/dev/sda2").
ae23c9
Requirs libudev.
ae23c9
ae23c9
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
ae23c9
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
ae23c9
ae23c9
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1636185
ae23c9
ae23c9
(cherry picked from commit 6589ce35734e7e71463485650e5fb6e4bbe64729)
ae23c9
ae23c9
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 qga/commands-posix.c | 7 ++++++-
ae23c9
 qga/qapi-schema.json | 3 ++-
ae23c9
 2 files changed, 8 insertions(+), 2 deletions(-)
ae23c9
ae23c9
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
ae23c9
index c151891..82cb120 100644
ae23c9
--- a/qga/commands-posix.c
ae23c9
+++ b/qga/commands-posix.c
ae23c9
@@ -933,7 +933,12 @@ static void build_guest_fsinfo_for_real_device(char const *syspath,
ae23c9
     if (udev == NULL || udevice == NULL) {
ae23c9
         g_debug("failed to query udev");
ae23c9
     } else {
ae23c9
-        const char *serial;
ae23c9
+        const char *devnode, *serial;
ae23c9
+        devnode = udev_device_get_devnode(udevice);
ae23c9
+        if (devnode != NULL) {
ae23c9
+            disk->dev = g_strdup(devnode);
ae23c9
+            disk->has_dev = true;
ae23c9
+        }
ae23c9
         serial = udev_device_get_property_value(udevice, "ID_SERIAL");
ae23c9
         if (serial != NULL && *serial != 0) {
ae23c9
             disk->serial = g_strdup(serial);
ae23c9
diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
ae23c9
index 426528c..ca022ad 100644
ae23c9
--- a/qga/qapi-schema.json
ae23c9
+++ b/qga/qapi-schema.json
ae23c9
@@ -833,6 +833,7 @@
ae23c9
 # @target: target id
ae23c9
 # @unit: unit id
ae23c9
 # @serial: serial number (since: 3.1)
ae23c9
+# @dev: device node (POSIX) or device UNC (Windows) (since: 3.1)
ae23c9
 #
ae23c9
 # Since: 2.2
ae23c9
 ##
ae23c9
@@ -840,7 +841,7 @@
ae23c9
   'data': {'pci-controller': 'GuestPCIAddress',
ae23c9
            'bus-type': 'GuestDiskBusType',
ae23c9
            'bus': 'int', 'target': 'int', 'unit': 'int',
ae23c9
-           '*serial': 'str'} }
ae23c9
+           '*serial': 'str', '*dev': 'str'} }
ae23c9
 
ae23c9
 ##
ae23c9
 # @GuestFilesystemInfo:
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9