]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qga: linux: return disk device in guest-get-fsinfo
authorTomáš Golembiovský <tgolembi@redhat.com>
Tue, 23 Oct 2018 11:23:12 +0000 (13:23 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 31 Oct 2018 14:04:20 +0000 (09:04 -0500)
Report device node of the disk on Linux (e.g. "/dev/sda2").
Requirs libudev.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qga/commands-posix.c
qga/qapi-schema.json

index 41bd11b2b58397cff54e274fd404245619055a21..1877976522773231b040bdc311380b98ec472a06 100644 (file)
@@ -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);
index 3bcda6257e69982ce24690cd31910c1a866b5044..c6725b3ec81eabdb8388cc77f496680d1f6ce252 100644 (file)
 # @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
 ##
   'data': {'pci-controller': 'GuestPCIAddress',
            'bus-type': 'GuestDiskBusType',
            'bus': 'int', 'target': 'int', 'unit': 'int',
-           '*serial': 'str'} }
+           '*serial': 'str', '*dev': 'str'} }
 
 ##
 # @GuestFilesystemInfo: