qemu-ga-win: 'guest-get-fsinfo' command wont query storage devices of bus type USB
cover qemu-ga-win: 'guest-get-fsinfo' command wont query storage devices of bus type USB
guest-get-fsinfo won't query storage devices of bus-type USB (https://bugzilla.redhat.com/show_bug.cgi?id=2090333).
Bug, get_pci_info function returns an error after not finding any storage port device info on the USB disk parent device (because of USB abstraction).
Fix, skip getting PCI info (get_pci_info function) for USB disks (as USB disk doesn't have PCI info), and return an empty PCI address instead to keep with schema.
Kfir Manor (2):
adding a empty PCI address creation function
skip getting pci info for USB disks
qga/commands-win32.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-)
Signature · 1 line
2.38.1
PATCH 1/2 qga:/qga-win: adding a empty PCI address creation function
Refactoring code to avoid duplication of creating an empty PCI address code.
--- qga/commands-win32.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
qga/commands-win32.c +13 -7
@@ -599,6 +599,18 @@ static void get_pci_address_for_device(GuestPCIAddress *pci, } } +static GuestPCIAddress *get_empty_pci_address (void ) +{ +GuestPCIAddress *pci =NULL ; + + pci =g_malloc0 (sizeof (*pci)); + pci->domain =-1 ; + pci->slot =-1 ; + pci->function =-1 ; + pci->bus =-1 ; +return pci; +} +static GuestPCIAddress *get_pci_info (int number,Error **errp) {HDEVINFO dev_info =INVALID_HANDLE_VALUE ;
@@ -608,13 +620,7 @@ static GuestPCIAddress *get_pci_info(int number, Error **errp)SP_DEVICE_INTERFACE_DATA dev_iface_data;HANDLE dev_file;int i; -GuestPCIAddress *pci =NULL ; - - pci =g_malloc0 (sizeof (*pci)); - pci->domain =-1 ; - pci->slot =-1 ; - pci->function =-1 ; - pci->bus =-1 ; +GuestPCIAddress *pci =get_empty_pci_address (); dev_info =SetupDiGetClassDevs (&GUID_DEVINTERFACE_DISK ,0 ,0 ,DIGCF_PRESENT |DIGCF_DEVICEINTERFACE );
Signature · 1 line
2.38.1
Re: [PATCH 1/2] qga:/qga-win: adding a empty PCI address creation function
Quoted 52 lines · Kfir Manor
Refactoring code to avoid duplication of creating an empty PCI address code.
Signed-off-by Kfir Manor <[email protected]>--- qga/commands-win32.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)qga/commands-win32.c +12
-0@@ -599,6 +599,18 @@ static void get_pci_address_for_device(GuestPCIAddress *pci, } } +static GuestPCIAddress *get_empty_pci_address (void ) +{ +GuestPCIAddress *pci =NULL ; + + pci =g_malloc0 (sizeof (*pci)); + pci->domain =-1 ; + pci->slot =-1 ; + pci->function =-1 ; + pci->bus =-1 ; +return pci; +} +static GuestPCIAddress *get_pci_info (int number,Error **errp) {HDEVINFO dev_info = INVALID_HANDLE_VALUE;qga/commands-win32.c +1
-7@@ -608,13 +620,7 @@ static GuestPCIAddress *get_pci_info(int number, Error **errp) SP_DEVICE_INTERFACE_DATA dev_iface_data;HANDLE dev_file;int i; -GuestPCIAddress *pci =NULL ; - - pci =g_malloc0 (sizeof (*pci)); - pci->domain =-1 ; - pci->slot =-1 ; - pci->function =-1 ; - pci->bus =-1 ; +GuestPCIAddress *pci =get_empty_pci_address (); dev_info = SetupDiGetClassDevs(&GUID_DEVINTERFACE_DISK, 0, 0,DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);--
2.38.1
PATCH 2/2 qga:/qga-win: skip getting pci info for USB disks
In reply to Kfir ManorSkip getting PCI info from disks type USB and give them an empty PCI address instead.
--- qga/commands-win32.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
qga/commands-win32.c +8 -4
@@ -878,10 +878,14 @@ static void get_single_disk_info(int disk_number,* if that doesn't hold since that suggests some other unexpected * breakage */ - disk->pci_controller =get_pci_info (disk_number, &local_err); -if (local_err) { -error_propagate (errp, local_err); - goto err_close; +if (disk->bus_type ==GUEST_DISK_BUS_TYPE_USB ) { + disk->pci_controller =get_empty_pci_address (); + }else { + disk->pci_controller =get_pci_info (disk_number, &local_err); +if (local_err) { +error_propagate (errp, local_err); + goto err_close; + } }if (disk->bus_type ==GUEST_DISK_BUS_TYPE_SCSI || disk->bus_type == GUEST_DISK_BUS_TYPE_IDE
Signature · 1 line
2.38.1
Re: [PATCH 2/2] qga:/qga-win: skip getting pci info for USB disks
Quoted 35 lines · Kfir Manor
Skip getting PCI info from disks type USB and give them an empty PCI address instead.
Signed-off-by Kfir Manor <[email protected]>--- qga/commands-win32.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)qga/commands-win32.c +8
-5@@ -878,10 +878,14 @@ static void get_single_disk_info(int disk_number,* if that doesn't hold since that suggests some other unexpected * breakage */ - disk->pci_controller =get_pci_info (disk_number, &local_err); -if (local_err) { -error_propagate (errp, local_err); - goto err_close; +if (disk->bus_type ==GUEST_DISK_BUS_TYPE_USB ) { + disk->pci_controller =get_empty_pci_address (); + }else { + disk->pci_controller =get_pci_info (disk_number, &local_err); +if (local_err) { +error_propagate (errp, local_err); + goto err_close; + } }if (disk->bus_type ==GUEST_DISK_BUS_TYPE_SCSI || disk->bus_type == GUEST_DISK_BUS_TYPE_IDE --2.38.1
Hi
Quoted 12 lines · Kfir Manor
guest-get-fsinfo won't query storage devices of bus-type USB (https://bugzilla.redhat.com/show_bug.cgi?id=2090333).
Bug,
get_pci_infofunction returns an error after not finding any storage port device info on the USB disk parent device (because of USB abstraction).Fix, skip getting PCI info (
get_pci_infofunction) for USB disks (as USB disk doesn't have PCI info), and return an empty PCI address instead to keep with schema.Kfir Manor (2):
adding a empty PCI address creation function
skip getting pci info for USB disks
Quoted 7 lines
qga/commands-win32.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-)--
2.38.1
Signature · 1 line
Marc-André Lureau
the series was merged
Best Regards,
Konstantin Kostiuk.
Quoted 36 lines · Marc-André Lureau
Hi
Quoted 2 lines · Kfir Manor
guest-get-fsinfo won't query storage devices of bus-type USB (
https://bugzilla.redhat.com/show_bug.cgi?id=2090333).
Quoted 2 lines
Bug,
get_pci_infofunction returns an error after not finding anystorage port device info on the USB disk parent device (because of USB abstraction).
Quoted 2 lines
Fix, skip getting PCI info (
get_pci_infofunction) for USB disks (as USBdisk doesn't have PCI info), and return an empty PCI address instead to keep with schema.
Quoted 6 lines
Kfir Manor (2):
adding a empty PCI address creation function
skip getting pci info for USB disksQuoted 7 lines
qga/commands-win32.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-)--
2.38.1Reviewed-by Marc-André Lureau <[email protected]>--
Marc-André Lureau