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

b11fdf
From 00665748e4495bcb0b45dd5e15a7a9cc8331c77f Mon Sep 17 00:00:00 2001
b11fdf
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
b11fdf
Date: Fri, 23 Nov 2018 15:16:55 +0100
b11fdf
Subject: [PATCH 5/5] qga: linux: return disk device in guest-get-fsinfo
b11fdf
MIME-Version: 1.0
b11fdf
Content-Type: text/plain; charset=UTF-8
b11fdf
Content-Transfer-Encoding: 8bit
b11fdf
b11fdf
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
b11fdf
Message-id: <20181123151655.23498-5-marcandre.lureau@redhat.com>
b11fdf
Patchwork-id: 83153
b11fdf
O-Subject: [RHEL-7.7 qemu-guest-agent PATCH 4/4] qga: linux: return disk device in guest-get-fsinfo
b11fdf
Bugzilla: 1635571
b11fdf
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
b11fdf
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
b11fdf
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
b11fdf
b11fdf
From: Tomáš Golembiovský <tgolembi@redhat.com>
b11fdf
b11fdf
Report device node of the disk on Linux (e.g. "/dev/sda2").
b11fdf
Requirs libudev.
b11fdf
b11fdf
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
b11fdf
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
b11fdf
b11fdf
(cherry picked from commit 6589ce35734e7e71463485650e5fb6e4bbe64729)
b11fdf
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
b11fdf
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
b11fdf
---
b11fdf
 qga/commands-posix.c | 7 ++++++-
b11fdf
 qga/qapi-schema.json | 3 ++-
b11fdf
 2 files changed, 8 insertions(+), 2 deletions(-)
b11fdf
b11fdf
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
b11fdf
index c0430e6..09884d7 100644
b11fdf
--- a/qga/commands-posix.c
b11fdf
+++ b/qga/commands-posix.c
b11fdf
@@ -949,7 +949,12 @@ static void build_guest_fsinfo_for_real_device(char const *syspath,
b11fdf
     if (udev == NULL || udevice == NULL) {
b11fdf
         g_debug("failed to query udev");
b11fdf
     } else {
b11fdf
-        const char *serial;
b11fdf
+        const char *devnode, *serial;
b11fdf
+        devnode = udev_device_get_devnode(udevice);
b11fdf
+        if (devnode != NULL) {
b11fdf
+            disk->dev = g_strdup(devnode);
b11fdf
+            disk->has_dev = true;
b11fdf
+        }
b11fdf
         serial = udev_device_get_property_value(udevice, "ID_SERIAL");
b11fdf
         if (serial != NULL && *serial != 0) {
b11fdf
             disk->serial = g_strdup(serial);
b11fdf
diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
b11fdf
index 426528c..ca022ad 100644
b11fdf
--- a/qga/qapi-schema.json
b11fdf
+++ b/qga/qapi-schema.json
b11fdf
@@ -833,6 +833,7 @@
b11fdf
 # @target: target id
b11fdf
 # @unit: unit id
b11fdf
 # @serial: serial number (since: 3.1)
b11fdf
+# @dev: device node (POSIX) or device UNC (Windows) (since: 3.1)
b11fdf
 #
b11fdf
 # Since: 2.2
b11fdf
 ##
b11fdf
@@ -840,7 +841,7 @@
b11fdf
   'data': {'pci-controller': 'GuestPCIAddress',
b11fdf
            'bus-type': 'GuestDiskBusType',
b11fdf
            'bus': 'int', 'target': 'int', 'unit': 'int',
b11fdf
-           '*serial': 'str'} }
b11fdf
+           '*serial': 'str', '*dev': 'str'} }
b11fdf
 
b11fdf
 ##
b11fdf
 # @GuestFilesystemInfo:
b11fdf
-- 
b11fdf
1.8.3.1
b11fdf