From: Ross Lagerwall Date: Mon, 5 Mar 2018 10:07:46 +0000 (+0000) Subject: xen: Expect xenstore write to fail when restricted X-Git-Tag: v3.0.0-rc0~190^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4473348adf6640ca12b95bc29d1b06796994afb2;p=thirdparty%2Fqemu.git xen: Expect xenstore write to fail when restricted Saving the current state to xenstore may fail when running restricted (in particular, after a migration). Therefore, don't report the error or exit when running restricted. Toolstacks that want to allow running QEMU restricted should instead make use of QMP events to listen for state changes. CC: Ian Jackson Signed-off-by: Ross Lagerwall Reviewed-by: Ian Jackson Acked-by: Anthony PERARD --- diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c index 454777c5870..6ec14c73ca5 100644 --- a/hw/xen/xen-common.c +++ b/hw/xen/xen-common.c @@ -101,7 +101,12 @@ static void xenstore_record_dm_state(struct xs_handle *xs, const char *state) } snprintf(path, sizeof (path), "device-model/%u/state", xen_domid); - if (!xs_write(xs, XBT_NULL, path, state, strlen(state))) { + /* + * This call may fail when running restricted so don't make it fatal in + * that case. Toolstacks should instead use QMP to listen for state changes. + */ + if (!xs_write(xs, XBT_NULL, path, state, strlen(state)) && + !xen_domid_restrict) { error_report("error recording dm state"); exit(1); }