migration: Allow postcopy_ram_supported_by_host() to report err
authorPeter Xu <peterx@redhat.com>
Wed, 26 Apr 2023 01:15:14 +0000 (21:15 -0400)
committerJuan Quintela <quintela@redhat.com>
Thu, 27 Apr 2023 08:18:25 +0000 (10:18 +0200)
commit74c38cf7fd24c60e4f0a90585d17250478260877
tree9a639322ddd6fb2aa4fa3838fff16b9d3069906d
parent09d6c9658474e8573c5ada58dca8b20fe47dd99e
migration: Allow postcopy_ram_supported_by_host() to report err

Instead of print it to STDERR, bring the error upwards so that it can be
reported via QMP responses.

E.g.:

{ "execute": "migrate-set-capabilities" ,
  "arguments": { "capabilities":
  [ { "capability": "postcopy-ram", "state": true } ] } }

{ "error":
  { "class": "GenericError",
    "desc": "Postcopy is not supported: Host backend files need to be TMPFS
    or HUGETLBFS only" } }

Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
migration/options.c
migration/postcopy-ram.c
migration/postcopy-ram.h
migration/savevm.c