To type an exclamation mark (!) on a French AZERTY keyboard layout using virsh send-key, you need to account for the fact that the ! character is produced by pressing Shift + 1 (the 1 key is located where the & is on a QWERTY keyboard).
Correct Argument for virsh send-key:
The virsh send-key command expects keysyms (X11 keysym names) or scancodes. For a French AZERTY layout, the ! is generated by:
Shift_L + 1 (or Shift_R + 1).
Command:
virsh send-key <domain> KEY_LEFTSHIFT KEY_1
or
virsh send-key <domain> KEY_RIGHTSHIFT KEY_1
Explanation:
KEY_LEFTSHIFT or KEY_RIGHTSHIFT simulates pressing the Shift key.
KEY_1 simulates pressing the 1 key (which, when combined with Shift, produces ! on AZERTY).
Alternative: Using X11 Keysyms
If your virsh version supports X11 keysyms, you can also use:
virsh send-key <domain> XF86_Ungrab KEY_EXCLAM
But KEY_LEFTSHIFT KEY_1 is the most reliable method for AZERTY.