qga: report serial number and disk node
v3 cover qga: report serial number and disk node
Note that PCI controller reporting on Windows was and still is broken. Unfortunately I don't know how to fix it at the momemnt. See commit message and code comment. If anyone has environment where the original code works let me know. CCing author of the code In case I missed something obvious.
v3:
- fix typos
- add configure test for libudev
- change order of patches fixing PCI controller info and build fix to avoid exposing broken code
- split reporting of serial number and device node into two separate patches
v2:
- fix checkpatch error
Patches 1 and 3 are bug-fixes of existing code
Patch 2 is optional and contains debug messages -- the windows QGA seriously lacks debug messages...
Patch 4 adds reporting of disk serial number and device node of the disk.
Tomáš Golembiovský (5):
qga: win32: fix crashes when PCI info cannot be retrived
build: rename CONFIG_QGA_NTDDDISK to CONFIG_QGA_NTDDSCSI
qga: win32: add debugging information
qga: report disk serial number
qga: return disk device in guest-get-fsinfo
configure | 24 ++++- qga/Makefile.objs | 1 + qga/commands-posix.c | 27 +++++ qga/commands-win32.c | 248 ++++++++++++++++++++++++++++++++++++------- qga/qapi-schema.json | 5 +- 5 files changed, 264 insertions(+), 41 deletions(-)
Signature · 1 line
2.18.0
PATCH v3 1/5 qga: win32: fix crashes when PCI info cannot be retrived
The guest-get-fsinfo command collects also information about PCI controller where the disk is attached. When this fails for some reasons it tries to return just the partial information. However in certain cases the pointer to the structure was not initialized and was set to NULL. This breaks the serializer and leads to a crash of the guest agent.
--- qga/commands-win32.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-)
qga/commands-win32.c +22 -5
@@ -633,15 +633,32 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp) * https://technet.microsoft.com/en-us/library/ee851589(v=ws.10).aspx */if (DeviceIoControl (vol_h,IOCTL_SCSI_GET_ADDRESS ,NULL ,0 , scsi_ad,sizeof (SCSI_ADDRESS ), &len,NULL )) { +Error *local_err =NULL ; disk->unit = addr.Lun; disk->target = addr.TargetId; disk->bus = addr.PathId; - disk->pci_controller =get_pci_info (name, errp); +g_debug ("unit=%lld target=%lld bus=%lld" , + disk->unit, disk->target, disk->bus); + disk->pci_controller =get_pci_info (name, &local_err); + +if (local_err) { +g_debug ("failed to get PCI controller info: %s" , +error_get_pretty (local_err)); +error_free (local_err); + }else if (disk->pci_controller !=NULL ) { +g_debug ("pci: domain=%lld bus=%lld slot=%lld function=%lld" , + disk->pci_controller->domain, + disk->pci_controller->bus, + disk->pci_controller->slot, + disk->pci_controller->function); + } } -/* We do not set error in this case, because we still have enough -* information about volume. */ - }else { - disk->pci_controller =NULL ; + } +/* We do not set error in case pci_controller is NULL, because we still +* have enough information about volume. */ +if (disk->pci_controller ==NULL ) { +g_debug ("no PCI controller info" ); + disk->pci_controller =g_malloc0 (sizeof (GuestPCIAddress)); } list =g_malloc0 (sizeof (*list));
Signature · 1 line
2.18.0
PATCH v3 2/5 build: rename CONFIG_QGA_NTDDDISK to CONFIG_QGA_NTDDSCSI
In reply to Tomáš GolembiovskýThere was inconsistency between commits:
50cbebb9a3 configure: add configure check for ntdddisk.h a3ef3b2272 qga: added bus type and disk location path
The first commit added #define CONFIG_QGA_NTDDDISK but the second commit expected the name to be CONFIG_QGA_NTDDSCSI. As a result the code in second patch was never used.
Renaming the option to CONFIG_QGA_NTDDSCSI to match the name of header file that is being checked for.
--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
@@ -6201,7 +6201,7 @@ if test "$mingw32" = "yes" ; then echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak fi if test "$guest_agent_ntddscsi" = "yes" ; then - echo "CONFIG_QGA_NTDDDISK=y" >> $config_host_mak + echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak fi if test "$guest_agent_msi" = "yes"; then echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak
Signature · 1 line
2.18.0
PATCH v3 3/5 qga: win32: add debugging information
In reply to Tomáš GolembiovskýThe windows code generaly lacks debug information (compared to posix code). This patch adds some related to HW info in guest-get-fsinfo command.
--- qga/commands-win32.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
qga/commands-win32.c +15 -0
@@ -89,6 +89,12 @@ static OpenFlags guest_file_open_modes[] = { {"a+b", FILE_GENERIC_APPEND|GENERIC_READ, OPEN_ALWAYS } }; +#define g_debug_err (msg) do { \ + char *suffix = g_win32_error_message(GetLastError()); \ + g_debug("%s: %s", (msg), suffix); \ + g_free(suffix); \ +} while(0) +static OpenFlags *find_open_flag (const char *mode_str) {int mode;
@@ -498,6 +504,7 @@ static GuestPCIAddress *get_pci_info(char *guid, Error **errp) goto out; } +g_debug ("enumerating devices" ); dev_info_data.cbSize =sizeof (SP_DEVINFO_DATA );for (i =0 ;SetupDiEnumDeviceInfo (dev_info, i, &dev_info_data); i++) {DWORD addr, bus, slot, func, dev, data, size2;
@@ -522,6 +529,7 @@ static GuestPCIAddress *get_pci_info(char *guid, Error **errp)if (g_strcmp0 (buffer, dev_name)) {continue ; } +g_debug ("found device %s" , dev_name);/* There is no need to allocate buffer in the next functions. The size * is known and ULONG according to
@@ -530,6 +538,7 @@ static GuestPCIAddress *get_pci_info(char *guid, Error **errp)*/ if (!SetupDiGetDeviceRegistryProperty (dev_info, &dev_info_data,SPDRP_BUSNUMBER , &data, (PBYTE )&bus, size,NULL )) { +g_debug_err ("failed to get bus" );break ; }
@@ -537,6 +546,7 @@ static GuestPCIAddress *get_pci_info(char *guid, Error **errp)* transformed into device function and number */ if (!SetupDiGetDeviceRegistryProperty (dev_info, &dev_info_data,SPDRP_ADDRESS , &data, (PBYTE )&addr, size,NULL )) { +g_debug_err ("failed to get address" );break ; }
@@ -544,6 +554,7 @@ static GuestPCIAddress *get_pci_info(char *guid, Error **errp)* This number is typically a user-perceived slot number. */ if (!SetupDiGetDeviceRegistryProperty (dev_info, &dev_info_data,SPDRP_UI_NUMBER , &data, (PBYTE )&slot, size,NULL )) { +g_debug_err ("failed to get slot" );break ; }
@@ -608,6 +619,7 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp) scsi_ad = &addr;char *name =g_strndup (guid,strlen (guid)-1 ); +g_debug ("getting disk info for: %s" , name); vol_h =CreateFile (name,0 ,FILE_SHARE_READ ,NULL ,OPEN_EXISTING ,0 ,NULL );if (vol_h ==INVALID_HANDLE_VALUE ) {
@@ -615,6 +627,7 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp) goto out_free; } +g_debug ("getting bus type" ); bus =get_disk_bus_type (vol_h, errp);if (bus <0 ) { goto out_close;
@@ -622,6 +635,7 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp) disk =g_malloc0 (sizeof (*disk)); disk->bus_type =find_bus_type (bus); +g_debug ("bus type %d" , disk->bus_type);if (bus == BusTypeScsi || bus == BusTypeAta || bus ==BusTypeRAID #if (_WIN32_WINNT >= 0x0600) /* This bus type is not supported before Windows Server 2003 SP1 */
@@ -631,6 +645,7 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp)/* We are able to use the same ioctls for different bus types * according to Microsoft docs * https://technet.microsoft.com/en-us/library/ee851589(v=ws.10).aspx */ +g_debug ("getting pci-controller info" );if (DeviceIoControl (vol_h,IOCTL_SCSI_GET_ADDRESS ,NULL ,0 , scsi_ad,sizeof (SCSI_ADDRESS ), &len,NULL )) {Error *local_err =NULL ;
Signature · 1 line
2.18.0
PATCH v3 4/5 qga: report disk serial number
In reply to Tomáš GolembiovskýThe feature is implemented for Windows and Linux. Reporting of serial number on Linux depends on libudev.
Example from Linux:
{
"name": "dm-2",
"mountpoint": "/",
...
"disk": [
{
"serial": "SAMSUNG_MZ7LN512HCHP-000L1_S1ZKNXAG822493",
...
}
],
}--- configure | 22 ++++++++++++++ qga/Makefile.objs | 1 + qga/commands-posix.c | 22 ++++++++++++++ qga/commands-win32.c | 71 ++++++++++++++++++++++++++++++++------------ qga/qapi-schema.json | 4 ++- 5 files changed, 100 insertions(+), 20 deletions(-)
configure +22 -0
@@ -477,6 +477,7 @@ libxml2="" docker="no" debug_mutex="no" libpmem="" +libudev="no" # cross compilers defaults, can be overridden with --cross-cc-ARCH cross_cc_aarch64="aarch64-linux-gnu-gcc"
@@ -873,6 +874,7 @@ Linux) vhost_vsock="yes" QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES" supported_os="yes" + libudev="yes" ;; esac
@@ -5676,6 +5678,20 @@ if test "$libnfs" != "no" ; then fi fi +########################################## +# Do we have libudev +if test "$libudev" != "no" ; then + if $pkg_config libudev; then + libudev="yes" + libudev_libs=$($pkg_config --libs libudev) + else + if test "$libudev" = "yes" ; then + feature_not_found "libudev" "Install systemd development files" + fi + libudev="no" + fi +fi + # Now we've finished running tests it's OK to add -Werror to the compiler flags if test "$werror" = "yes"; then QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
@@ -6100,6 +6116,7 @@ echo "VxHS block device $vxhs" echo "capstone $capstone" echo "docker $docker" echo "libpmem support $libpmem" +echo "libudev $libudev" if test "$sdl_too_old" = "yes"; then echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -6944,6 +6961,11 @@ if test "$docker" != "no"; then echo "HAVE_USER_DOCKER=y" >> $config_host_mak fi +if test "$libudev" != "no"; then + echo "CONFIG_LIBUDEV=y" >> $config_host_mak + echo "LIBUDEV_LIBS=$libudev_libs" >> $config_host_mak +fi + # use included Linux headers if test "$linux" = "yes" ; then mkdir -p linux-headers
qga/Makefile.objs +1 -0
@@ -1,3 +1,4 @@ +commands-posix.o-libs := $(LIBUDEV_LIBS) qga-obj-y = commands.o guest-agent-command-state.o main.o qga-obj-$(CONFIG_POSIX) += commands-posix.o channel-posix.o qga-obj-$(CONFIG_WIN32) += commands-win32.o channel-win32.o service-win32.o
qga/commands-posix.c +22 -0
@@ -47,6 +47,7 @@ extern char **environ;#include <sys/socket.h> #include <net/if.h> #include <sys/statvfs.h> +#include <libudev.h> #ifdef FIFREEZE #define CONFIG_FSFREEZE
@@ -872,6 +873,10 @@ static void build_guest_fsinfo_for_real_device(char const *syspath,GuestDiskAddressList *list =NULL ;bool has_ata = false, has_host = false, has_tgt = false;char *p, *q, *driver =NULL ; +#ifdef CONFIG_LIBUDEV +struct udev *udev =NULL ; +struct udev_device *udevice =NULL ; +#endif p =strstr (syspath,"/devices/pci" ); if (!p || sscanf(p + 12, "%*x:%*x/%x:%x:%x.%x%n",
@@ -936,6 +941,21 @@ static void build_guest_fsinfo_for_real_device(char const *syspath, list =g_malloc0 (sizeof (*list)); list->value = disk; +#ifdef CONFIG_LIBUDEV + udev =udev_new (); + udevice =udev_device_new_from_syspath (udev, syspath); +if (udev ==NULL || udevice ==NULL ) { +g_debug ("failed to query udev" ); + }else { +const char *serial; + serial =udev_device_get_property_value (udevice,"ID_SERIAL" ); +if (serial !=NULL && *serial !=0 ) { + disk->serial =g_strdup (serial); + disk->has_serial = true; + } + } +#endif +if (strcmp (driver,"ata_piix" ) ==0 ) {/* a host per ide bus, target*:0:<unit>:0 */ if (!has_host || !has_tgt) {
@@ -1003,6 +1023,8 @@ cleanup:qapi_free_GuestDiskAddressList (list); }g_free (driver); +udev_unref (udev); +udev_device_unref (udevice); } static void build_guest_fsinfo_for_device(char const *devpath,
qga/commands-win32.c +52 -19
118 lines not on this page · raw message
qga/qapi-schema.json +3 -1
@@ -834,13 +834,15 @@ # @bus: bus id # @target: target id # @unit: unit id +# @serial: serial number (since: 3.1) # # Since: 2.2 ## { 'struct': 'GuestDiskAddress', 'data': {'pci-controller': 'GuestPCIAddress', 'bus-type': 'GuestDiskBusType', - 'bus': 'int', 'target': 'int', 'unit': 'int'} } + 'bus': 'int', 'target': 'int', 'unit': 'int', + '*serial': 'str'} } ## # @GuestFilesystemInfo:
Signature · 1 line
2.18.0
PATCH v3 5/5 qga: return disk device in guest-get-fsinfo
In reply to Tomáš GolembiovskýReport device node of the disk. It is implemented for Linux (needs udev) and Windows. The node is reported e.g. as "/dev/sda2" on Linux and as "\\?\PhysicalDriveX" on Windows.
As part of this effort the Windows code was changed to probe disk extents and return list of all disks. Originally only first disk of composite volume was returned.
Note that the patch changes get_pci_info() from one state of brokenness into a different state of brokenness. In other words it still does not do what it's supposed to do (see comment in code). If anyone knows how to fix it, please step in.
--- qga/commands-posix.c | 7 +- qga/commands-win32.c | 163 +++++++++++++++++++++++++++++++++++-------- qga/qapi-schema.json | 3 +- 3 files changed, 142 insertions(+), 31 deletions(-)
qga/commands-posix.c +6 -1
@@ -947,7 +947,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);
qga/commands-win32.c +134 -29
239 lines not on this page · raw message
qga/qapi-schema.json +2 -1
@@ -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:
Signature · 1 line
2.18.0
Re: [Qemu-devel] [PATCH v3 1/5] qga: win32: fix crashes when PCI info cannot be retrived
In reply to a message not in the archiveQuoted 67 lines · On Thu, 27 Sep 2018 18:16:04 +0300 Sameeh Jubran <[email protected]> wrote:
Quoted 64 lines · Tomáš Golembiovský
Hi Michael,
thanks for looking into this. My comments are below.
Adding Sameeh...
Quoted 6 lines · On Wed, 26 Sep 2018 12:15:48 -0500 Michael Roth <[email protected]>…
Quoting Tomáš Golembiovský (2018-09-07 06:42:09)
Quoted 5 lines
The guest-get-fsinfo command collects also information about PCI controller where the disk is attached. When this fails for some reasons it tries to return just the partial information. However in certain cases the pointer to the structure was not initialized and was set to NULL. This breaks the serializer and leads to a crash of the guest
agent.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Tomáš Golembiovský <[email protected]>For a win10 guest started with:
qemu-system-x86_64 -m 2G -smp 2,cores=2,sockets=1 -drive
file=/home/mdroth/vm/win10_pro_n_snap0.qcow2,if=virtio -drive file=/home/mdroth/vm/virtio-win-0.1.102.iso,if=ide,media=cdrom -rtc base=localtime,driftfix=slew -vga std -boot d -name vm4 -netdev tap,script=/etc/qemu-ifup,vhost=on,id=vnet0 -device virtio-net-pci,mac=52:54:00:12:34:04,id=vnic0,netdev=vnet0,disable-modern=true -vnc :4 -device virtio-serial -balloon virtio -mon chardev=hmp0 -chardev socket,path=/tmp/vm4-hmp0.sock,server,nowait,id=hmp0 -mon chardev=qmp0,mode=control -chardev socket,path=/tmp/vm4-qmp0.sock,server,nowait,id=qmp0 -device virtserialport,chardev=vs0,name=vs0,id=vs_vs0 -chardev socket,path=/tmp/vm4-vs0.sock,server,nowait,id=vs0 -device virtserialport,chardev=vs1,name=vs1,id=vs_vs1 -chardev socket,path=/tmp/vm4-vs1.sock,server,nowait,id=vs1 -device virtserialport,chardev=qga,name=org.qemu.guest_agent.0,id=vs_qga -chardev socket,path=/tmp/vm4-qga.sock,server,nowait,id=qga -device isa-serial,chardev=serial0,id=serial_serial0 -chardev socket,path=/tmp/vm4-serial0.sock,server,nowait,id=serial0 -L
/home/mdroth/w/build/qemu-2.11.2-build/pc-bios--enable-kvmQuoted 5 lines
this yields the following:
{'execute':'guest-get-fsinfo'}
{"return": [{"name":"\\\\?\\Volume{83835b2d-0032-11e6-a84f-806e6f6e6963}\\", "total-bytes":
160755712, "mountpoint": "D:\\", "disk": [{"bus-type": "ide", "bus": 0, "unit": 0, "pci-controller": {"bus": 0, "slot": 0, "domain": 0, "function":
0}, "target": 0}], "used-bytes": 160755712, "type": "CDFS"}, {"name":
"\\\\?\\Volume{2ea839c6-0000-0000-0000-80620c000000}\\", "mountpoint":
"System Reserved", "disk": [{"bus-type": "scsi", "bus": 0, "unit": 0, "pci-controller": {"bus": 0, "slot": 0, "domain": 0, "function": 0}, "target": 0}], "type": "NTFS"}, {"name":
"\\\\?\\Volume{2ea839c6-0000-0000-0000-501f00000000}\\", "total-bytes":
52665839616, "mountpoint": "C:\\", "disk": [{"bus-type": "scsi", "bus": 0, "unit": 0, "pci-controller": {"bus": 0, "slot": 0, "domain": 0, "function":
0}, "target": 0}], "used-bytes": 25265487872, "type": "NTFS"}, {"name":
"\\\\?\\Volume{2ea839c6-0000-0000-0000-100000000000}\\", "mountpoint":
"System Reserved", "disk": [{"bus-type": "scsi", "bus": 0, "unit": 0, "pci-controller": {"bus": 0, "slot": 0, "domain": 0, "function": 0}, "target": 0}], "type": "NTFS"}]}Quoted 2 lines
domain/bus/slot/function=0 are valid PCI addresses so initializing to 0
Quoted 9 lines
Quoted 6 lines
is
Quoted 4 lines
wrong. Sameeh had a previous series that initializes to -1 that I think is more appropriate (it hasn't gone in yet since we opted not to enable
CONFIG_QGA_NTDDSCSIfor 3.0 since the PCI stuff seems be generally broken for Windows, also because the 2nd patch needs some fixups:Can you please elaborate? What kind of fixups? I can see no comments of this in the 2nd patch
I think he refers to this fix:
https://github.com/mdroth/qemu/commit/201db36b56d7d1ba5ff720eedcb3b62b75306fde
Plus there seems to be an issue when "calculating" function number as described below. (Maybe related to casting addr from -1 to uint and back?)
Quoted 46 lines
Quoted 44 lines
I wasn't aware of that. I is trying to "fix" the same issue.
I've been also thinking about using -1, but I didn't know what is/isn't correct PCI address.
Quoted 4 lines
With that series (and some fixups I have on top at
https://github.com/mdroth/qemu/commits/qga-test), we get the following output:Should I rebase on that and drop my patch?
Quoted 3 lines
{'execute':'guest-get-fsinfo'}
{"return": [{"name":"\\\\?\\Volume{83835b2d-0032-11e6-a84f-806e6f6e6963}\\", "total-bytes":
160755712, "mountpoint": "D:\\", "disk": [{"bus-type": "ide", "bus": 0, "unit": 0, "pci-controller": {"bus": -1, "slot": -1, "domain": -1, "function": -1}, "target": 0}], "used-bytes": 160755712, "type": "CDFS"}, {"name": "\\\\?\\Volume{2ea839c6-0000-0000-0000-80620c000000}\\", "mountpoint": "System Reserved", "disk": [{"bus-type": "scsi", "bus": 0, "unit": 0, "pci-controller": {"bus": -1, "slot": -1, "domain": 0, "function": 3}, "target": 0}], "type": "NTFS"}, {"name":
"\\\\?\\Volume{2ea839c6-0000-0000-0000-501f00000000}\\", "total-bytes":
52665839616, "mountpoint": "C:\\", "disk": [{"bus-type": "scsi", "bus": 0, "unit": 0, "pci-controller": {"bus": -1, "slot": -1, "domain": 0, "function": 2}, "target": 0}], "used-bytes": 25267560448, "type": "NTFS"}, {"name": "\\\\?\\Volume{2ea839c6-0000-0000-0000-100000000000}\\", "mountpoint": "System Reserved", "disk": [{"bus-type": "scsi", "bus": 0, "unit": 0, "pci-controller": {"bus": -1, "slot": -1, "domain": 0, "function": 1}, "target": 0}], "type": "NTFS"}]}Quoted 5 lines
Here we see the non-sensical PCI topology info I mentioned previously. There are values like '"function": 3' even though there are no multifunction devices present. This will be exposed to users if we enable
CONFIG_QGA_NTDDSCSIwith things as they stand.Sadly, I have no idea how to properly fix this code. But patch 5 of the series IMHO brings it one step closer to proper solution. The original code tries to fetch the addr/bus/domain/slot for volume handle (which fails on missing properties) instead of disk handle.
Quoted 7 lines
Quoted 4 lines
The remaining issue is that when listing the disks the entries are cryptic names like "\Device\0000001d" instead of "\PhysicalDriveX" or "\HarddiskX". And I don't know how to map one name to the other.
char *name = g_strdup(&guid[4]);This needs some investigation...
This is to strip first 4 characters from UNC names.
"\\?\abcdef" -> "\abcdef"
Quoted 40 lines
Quoted 33 lines
Quoted 5 lines
Currently we
just get an empty array for "disk" field of GuestFilesystemInfo for w32, which fortunately aligns with the current QAPI schema (it's an array since the volume can span multiple disks).No. You get array with one item and useless data. Unless I missed something.
Quoted 4 lines
I'm not about the
SCSI bus/unit/target data either. It's a real mess (maybe things work a bit better when an actual SCSI controller is used?) and I'm not sure why/how I didn't notice during initial testing.I think unit/target should work. At least with all patches from my series (well notably the last patch). But please, do verify that if you can.
Quoted 5 lines
I think all this needs to be addressed before we enable
CONFIG_QGA_NTDDSCSI(in terms of what that's used for in the current code at least, i.e. enabling everything reported by GuestFilesystemInfo.disk).Quoted 7 lines
What is the oVirt use-case? It doesn't seem like you need PCI topology, but what about SCSI topology (and if so, does that information seem correct to you)? Or is just a list a serials/dev paths by themselves all that's needed? Trying to see how we might decouple things from the broken PCI topology stuff. May need to deprecate GuestFilesystemInfo.disk in favor of something less monolithic if all of this isn't fixable in a reasonable-enough timeframe.
Quoted 7 lines
We don't need the PCI info. I've been only trying to fix this to some sort along the way. What we need is to get disk serial number (patch 4) and "name" of the disk of some sort (patch 5). For that I use device node (e.g.
/dev/sda) on Linux and UNC for the disk on Windows (e.g. \\?\PhysicalDrive1). But the code relies onCONFIG_QGA_NTDDSCSIbeing enabled.
Quoted 4 lines
This is already enabled in downstream version of qga-win, I don't think it should be
enabled upstream if it's not necessary. ( Actually I'm not sure why it is disabled in the first place? I supposed because it is not stable)
So can we enable CONFIG_QGA_NTDDSCSI and disable PCI controller info by different means?
Quoted 66 lines
Quoted 66 lines
Tomas
Quoted 11 lines
qga/commands-win32.c static GuestDiskAddressList
Quoted 11 lines
--- qga/commands-win32.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-)qga/commands-win32.c +0
-0@@ -633,15 +633,32 @@ static GuestDiskAddressList*build_guest_disk_info(char *guid, Error **errp)
Quoted 1 line
qga/commands-win32.c static GuestDiskAddressList · line 633
Quoted 1 line
qga/commands-win32.c +0
-0* https://technet.microsoft.com/en-us/library/ee851589(v=ws.10).aspx */
Quoted 1 line
qga/commands-win32.c static GuestDiskAddressList · line 634
Quoted 1 line
qga/commands-win32.c +0
-0if (DeviceIoControl(vol_h, IOCTL_SCSI_GET_ADDRESS, NULL, 0,
scsi_ad,Quoted 8 lines
Quoted 8 lines
qga/commands-win32.c +3
-1sizeof(SCSI_ADDRESS), &len, NULL)) { +Error *local_err =NULL ; disk->unit = addr.Lun; disk->target = addr.TargetId; disk->bus = addr.PathId; - disk->pci_controller =get_pci_info (name, errp); +g_debug ("unit=%lld target=%lld bus=%lld" , + disk->unit, disk->target, disk->bus);Quoted 8 lines
qga/commands-win32.c static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp)
Quoted 8 lines
qga/commands-win32.c +8
-0+ disk->pci_controller =get_pci_info (name, &local_err); + +if (local_err) { +g_debug ("failed to get PCI controller info: %s" , +error_get_pretty (local_err)); +error_free (local_err); + }else if (disk->pci_controller !=NULL ) { + g_debug("pci: domain=%lld bus=%lld slot=%lldfunction=%lld",
Quoted 7 lines
qga/commands-win32.c static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp)
Quoted 7 lines
qga/commands-win32.c +5
-1+ disk->pci_controller->domain, + disk->pci_controller->bus, + disk->pci_controller->slot, + disk->pci_controller->function); + } } -/* We do not set error in this case, because we still have enough
Quoted 5 lines
qga/commands-win32.c static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp)
Quoted 5 lines
qga/commands-win32.c +2
-3-* information about volume. */ - }else { - disk->pci_controller =NULL ; + } +/* We do not set error in case pci_controller is NULL, because we still
Quoted 10 lines
Quoted 10 lines
qga/commands-win32.c +4
-1+* have enough information about volume. */ +if (disk->pci_controller ==NULL ) { +g_debug ("no PCI controller info" ); + disk->pci_controller =g_malloc0 (sizeof (GuestPCIAddress)); } list =g_malloc0 (sizeof (*list)); --2.18.0
--
Tomáš Golembiovský <[email protected]>
Signature · 1 line
Tomáš Golembiovský <[email protected]>