diff mbox series

[2/2] migration: Display the migration blockers

Message ID 20210202135522.127380-3-dgilbert@redhat.com
State New
Headers show
Series migration blocker information | expand

Commit Message

Dr. David Alan Gilbert Feb. 2, 2021, 1:55 p.m. UTC
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Update 'info migrate' to display migration blocking information.
If the outbound migration is not blocked, there is no change, however
if it is blocked a message is displayed with a list of reasons why,
e.g.

qemu-system-x86_64 -nographic  -smp 4 -m 4G -M pc,usb=on \
 -chardev null,id=n -device usb-serial,chardev=n \
 -virtfs local,path=/home,mount_tag=fs,security_model=none \
 -drive if=virtio,file=myimage.qcow2

(qemu) info migrate
globals:
store-global-state: on
only-migratable: off
send-configuration: on
send-section-footer: on
decompress-error-check: on
clear-bitmap-shift: 18
Outgoing migration blocked:
  Migration is disabled when VirtFS export path '/home' is mounted in the guest using mount_tag 'fs'
  non-migratable device: 0000:00:01.2/1/usb-serial

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 monitor/hmp-cmds.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Eric Blake Feb. 2, 2021, 2:38 p.m. UTC | #1
On 2/2/21 7:55 AM, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> Update 'info migrate' to display migration blocking information.
> If the outbound migration is not blocked, there is no change, however
> if it is blocked a message is displayed with a list of reasons why,
> e.g.
> 
> qemu-system-x86_64 -nographic  -smp 4 -m 4G -M pc,usb=on \
>  -chardev null,id=n -device usb-serial,chardev=n \
>  -virtfs local,path=/home,mount_tag=fs,security_model=none \
>  -drive if=virtio,file=myimage.qcow2
> 
> (qemu) info migrate
> globals:
> store-global-state: on
> only-migratable: off
> send-configuration: on
> send-section-footer: on
> decompress-error-check: on
> clear-bitmap-shift: 18
> Outgoing migration blocked:
>   Migration is disabled when VirtFS export path '/home' is mounted in the guest using mount_tag 'fs'
>   non-migratable device: 0000:00:01.2/1/usb-serial
> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  monitor/hmp-cmds.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 

> +++ b/monitor/hmp-cmds.c
> @@ -224,6 +224,15 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
>  
>      migration_global_dump(mon);
>  
> +    if (info->blocked) {

Would be slightly more accurate to gate on info->has_blocked_reasons (as
written, you are depending on the fact that patch 1 always sets blocked
and has_blocked_reasons to the same value); which again highlights the
redundancy of a bool duplicating the presence of the optional ['str']
member.  But since the code works as written,

Reviewed-by: Eric Blake <eblake@redhat.com>
Peter Xu Feb. 2, 2021, 3:53 p.m. UTC | #2
On Tue, Feb 02, 2021 at 01:55:22PM +0000, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> Update 'info migrate' to display migration blocking information.
> If the outbound migration is not blocked, there is no change, however
> if it is blocked a message is displayed with a list of reasons why,
> e.g.
> 
> qemu-system-x86_64 -nographic  -smp 4 -m 4G -M pc,usb=on \
>  -chardev null,id=n -device usb-serial,chardev=n \
>  -virtfs local,path=/home,mount_tag=fs,security_model=none \
>  -drive if=virtio,file=myimage.qcow2
> 
> (qemu) info migrate
> globals:
> store-global-state: on
> only-migratable: off
> send-configuration: on
> send-section-footer: on
> decompress-error-check: on
> clear-bitmap-shift: 18
> Outgoing migration blocked:
>   Migration is disabled when VirtFS export path '/home' is mounted in the guest using mount_tag 'fs'
>   non-migratable device: 0000:00:01.2/1/usb-serial
> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Reviewed-by: Peter Xu <peterx@redhat.com>
diff mbox series

Patch

diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index a48bc1e904..1f744f6041 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -224,6 +224,15 @@  void hmp_info_migrate(Monitor *mon, const QDict *qdict)
 
     migration_global_dump(mon);
 
+    if (info->blocked) {
+        strList *reasons = info->blocked_reasons;
+        monitor_printf(mon, "Outgoing migration blocked:\n");
+        while (reasons) {
+            monitor_printf(mon, "  %s\n", reasons->value);
+            reasons = reasons->next;
+        }
+    }
+
     if (info->has_status) {
         monitor_printf(mon, "Migration status: %s",
                        MigrationStatus_str(info->status));