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

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