Skip to contentSkip to conversation

ui/cocoa: Do not alert even without block devices

PATCH In review Akihiko Odaki 3 participants 4 messages Feb 13, 2022 – Feb 14, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ui/cocoa: Do not alert even without block devices

---
 ui/cocoa.m | 5 -----
 1 file changed, 5 deletions(-)
ui/cocoa.m +0 -5
index ac18e14ce01..271a2676026 100644
@@ -1715,11 +1715,6 @@ static void addRemovableDevicesMenuItems(void)
 
     currentDevice = qmp_query_block(NULL);
     pointerToFree = currentDevice;
-    if(currentDevice == NULL) {
-        NSBeep();
-        QEMU_Alert(@"Failed to query for block devices!");
-        return;
-    }
 
     menu = [[[NSApp mainMenu] itemWithTitle:@"Machine"] submenu];
 
Signature · 1 line
2.32.0 (Apple Git-132)
Tested-by Philippe Mathieu-Daudé on v1 1/1
#1 lore raw
Quoted 11 lines · Akihiko Odaki
---
  ui/cocoa.m | 5 -----
  1 file changed, 5 deletions(-)
ui/cocoa.m +0 -0
index ac18e14ce01..271a2676026 100644
@@ -1715,11 +1715,6 @@ static void addRemovableDevicesMenuItems(void)
 

ui/cocoa.m static void addRemovableDevicesMenuItems(void) · line 1720

Quoted 10 lines
ui/cocoa.m +0 -5
      currentDevice = qmp_query_block(NULL);
      pointerToFree = currentDevice;
-    if(currentDevice == NULL) {
-        NSBeep();
-        QEMU_Alert(@"Failed to query for block devices!");
-        return;
-    }
 
      menu = [[[NSApp mainMenu] itemWithTitle:@"Machine"] submenu];
 

Cc'ing qemu-block@ and Markus (QMP).

I always wondered the point of this annoying warning but never found out.

Is this menu updated when removable blkdev are hot-plugged from the monitor or QMP?

#2 lore raw
Quoted 2 lines · Philippe Mathieu-Daudé

Is this menu updated when removable blkdev are hot-plugged from the monitor or QMP?

Actually no.

Reviewed-by Peter Maydell
#3 lore raw
In reply to Philippe Mathieu-Daudé via
Quoted 23 lines · Philippe Mathieu-Daudé
Quoted 9 lines · Akihiko Odaki
---
  ui/cocoa.m | 5 -----
  1 file changed, 5 deletions(-)
ui/cocoa.m +0 -0
index ac18e14ce01..271a2676026 100644

ui/cocoa.m static void addRemovableDevicesMenuItems(void) · line 1719

Quoted 10 lines
ui/cocoa.m +0 -5
@@ -1715,11 +1715,6 @@ static void addRemovableDevicesMenuItems(void)
        currentDevice = qmp_query_block(NULL);
      pointerToFree = currentDevice;
-    if(currentDevice == NULL) {
-        NSBeep();
-        QEMU_Alert(@"Failed to query for block devices!");
-        return;
-    }
        menu = [[[NSApp mainMenu] itemWithTitle:@"Machine"]
 submenu];
 

Cc'ing qemu-block@ and Markus (QMP).

Quoted 2 lines

I always wondered the point of this annoying warning but never found out.

The condition conflates "query failed" (returns null with error and "no block devices" (returns empty list, i.e. null, with no error set). Quite suspicious.

Goes back to

Author: John Arbuckle <[email protected]>
Date: Fri Jun 19 10:53:27 2015 +0100

ui/cocoa.m: Add machine menu items to change and eject removable drive media

Adds all removable devices to the Machine menu as a Change and Eject menu item pair. ide-cd0 would have a "Change ide-cd0..." and "Eject ide-cd0" menu items.

Quoted 4 lines

Is this menu updated when removable blkdev are hot-plugged from the monitor or QMP?